-
Notifications
You must be signed in to change notification settings - Fork 39k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow kube-dns to load its configuration from a config map
- Adds command line flags --config-map, --config-map-ns. - Fixes 36194 (#36194) - Update kube-dns yamls - Update bazel (hack/update-bazel.sh) - Update known command line flags - Temporarily reference new kube-dns image (this will be fixed with a separate commit when the DNS image is created)
- Loading branch information
Showing
23 changed files
with
1,205 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
licenses(["notice"]) | ||
|
||
load( | ||
"@io_bazel_rules_go//go:def.bzl", | ||
"go_binary", | ||
"go_library", | ||
"go_test", | ||
"cgo_library", | ||
) | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = [ | ||
"config.go", | ||
"mocksync.go", | ||
"nopsync.go", | ||
"sync.go", | ||
], | ||
tags = ["automanaged"], | ||
deps = [ | ||
"//pkg/api:go_default_library", | ||
"//pkg/api/unversioned:go_default_library", | ||
"//pkg/client/cache:go_default_library", | ||
"//pkg/client/clientset_generated/internalclientset:go_default_library", | ||
"//pkg/dns/federation:go_default_library", | ||
"//pkg/fields:go_default_library", | ||
"//pkg/runtime:go_default_library", | ||
"//pkg/watch:go_default_library", | ||
"//vendor:github.com/golang/glog", | ||
"//vendor:k8s.io/client-go/pkg/util/wait", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "go_default_test", | ||
srcs = ["config_test.go"], | ||
library = "go_default_library", | ||
tags = ["automanaged"], | ||
deps = ["//vendor:github.com/stretchr/testify/assert"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
Copyright 2016 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package config | ||
|
||
import ( | ||
types "k8s.io/kubernetes/pkg/api/unversioned" | ||
fed "k8s.io/kubernetes/pkg/dns/federation" | ||
) | ||
|
||
// Config populated either from the configuration source (command | ||
// line flags or via the config map mechanism). | ||
type Config struct { | ||
// The inclusion of TypeMeta is to ensure future compatibility if the | ||
// Config object was populated directly via a Kubernetes API mechanism. | ||
// | ||
// For example, instead of the custom implementation here, the | ||
// configuration could be obtained from an API that unifies | ||
// command-line flags, config-map, etc mechanisms. | ||
types.TypeMeta | ||
|
||
// Map of federation names that the cluster in which this kube-dns | ||
// is running belongs to, to the corresponding domain names. | ||
Federations map[string]string `json:"federations"` | ||
} | ||
|
||
func NewDefaultConfig() *Config { | ||
return &Config{ | ||
Federations: make(map[string]string), | ||
} | ||
} | ||
|
||
// IsValid returns whether or not the configuration is valid. | ||
func (config *Config) Validate() error { | ||
if err := config.validateFederations(); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (config *Config) validateFederations() error { | ||
for name, domain := range config.Federations { | ||
if err := fed.ValidateName(name); err != nil { | ||
return err | ||
} | ||
if err := fed.ValidateDomain(domain); err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
} |
Oops, something went wrong.