From c2434a2e08197daae502ee39b3893dee8cab7d87 Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Tue, 10 Nov 2020 23:36:46 -0800 Subject: [PATCH] Remove components from cluster validation --- pkg/validation/validate_cluster.go | 25 ------------- pkg/validation/validate_cluster_test.go | 50 ------------------------- 2 files changed, 75 deletions(-) diff --git a/pkg/validation/validate_cluster.go b/pkg/validation/validate_cluster.go index 9ceccbbcaf..ed8c0c550a 100644 --- a/pkg/validation/validate_cluster.go +++ b/pkg/validation/validate_cluster.go @@ -170,10 +170,6 @@ func (v *clusterValidatorImpl) Validate() (*ValidationCluster, error) { } readyNodes := validation.validateNodes(cloudGroups, v.instanceGroups) - if err := validation.collectComponentFailures(ctx, v.k8sClient); err != nil { - return nil, fmt.Errorf("cannot get component status for %q: %v", clusterName, err) - } - if err := validation.collectPodFailures(ctx, v.k8sClient, readyNodes, v.instanceGroups); err != nil { return nil, fmt.Errorf("cannot get pod health for %q: %v", clusterName, err) } @@ -181,27 +177,6 @@ func (v *clusterValidatorImpl) Validate() (*ValidationCluster, error) { return validation, nil } -func (v *ValidationCluster) collectComponentFailures(ctx context.Context, client kubernetes.Interface) error { - componentList, err := client.CoreV1().ComponentStatuses().List(ctx, metav1.ListOptions{}) - if err != nil { - return fmt.Errorf("error listing ComponentStatuses: %v", err) - } - - // TODO: Add logic to figure out the InstanceGroup given a component - for _, component := range componentList.Items { - for _, condition := range component.Conditions { - if condition.Status != v1.ConditionTrue { - v.addError(&ValidationError{ - Kind: "ComponentStatus", - Name: component.Name, - Message: fmt.Sprintf("component %q is unhealthy", component.Name), - }) - } - } - } - return nil -} - var masterStaticPods = []string{ "kube-apiserver", "kube-controller-manager", diff --git a/pkg/validation/validate_cluster_test.go b/pkg/validation/validate_cluster_test.go index 6b64a1b5d6..0c0351d1d2 100644 --- a/pkg/validation/validate_cluster_test.go +++ b/pkg/validation/validate_cluster_test.go @@ -556,56 +556,6 @@ func Test_ValidateMasterStaticPods(t *testing.T) { } } -func Test_ValidateNoComponentFailures(t *testing.T) { - v, err := testValidate(t, nil, []runtime.Object{ - &v1.ComponentStatus{ - ObjectMeta: metav1.ObjectMeta{ - Name: "testcomponent", - }, - Conditions: []v1.ComponentCondition{ - { - Status: v1.ConditionTrue, - }, - }, - }, - }) - - require.NoError(t, err) - assert.Empty(t, v.Failures) -} - -func Test_ValidateComponentFailure(t *testing.T) { - for _, status := range []v1.ConditionStatus{ - v1.ConditionFalse, - v1.ConditionUnknown, - } { - t.Run(string(status), func(t *testing.T) { - v, err := testValidate(t, nil, []runtime.Object{ - &v1.ComponentStatus{ - ObjectMeta: metav1.ObjectMeta{ - Name: "testcomponent", - }, - Conditions: []v1.ComponentCondition{ - { - Status: status, - }, - }, - }, - }) - - require.NoError(t, err) - if !assert.Len(t, v.Failures, 1) || - !assert.Equal(t, &ValidationError{ - Kind: "ComponentStatus", - Name: "testcomponent", - Message: "component \"testcomponent\" is unhealthy", - }, v.Failures[0]) { - printDebug(t, v) - } - }) - } -} - func Test_ValidateNoPodFailures(t *testing.T) { testpods := []map[string]string{}