Skip to content

Commit

Permalink
Merge pull request #12277 from rifelpet/dns-error
Browse files Browse the repository at this point in the history
Clarify the deployment responsible for API DNS in error message
  • Loading branch information
k8s-ci-robot committed Oct 29, 2021
2 parents 985c602 + 8d1d16c commit 2c3e794
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/validation/validate_cluster.go
Expand Up @@ -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{}

Expand All @@ -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",
Expand Down
10 changes: 10 additions & 0 deletions pkg/validation/validate_cluster_test.go
Expand Up @@ -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 {
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 2c3e794

Please sign in to comment.