diff --git a/pkg/reconciler/common/ha.go b/pkg/reconciler/common/ha.go index 25382f4874..265c8dffc0 100644 --- a/pkg/reconciler/common/ha.go +++ b/pkg/reconciler/common/ha.go @@ -24,13 +24,6 @@ import ( v1alpha1 "knative.dev/operator/pkg/apis/operator/v1alpha1" ) -const ( - configMapName = "config-leader-election" - enabledComponentsKey = "enabledComponents" - servingComponentsValue = "controller,hpaautoscaler,certcontroller,istiocontroller,nscontroller" - eventingComponentsValue = "eventing-controller,sugar-controller,imc-controller,imc-dispatcher,mt-broker-controller" -) - func haSupport(obj v1alpha1.KComponent) sets.String { return sets.NewString( "controller", @@ -72,27 +65,6 @@ func HighAvailabilityTransform(obj v1alpha1.KComponent, log *zap.SugaredLogger) return nil } - // Transform the leader election config. - if u.GetKind() == "ConfigMap" && u.GetName() == "config-leader-election" { - data, ok, err := unstructured.NestedStringMap(u.UnstructuredContent(), "data") - if err != nil { - return nil - } - if !ok { - data = map[string]string{} - } - - if _, ok := obj.(*v1alpha1.KnativeServing); ok { - data[enabledComponentsKey] = servingComponentsValue - } - if _, ok := obj.(*v1alpha1.KnativeEventing); ok { - data[enabledComponentsKey] = eventingComponentsValue - } - if err := unstructured.SetNestedStringMap(u.Object, data, "data"); err != nil { - return err - } - } - replicas := int64(ha.Replicas) // Transform deployments that support HA. diff --git a/pkg/reconciler/common/ha_test.go b/pkg/reconciler/common/ha_test.go index 1e7c3d19e3..6f1d365905 100644 --- a/pkg/reconciler/common/ha_test.go +++ b/pkg/reconciler/common/ha_test.go @@ -21,7 +21,6 @@ import ( appsv1 "k8s.io/api/apps/v1" autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" - v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/client-go/kubernetes/scheme" @@ -38,17 +37,6 @@ func TestHighAvailabilityTransform(t *testing.T) { expected *unstructured.Unstructured err error }{{ - name: "No HA; ConfigMap", - config: nil, - in: makeUnstructuredConfigMap(t, nil), - expected: makeUnstructuredConfigMap(t, nil), - }, { - name: "HA; ConfigMap", - config: makeHa(2), - in: makeUnstructuredConfigMap(t, nil), - expected: makeUnstructuredConfigMap(t, map[string]string{ - enabledComponentsKey: servingComponentsValue}), - }, { name: "HA; controller", config: makeHa(2), in: makeUnstructuredDeployment(t, "controller"), @@ -125,22 +113,6 @@ func makeHa(replicas int32) *v1alpha1.HighAvailability { } } -func makeUnstructuredConfigMap(t *testing.T, data map[string]string) *unstructured.Unstructured { - cm := &v1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{ - Name: configMapName, - }, - } - cm.Data = data - result := &unstructured.Unstructured{} - err := scheme.Scheme.Convert(cm, result, nil) - if err != nil { - t.Fatalf("Could not create unstructured ConfigMap: %v, err: %v", cm, err) - } - - return result -} - func makeUnstructuredDeployment(t *testing.T, name string) *unstructured.Unstructured { return makeUnstructuredDeploymentReplicas(t, name, 1) }