From 8d1d16c342cd88d3a35060b9165ca174210d8709 Mon Sep 17 00:00:00 2001 From: Peter Rifel Date: Sun, 5 Sep 2021 09:21:27 -0500 Subject: [PATCH] Clarify the deployment responsible for API DNS in error message --- pkg/validation/validate_cluster.go | 16 ++++++++++------ pkg/validation/validate_cluster_test.go | 10 ++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/pkg/validation/validate_cluster.go b/pkg/validation/validate_cluster.go index 8661f664f3..321dd33dc6 100644 --- a/pkg/validation/validate_cluster.go +++ b/pkg/validation/validate_cluster.go @@ -126,6 +126,10 @@ func (v *clusterValidatorImpl) Validate() (*ValidationCluster, error) { ctx := context.TODO() clusterName := v.cluster.Name + dnsProvider := kops.ExternalDNSProviderDNSController + if v.cluster.Spec.ExternalDNS != nil && v.cluster.Spec.ExternalDNS.Provider == kops.ExternalDNSProviderExternalDNS { + dnsProvider = kops.ExternalDNSProviderExternalDNS + } validation := &ValidationCluster{} @@ -137,12 +141,12 @@ func (v *clusterValidatorImpl) Validate() (*ValidationCluster, error) { } if hasPlaceHolderIPAddress != "" { - message := "Validation Failed\n\n" + - "The dns-controller Kubernetes deployment has not updated the Kubernetes cluster's API DNS entry to the correct IP address." + - " The API DNS IP address is the placeholder address that kops creates: " + hasPlaceHolderIPAddress + "." + - " Please wait about 5-10 minutes for a master to start, dns-controller to launch, and DNS to propagate." + - " The protokube container and dns-controller deployment logs may contain more diagnostic information." + - " Etcd and the API DNS entries must be updated for a kops Kubernetes cluster to start." + message := fmt.Sprintf("Validation Failed\n\n"+ + "The %[1]v Kubernetes deployment has not updated the Kubernetes cluster's API DNS entry to the correct IP address."+ + " The API DNS IP address is the placeholder address that kops creates: %[2]v."+ + " Please wait about 5-10 minutes for a master to start, %[1]v to launch, and DNS to propagate."+ + " The protokube container and %[1]v deployment logs may contain more diagnostic information."+ + " Etcd and the API DNS entries must be updated for a kops Kubernetes cluster to start.", dnsProvider, hasPlaceHolderIPAddress) validation.addError(&ValidationError{ Kind: "dns", Name: "apiserver", diff --git a/pkg/validation/validate_cluster_test.go b/pkg/validation/validate_cluster_test.go index 0c2dced7d9..31998501be 100644 --- a/pkg/validation/validate_cluster_test.go +++ b/pkg/validation/validate_cluster_test.go @@ -71,6 +71,11 @@ func (c *MockCloud) GetCloudGroups(cluster *kopsapi.Cluster, instancegroups []*k func testValidate(t *testing.T, groups map[string]*cloudinstances.CloudInstanceGroup, objects []runtime.Object) (*ValidationCluster, error) { cluster := &kopsapi.Cluster{ ObjectMeta: metav1.ObjectMeta{Name: "testcluster.k8s.local"}, + Spec: kopsapi.ClusterSpec{ + ExternalDNS: &kopsapi.ExternalDNSConfig{ + Provider: kopsapi.ExternalDNSProviderDNSController, + }, + }, } if len(groups) == 0 { @@ -131,6 +136,11 @@ func testValidate(t *testing.T, groups map[string]*cloudinstances.CloudInstanceG func Test_ValidateCloudGroupMissing(t *testing.T) { cluster := &kopsapi.Cluster{ ObjectMeta: metav1.ObjectMeta{Name: "testcluster.k8s.local"}, + Spec: kopsapi.ClusterSpec{ + ExternalDNS: &kopsapi.ExternalDNSConfig{ + Provider: kopsapi.ExternalDNSProviderDNSController, + }, + }, } instanceGroups := []kopsapi.InstanceGroup{