@@ -29,6 +29,7 @@ import (
29
29
"k8s.io/apimachinery/pkg/util/intstr"
30
30
configv1alpha1 "k8s.io/component-base/config/v1alpha1"
31
31
"k8s.io/utils/pointer"
32
+ clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
32
33
33
34
operatorv1 "sigs.k8s.io/cluster-api-operator/api/v1alpha2"
34
35
)
@@ -40,6 +41,9 @@ func TestCustomizeDeployment(t *testing.T) {
40
41
ObjectMeta : metav1.ObjectMeta {
41
42
Name : "manager" ,
42
43
Namespace : metav1 .NamespaceSystem ,
44
+ Labels : map [string ]string {
45
+ clusterv1 .ProviderNameLabel : "infra-provider" ,
46
+ },
43
47
},
44
48
Spec : appsv1.DeploymentSpec {
45
49
Template : corev1.PodTemplateSpec {
@@ -83,6 +87,7 @@ func TestCustomizeDeployment(t *testing.T) {
83
87
inputDeploymentSpec * operatorv1.DeploymentSpec
84
88
inputManagerSpec * operatorv1.ManagerSpec
85
89
expectedDeploymentSpec func (* appsv1.DeploymentSpec ) (* appsv1.DeploymentSpec , bool )
90
+ noDeployementLabels bool
86
91
}{
87
92
{
88
93
name : "empty" ,
@@ -550,6 +555,16 @@ func TestCustomizeDeployment(t *testing.T) {
550
555
return expectedDS , reflect .DeepEqual (inputDS .Template .Spec .Containers [0 ], expectedDS .Template .Spec .Containers [0 ])
551
556
},
552
557
},
558
+ {
559
+ name : "no provider label on the deployment" ,
560
+ inputDeploymentSpec : & operatorv1.DeploymentSpec {
561
+ NodeSelector : map [string ]string {"a" : "b" },
562
+ },
563
+ expectedDeploymentSpec : func (inputDS * appsv1.DeploymentSpec ) (* appsv1.DeploymentSpec , bool ) {
564
+ return & managerDepl .Spec , true
565
+ },
566
+ noDeployementLabels : true ,
567
+ },
553
568
}
554
569
555
570
for _ , tc := range tests {
0 commit comments