From c72e1d5a184dcaa30eb6be1c740be93c1a915b51 Mon Sep 17 00:00:00 2001 From: annastopel Date: Tue, 28 May 2019 10:05:19 +0300 Subject: [PATCH] Set label operator.cdi.kubevirt.io to deployment spec of cdi-operator --- pkg/operator/resources/utils/common.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pkg/operator/resources/utils/common.go b/pkg/operator/resources/utils/common.go index 618c2e4d1..caeebd69d 100644 --- a/pkg/operator/resources/utils/common.go +++ b/pkg/operator/resources/utils/common.go @@ -144,16 +144,15 @@ func CreateRole(name string) *rbacv1.Role { //CreateOperatorDeploymentSpec creates deployment func CreateOperatorDeploymentSpec(name, namespace, matchKey, matchValue, serviceAccount string, numReplicas int32) *appsv1.DeploymentSpec { + matchMap := map[string]string{matchKey: matchValue} spec := &appsv1.DeploymentSpec{ Replicas: &numReplicas, Selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "name": "cdi-operator", - }, + MatchLabels: WithOperatorLabels(matchMap), }, Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"name": "cdi-operator"}, + Labels: WithOperatorLabels(matchMap), }, }, } @@ -167,16 +166,12 @@ func CreateOperatorDeploymentSpec(name, namespace, matchKey, matchValue, service //CreateOperatorDeployment creates deployment func CreateOperatorDeployment(name, namespace, matchKey, matchValue, serviceAccount string, numReplicas int32) *appsv1.Deployment { - //matchMap := map[string]string{matchKey: matchValue} deployment := &appsv1.Deployment{ TypeMeta: metav1.TypeMeta{ APIVersion: "apps/v1", Kind: "Deployment", }, ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "operator.cdi.kubevirt.io": "", - }, Name: name, Namespace: namespace, },