@@ -1183,7 +1183,7 @@ var _ = ginkgo.Describe("ClusterManager Default Mode", ginkgo.Ordered, func() {
11831183
11841184 ginkgo .It ("should have labels on resources created by clustermanager" , func () {
11851185
1186- labels := map [string ]string {"app" : "clustermanager" , " createdByClusterManager" : "hub" , "test-label" : "test-value" , "test-label2" : "test-value2" }
1186+ labels := map [string ]string {"createdByClusterManager" : "hub" , "test-label" : "test-value" , "test-label2" : "test-value2" }
11871187 gomega .Eventually (func () error {
11881188 clusterManager , err := operatorClient .OperatorV1 ().ClusterManagers ().Get (context .Background (), clusterManagerName , metav1.GetOptions {})
11891189 if err != nil {
@@ -1202,9 +1202,8 @@ var _ = ginkgo.Describe("ClusterManager Default Mode", ginkgo.Ordered, func() {
12021202 if err != nil {
12031203 return err
12041204 }
1205- if ! helpers .MapCompare (registrationDeployment .GetLabels (), labels ) {
1206- return fmt .Errorf ("expected registration-controller labels to be %v, but got %v" , labels , registrationDeployment .GetLabels ())
1207- }
1205+ registrationLabels := registrationDeployment .GetLabels ()
1206+ util .MapConsists (registrationLabels , labels )
12081207 return nil
12091208 }, eventuallyTimeout , eventuallyInterval ).Should (gomega .BeNil ())
12101209
@@ -1226,57 +1225,48 @@ var _ = ginkgo.Describe("ClusterManager Default Mode", ginkgo.Ordered, func() {
12261225 if err != nil {
12271226 return err
12281227 }
1229- if ! helpers .MapCompare (registrationDeployment .GetLabels (), labels ) {
1230- return fmt .Errorf ("expected registration-webhook labels to be %v, but got %v" , labels , registrationDeployment .GetLabels ())
1231- }
1228+ util .MapConsists (registrationDeployment .GetLabels (), labels )
12321229 return nil
12331230 }, eventuallyTimeout , eventuallyInterval ).Should (gomega .BeNil ())
12341231
12351232 // Compare labels on work-webhook
12361233 gomega .Eventually (func () error {
1237- registrationDeployment , err := kubeClient .AppsV1 ().Deployments (hubNamespace ).Get (context .Background (), hubWorkWebhookDeployment , metav1.GetOptions {})
1234+ k8sHubWorkWebhookDeployment , err := kubeClient .AppsV1 ().Deployments (hubNamespace ).Get (context .Background (), hubWorkWebhookDeployment , metav1.GetOptions {})
12381235 if err != nil {
12391236 return err
12401237 }
1241- if ! helpers .MapCompare (registrationDeployment .GetLabels (), labels ) {
1242- return fmt .Errorf ("expected work-webhook labels to be %v, but got %v" , labels , registrationDeployment .GetLabels ())
1243- }
1238+ util .MapConsists (k8sHubWorkWebhookDeployment .GetLabels (), labels )
12441239 return nil
12451240 }, eventuallyTimeout , eventuallyInterval ).Should (gomega .BeNil ())
12461241
12471242 // Compare labels on placement-controller
12481243 gomega .Eventually (func () error {
1249- registrationDeployment , err := kubeClient .AppsV1 ().Deployments (hubNamespace ).Get (context .Background (), hubPlacementDeployment , metav1.GetOptions {})
1244+ k8sHubPlacementDeployment , err := kubeClient .AppsV1 ().Deployments (hubNamespace ).Get (context .Background (), hubPlacementDeployment , metav1.GetOptions {})
12501245 if err != nil {
12511246 return err
12521247 }
1253- if ! helpers .MapCompare (registrationDeployment .GetLabels (), labels ) {
1254- return fmt .Errorf ("expected placement-controller labels to be %v, but got %v" , labels , registrationDeployment .GetLabels ())
1255- }
1248+ util .MapConsists (k8sHubPlacementDeployment .GetLabels (), labels )
12561249 return nil
12571250 }, eventuallyTimeout , eventuallyInterval ).Should (gomega .BeNil ())
12581251
12591252 // Compare labels on addon-manager-controller
12601253 gomega .Eventually (func () error {
1261- registrationDeployment , err := kubeClient .AppsV1 ().Deployments (hubNamespace ).Get (context .Background (), hubAddOnManagerDeployment , metav1.GetOptions {})
1254+ k8sHubAddOnManagerDeployment , err := kubeClient .AppsV1 ().Deployments (hubNamespace ).Get (context .Background (), hubAddOnManagerDeployment , metav1.GetOptions {})
12621255 if err != nil {
12631256 return err
12641257 }
1265- if ! helpers .MapCompare (registrationDeployment .GetLabels (), labels ) {
1266- return fmt .Errorf ("expected labels addon-manager-controller to be %v, but got %v" , labels , registrationDeployment .GetLabels ())
1267- }
1258+ util .MapConsists (k8sHubAddOnManagerDeployment .GetLabels (), labels )
12681259 return nil
12691260 }, eventuallyTimeout , eventuallyInterval ).Should (gomega .BeNil ())
12701261
12711262 // Compare labels on work-controller
12721263 gomega .Eventually (func () error {
1273- registrationDeployment , err := kubeClient .AppsV1 ().Deployments (hubNamespace ).Get (context .Background (), hubWorkControllerDeployment , metav1.GetOptions {})
1264+ k8sHubWorkControllerDeployment , err := kubeClient .AppsV1 ().Deployments (hubNamespace ).
1265+ Get (context .Background (), hubWorkControllerDeployment , metav1.GetOptions {})
12741266 if err != nil {
12751267 return err
12761268 }
1277- if ! helpers .MapCompare (registrationDeployment .GetLabels (), labels ) {
1278- return fmt .Errorf ("expected work-controller labels to be %v, but got %v" , labels , registrationDeployment .GetLabels ())
1279- }
1269+ util .MapConsists (k8sHubWorkControllerDeployment .GetLabels (), labels )
12801270 return nil
12811271 }, eventuallyTimeout , eventuallyInterval ).Should (gomega .BeNil ())
12821272 })
0 commit comments