Skip to content

Commit

Permalink
Incorrect node settings in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton committed Jan 29, 2018
1 parent 8f83e8c commit e6350c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions pkg/cmd/server/api/validation/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ func ValidateNodeConfig(config *api.NodeConfig, fldPath *field.Path) ValidationR
func ValidateInClusterNodeConfig(config *api.NodeConfig, fldPath *field.Path) ValidationResults {
validationResults := ValidationResults{}

if len(config.NodeName) == 0 {
hasBootstrapConfig := len(config.KubeletArguments["bootstrap-kubeconfig"]) > 0
if len(config.NodeName) == 0 && !hasBootstrapConfig {
validationResults.AddErrors(field.Required(fldPath.Child("nodeName"), ""))
}
if len(config.NodeIP) > 0 {
Expand All @@ -42,7 +43,9 @@ func ValidateInClusterNodeConfig(config *api.NodeConfig, fldPath *field.Path) Va
validationResults.AddErrors(ValidateHostPort(config.DNSBindAddress, fldPath.Child("dnsBindAddress"))...)
}
if len(config.DNSIP) > 0 {
validationResults.AddErrors(ValidateSpecifiedIP(config.DNSIP, fldPath.Child("dnsIP"))...)
if !hasBootstrapConfig || config.DNSIP != "0.0.0.0" {
validationResults.AddErrors(ValidateSpecifiedIP(config.DNSIP, fldPath.Child("dnsIP"))...)
}
}
for i, nameserver := range config.DNSNameservers {
validationResults.AddErrors(ValidateSpecifiedIPPort(nameserver, fldPath.Child("dnsNameservers").Index(i))...)
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/server/kubernetes/node/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ func ComputeKubeletFlagsAsMap(startingArgs map[string][]string, options configap
}

// we sometimes have different clusterdns options. I really don't understand why
externalKubeClient, _, err := configapi.GetExternalKubeClient(options.MasterKubeConfig, options.MasterClientConnectionOverrides)
if err != nil {
return nil, err
if len(args["cluster-dns"]) == 0 || args["cluster-dns"][0] == "0.0.0.0" {
if externalKubeClient, _, err := configapi.GetExternalKubeClient(options.MasterKubeConfig, options.MasterClientConnectionOverrides); err == nil {
args["cluster-dns"] = getClusterDNS(externalKubeClient, args["cluster-dns"])
}
}
args["cluster-dns"] = getClusterDNS(externalKubeClient, args["cluster-dns"])

// there is a special case. If you set `--cgroups-per-qos=false` and `--enforce-node-allocatable` is
// an empty string, `--enforce-node-allocatable=""` needs to be explicitly set
Expand Down

0 comments on commit e6350c7

Please sign in to comment.