Skip to content

Commit

Permalink
Validate that require-kubeconfig is not passed after 1.10
Browse files Browse the repository at this point in the history
This should alert users that are manually specifying old flags - I
suspect that a few of the upgrade failures are due to users that are
running with clusters captured from `kops get cluster --full`, and
this will detect that.

Issue #5549
  • Loading branch information
justinsb committed Aug 14, 2018
1 parent c646aad commit 7af88e3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/apis/kops/validation/legacy.go
Expand Up @@ -472,6 +472,16 @@ func ValidateCluster(c *kops.Cluster, strict bool) *field.Error {
}
}

if kubernetesRelease.GTE(semver.MustParse("1.10.0")) {
// Flag removed in 1.10
if c.Spec.Kubelet.RequireKubeconfig != nil {
return field.Invalid(
kubeletPath.Child("requireKubeconfig"),
*c.Spec.Kubelet.RequireKubeconfig,
"require-kubeconfig flag was removed in 1.10. (Please be sure you are not using a cluster config from `kops get cluster --full`)")
}
}

if c.Spec.Kubelet.BootstrapKubeconfig != "" {
if c.Spec.KubeAPIServer == nil {
return field.Required(fieldSpec.Child("KubeAPIServer"), "bootstrap token require the NodeRestriction admissions controller")
Expand Down Expand Up @@ -501,6 +511,16 @@ func ValidateCluster(c *kops.Cluster, strict bool) *field.Error {
}
}

if kubernetesRelease.GTE(semver.MustParse("1.10.0")) {
// Flag removed in 1.10
if c.Spec.MasterKubelet.RequireKubeconfig != nil {
return field.Invalid(
masterKubeletPath.Child("requireKubeconfig"),
*c.Spec.MasterKubelet.RequireKubeconfig,
"require-kubeconfig flag was removed in 1.10. (Please be sure you are not using a cluster config from `kops get cluster --full`)")
}
}

if c.Spec.MasterKubelet.APIServers != "" && !isValidAPIServersURL(c.Spec.MasterKubelet.APIServers) {
return field.Invalid(masterKubeletPath.Child("APIServers"), c.Spec.MasterKubelet.APIServers, "Not a valid APIServer URL")
}
Expand Down

0 comments on commit 7af88e3

Please sign in to comment.