From 3387510417d8507f3cdc2af84b7148488b5b1077 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Tue, 14 Aug 2018 19:42:07 -0400 Subject: [PATCH] Validate that require-kubeconfig is not passed after 1.10 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 #5459 --- pkg/apis/kops/validation/legacy.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkg/apis/kops/validation/legacy.go b/pkg/apis/kops/validation/legacy.go index 840afe839e98f..33842d097f097 100644 --- a/pkg/apis/kops/validation/legacy.go +++ b/pkg/apis/kops/validation/legacy.go @@ -470,6 +470,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") @@ -499,6 +509,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") }