Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e6350c7

Browse files
committedJan 29, 2018
Incorrect node settings in some cases
1 parent 8f83e8c commit e6350c7

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed
 

‎pkg/cmd/server/api/validation/node.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ func ValidateNodeConfig(config *api.NodeConfig, fldPath *field.Path) ValidationR
2424
func ValidateInClusterNodeConfig(config *api.NodeConfig, fldPath *field.Path) ValidationResults {
2525
validationResults := ValidationResults{}
2626

27-
if len(config.NodeName) == 0 {
27+
hasBootstrapConfig := len(config.KubeletArguments["bootstrap-kubeconfig"]) > 0
28+
if len(config.NodeName) == 0 && !hasBootstrapConfig {
2829
validationResults.AddErrors(field.Required(fldPath.Child("nodeName"), ""))
2930
}
3031
if len(config.NodeIP) > 0 {
@@ -42,7 +43,9 @@ func ValidateInClusterNodeConfig(config *api.NodeConfig, fldPath *field.Path) Va
4243
validationResults.AddErrors(ValidateHostPort(config.DNSBindAddress, fldPath.Child("dnsBindAddress"))...)
4344
}
4445
if len(config.DNSIP) > 0 {
45-
validationResults.AddErrors(ValidateSpecifiedIP(config.DNSIP, fldPath.Child("dnsIP"))...)
46+
if !hasBootstrapConfig || config.DNSIP != "0.0.0.0" {
47+
validationResults.AddErrors(ValidateSpecifiedIP(config.DNSIP, fldPath.Child("dnsIP"))...)
48+
}
4649
}
4750
for i, nameserver := range config.DNSNameservers {
4851
validationResults.AddErrors(ValidateSpecifiedIPPort(nameserver, fldPath.Child("dnsNameservers").Index(i))...)

‎pkg/cmd/server/kubernetes/node/options/options.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ func ComputeKubeletFlagsAsMap(startingArgs map[string][]string, options configap
117117
}
118118

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.