Skip to content

Commit

Permalink
chore(dns)!: remove DNS server
Browse files Browse the repository at this point in the history
Signed-off-by: Charly Molter <charly.molter@konghq.com>

chore(dns): remove global DNS view

Now that we don't run the DNS server we don't need to have vips
not overlapping between mesh.
This removes this feature which greatly improves scalability when using multi-mesh

Signed-off-by: Charly Molter <charly.molter@konghq.com>

Fix chnages

Signed-off-by: Charly Molter <charly.molter@konghq.com>
  • Loading branch information
lahabana committed Apr 26, 2022
1 parent 3f0433c commit e047ece
Show file tree
Hide file tree
Showing 29 changed files with 165 additions and 1,228 deletions.
2 changes: 2 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ does not have any particular instructions.

## Upcoming release

The `control-plane` no longer hosts a builtin DNS server. You should always rely on the embedded DNS in the dataplane proxy and VIPs can't be used without transparent proxy.

## Upgrade to `1.6.x`

### Helm
Expand Down
5 changes: 0 additions & 5 deletions app/kuma-cp/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/kumahq/kuma/pkg/core/bootstrap"
"github.com/kumahq/kuma/pkg/defaults"
"github.com/kumahq/kuma/pkg/diagnostics"
"github.com/kumahq/kuma/pkg/dns"
dp_server "github.com/kumahq/kuma/pkg/dp-server"
"github.com/kumahq/kuma/pkg/gc"
"github.com/kumahq/kuma/pkg/hds"
Expand Down Expand Up @@ -88,10 +87,6 @@ func newRunCmdWithOpts(opts kuma_cmd.RunCmdOpts) *cobra.Command {
runLog.Error(err, "unable to set up Monitoring Assignment server")
return err
}
if err := dns.Setup(rt); err != nil {
runLog.Error(err, "unable to set up DNS")
return err
}
if err := xds.Setup(rt); err != nil {
runLog.Error(err, "unable to set up XDS")
return err
Expand Down
1 change: 0 additions & 1 deletion pkg/api-server/config_ws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ var _ = Describe("Config WS", func() {
"dnsServer": {
"CIDR": "240.0.0.0/4",
"domain": "mesh",
"port": 5653,
"serviceVipEnabled": true
},
"dpServer": {
Expand Down
6 changes: 0 additions & 6 deletions pkg/config/dns-server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
type DNSServerConfig struct {
// The domain that the server will resolve the services for
Domain string `yaml:"domain" envconfig:"kuma_dns_server_domain"`
// Port on which the server is exposed
Port uint32 `yaml:"port" envconfig:"kuma_dns_server_port"`
// CIDR used to allocate virtual IPs from
CIDR string `yaml:"CIDR" envconfig:"kuma_dns_server_cidr"`
// ServiceVipEnabled will create a service "<kuma.io/service>.mesh" dns entry for every service.
Expand All @@ -23,9 +21,6 @@ func (g *DNSServerConfig) Sanitize() {
}

func (g *DNSServerConfig) Validate() error {
if g.Port > 65535 {
return errors.New("Port must be in the range [0, 65535]")
}
_, _, err := net.ParseCIDR(g.CIDR)
if err != nil {
return errors.New("Must provide a valid CIDR")
Expand All @@ -39,7 +34,6 @@ func DefaultDNSServerConfig() *DNSServerConfig {
return &DNSServerConfig{
ServiceVipEnabled: true,
Domain: "mesh",
Port: 5653,
CIDR: "240.0.0.0/4",
}
}
3 changes: 0 additions & 3 deletions pkg/config/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ var _ = Describe("Config loader", func() {
Expect(cfg.Diagnostics.DebugEndpoints).To(BeTrue())

Expect(cfg.DNSServer.Domain).To(Equal("test-domain"))
Expect(cfg.DNSServer.Port).To(Equal(uint32(15653)))
Expect(cfg.DNSServer.CIDR).To(Equal("127.1.0.0/16"))
Expect(cfg.DNSServer.ServiceVipEnabled).To(BeFalse())

Expand Down Expand Up @@ -411,7 +410,6 @@ multizone:
maxMsgSize: 2
dnsServer:
domain: test-domain
port: 15653
CIDR: 127.1.0.0/16
serviceVipEnabled: false
defaults:
Expand Down Expand Up @@ -568,7 +566,6 @@ experimental:
"KUMA_API_SERVER_CORS_ALLOWED_DOMAINS": "https://kuma,https://someapi",
"KUMA_GUI_SERVER_API_SERVER_URL": "http://localhost:1234",
"KUMA_DNS_SERVER_DOMAIN": "test-domain",
"KUMA_DNS_SERVER_PORT": "15653",
"KUMA_DNS_SERVER_CIDR": "127.1.0.0/16",
"KUMA_DNS_SERVER_SERVICE_VIP_ENABLED": "false",
"KUMA_MODE": "zone",
Expand Down
6 changes: 0 additions & 6 deletions pkg/core/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
runtime_reports "github.com/kumahq/kuma/pkg/core/runtime/reports"
secret_cipher "github.com/kumahq/kuma/pkg/core/secrets/cipher"
secret_manager "github.com/kumahq/kuma/pkg/core/secrets/manager"
"github.com/kumahq/kuma/pkg/dns/resolver"
"github.com/kumahq/kuma/pkg/dp-server/server"
"github.com/kumahq/kuma/pkg/envoy/admin"
"github.com/kumahq/kuma/pkg/envoy/admin/access"
Expand Down Expand Up @@ -83,7 +82,6 @@ func buildRuntime(appCtx context.Context, cfg kuma_cp.Config) (core_runtime.Runt
}))

initializeConfigManager(builder)
initializeDNSResolver(cfg, builder)

builder.WithResourceValidators(core_runtime.ResourceValidators{
Dataplane: dataplane.NewMembershipValidator(),
Expand Down Expand Up @@ -445,10 +443,6 @@ func initializeResourceManager(cfg kuma_cp.Config, builder *core_runtime.Builder
return nil
}

func initializeDNSResolver(cfg kuma_cp.Config, builder *core_runtime.Builder) {
builder.WithDNSResolver(resolver.NewDNSResolver(cfg.DNSServer.Domain))
}

func initializeConfigManager(builder *core_runtime.Builder) {
builder.WithConfigManager(config_manager.NewConfigManager(builder.ConfigStore()))
}
Expand Down
15 changes: 0 additions & 15 deletions pkg/core/runtime/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
core_store "github.com/kumahq/kuma/pkg/core/resources/store"
"github.com/kumahq/kuma/pkg/core/runtime/component"
"github.com/kumahq/kuma/pkg/core/secrets/store"
"github.com/kumahq/kuma/pkg/dns/resolver"
dp_server "github.com/kumahq/kuma/pkg/dp-server/server"
"github.com/kumahq/kuma/pkg/envoy/admin"
"github.com/kumahq/kuma/pkg/events"
Expand All @@ -40,7 +39,6 @@ type BuilderContext interface {
Config() kuma_cp.Config
DataSourceLoader() datasource.Loader
Extensions() context.Context
DNSResolver() resolver.DNSResolver
ConfigManager() config_manager.ConfigManager
LeaderInfo() component.LeaderInfo
Metrics() metrics.Metrics
Expand Down Expand Up @@ -69,7 +67,6 @@ type Builder struct {
cam core_ca.Managers
dsl datasource.Loader
ext context.Context
dns resolver.DNSResolver
configm config_manager.ConfigManager
leadInfo component.LeaderInfo
lif lookup.LookupIPFunc
Expand Down Expand Up @@ -162,11 +159,6 @@ func (b *Builder) WithExtension(key interface{}, value interface{}) *Builder {
return b
}

func (b *Builder) WithDNSResolver(dns resolver.DNSResolver) *Builder {
b.dns = dns
return b
}

func (b *Builder) WithConfigManager(configm config_manager.ConfigManager) *Builder {
b.configm = configm
return b
Expand Down Expand Up @@ -261,9 +253,6 @@ func (b *Builder) Build() (Runtime, error) {
if b.ext == nil {
return nil, errors.Errorf("Extensions have been misconfigured")
}
if b.dns == nil {
return nil, errors.Errorf("DNS has been misconfigured")
}
if b.leadInfo == nil {
return nil, errors.Errorf("LeaderInfo has not been configured")
}
Expand Down Expand Up @@ -314,7 +303,6 @@ func (b *Builder) Build() (Runtime, error) {
cam: b.cam,
dsl: b.dsl,
ext: b.ext,
dns: b.dns,
configm: b.configm,
leadInfo: b.leadInfo,
lif: b.lif,
Expand Down Expand Up @@ -366,9 +354,6 @@ func (b *Builder) DataSourceLoader() datasource.Loader {
func (b *Builder) Extensions() context.Context {
return b.ext
}
func (b *Builder) DNSResolver() resolver.DNSResolver {
return b.dns
}
func (b *Builder) ConfigManager() config_manager.ConfigManager {
return b.configm
}
Expand Down
12 changes: 12 additions & 0 deletions pkg/core/runtime/component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ func (f ComponentFunc) Start(stop <-chan struct{}) error {
return f(stop)
}

var _ Component = LeaderComponentFunc(nil)

type LeaderComponentFunc func(<-chan struct{}) error

func (f LeaderComponentFunc) NeedLeaderElection() bool {
return true
}

func (f LeaderComponentFunc) Start(stop <-chan struct{}) error {
return f(stop)
}

type Manager interface {

// Add registers a component, i.e. gRPC Server, HTTP server, reconciliation loop.
Expand Down
7 changes: 0 additions & 7 deletions pkg/core/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
core_store "github.com/kumahq/kuma/pkg/core/resources/store"
"github.com/kumahq/kuma/pkg/core/runtime/component"
"github.com/kumahq/kuma/pkg/core/secrets/store"
"github.com/kumahq/kuma/pkg/dns/resolver"
dp_server "github.com/kumahq/kuma/pkg/dp-server/server"
"github.com/kumahq/kuma/pkg/envoy/admin"
"github.com/kumahq/kuma/pkg/envoy/admin/access"
Expand Down Expand Up @@ -56,7 +55,6 @@ type RuntimeContext interface {
ConfigStore() core_store.ResourceStore
CaManagers() ca.Managers
Extensions() context.Context
DNSResolver() resolver.DNSResolver
ConfigManager() config_manager.ConfigManager
LeaderInfo() component.LeaderInfo
LookupIP() lookup.LookupIPFunc
Expand Down Expand Up @@ -140,7 +138,6 @@ type runtimeContext struct {
cam ca.Managers
dsl datasource.Loader
ext context.Context
dns resolver.DNSResolver
configm config_manager.ConfigManager
leadInfo component.LeaderInfo
lif lookup.LookupIPFunc
Expand Down Expand Up @@ -203,10 +200,6 @@ func (rc *runtimeContext) Extensions() context.Context {
return rc.ext
}

func (rc *runtimeContext) DNSResolver() resolver.DNSResolver {
return rc.dns
}

func (rc *runtimeContext) ConfigManager() config_manager.ConfigManager {
return rc.configm
}
Expand Down
32 changes: 0 additions & 32 deletions pkg/dns/components.go

This file was deleted.

26 changes: 0 additions & 26 deletions pkg/dns/name_modifier.go

This file was deleted.

56 changes: 0 additions & 56 deletions pkg/dns/name_modifier_test.go

This file was deleted.

Loading

0 comments on commit e047ece

Please sign in to comment.