From ce724309e7213256fd00f2405c0ed6cefbcdb299 Mon Sep 17 00:00:00 2001 From: Tanmay Satam Date: Mon, 2 Dec 2024 15:02:19 -0500 Subject: [PATCH 1/3] Add disable-infra annotation to hive clusterdeployments --- pkg/hive/install.go | 4 ++++ pkg/hive/resources.go | 5 +++++ test/e2e/hive.go | 8 +++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pkg/hive/install.go b/pkg/hive/install.go index a391bb1c6e6..498ed54a68a 100644 --- a/pkg/hive/install.go +++ b/pkg/hive/install.go @@ -214,6 +214,10 @@ func (c *clusterManager) clusterDeploymentForInstall(doc *api.OpenShiftClusterDo // TODO: remove until we use a version of hive at minimal install "hive.openshift.io/cli-domain-from-installer-image": "true", + + // https://github.com/openshift/hive/pull/2501 + // Disable hibernation controller + "hive.openshift.io/infra-disabled": "true", }, }, Spec: hivev1.ClusterDeploymentSpec{ diff --git a/pkg/hive/resources.go b/pkg/hive/resources.go index da871f64f0a..11ffba3a714 100644 --- a/pkg/hive/resources.go +++ b/pkg/hive/resources.go @@ -203,6 +203,11 @@ func adoptedClusterDeployment(namespace, clusterName, clusterID, infraID, resour "hive.openshift.io/cluster-platform": "azure", "hive.openshift.io/cluster-region": location, }, + Annotations: map[string]string{ + // https://github.com/openshift/hive/pull/2501 + // Disable hibernation controller + "hive.openshift.io/infra-disabled": "true", + }, }, Spec: hivev1.ClusterDeploymentSpec{ BaseDomain: "", diff --git a/test/e2e/hive.go b/test/e2e/hive.go index 1d4227b4108..8048bb7faf6 100644 --- a/test/e2e/hive.go +++ b/test/e2e/hive.go @@ -20,8 +20,9 @@ import ( ) var ( - clusterPlatformLabelKey string = "hive.openshift.io/cluster-platform" - clusterRegionLabelKey string = "hive.openshift.io/cluster-region" + clusterPlatformLabelKey string = "hive.openshift.io/cluster-platform" + clusterRegionLabelKey string = "hive.openshift.io/cluster-region" + infraDisabledAnnotationKey string = "hive.openshift.io/infra-disabled" controlPlaneAPIURLOverride = func(clusterDomain string, clusterLocation string) string { if !strings.ContainsRune(clusterDomain, '.') { @@ -52,13 +53,14 @@ var _ = Describe("Hive-managed ARO cluster", func() { }, cd) Expect(err).NotTo(HaveOccurred()) - By("verifying that the ClusterDeployment object has the expected name and labels") + By("verifying that the ClusterDeployment object has the expected name, labels, and annotations") Expect(cd.ObjectMeta).NotTo(BeNil()) Expect(cd.ObjectMeta.Name).To(Equal(hive.ClusterDeploymentName)) Expect(cd.ObjectMeta.Labels).Should(HaveKey(clusterPlatformLabelKey)) Expect(cd.ObjectMeta.Labels[clusterPlatformLabelKey]).To(Equal("azure")) Expect(cd.ObjectMeta.Labels).Should(HaveKey(clusterRegionLabelKey)) Expect(cd.ObjectMeta.Labels[clusterRegionLabelKey]).To(Equal(adminAPICluster.Location)) + Expect(cd.ObjectMeta.Annotations[infraDisabledAnnotationKey]).To(Equal("true")) By("verifying that the ClusterDeployment object spec correctly includes the ARO cluster's Azure region and RG name") Expect(cd.Spec).NotTo(BeNil()) From 86fc4cbd26f2829c569be42f3458400cfeeebde6 Mon Sep 17 00:00:00 2001 From: Tanmay Satam Date: Tue, 3 Dec 2024 14:08:43 -0500 Subject: [PATCH 2/3] Update pkg/hive/resources.go Co-authored-by: Caden Marchese <56140267+cadenmarchese@users.noreply.github.com> --- pkg/hive/resources.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/hive/resources.go b/pkg/hive/resources.go index 11ffba3a714..5d1d0679405 100644 --- a/pkg/hive/resources.go +++ b/pkg/hive/resources.go @@ -205,7 +205,7 @@ func adoptedClusterDeployment(namespace, clusterName, clusterID, infraID, resour }, Annotations: map[string]string{ // https://github.com/openshift/hive/pull/2501 - // Disable hibernation controller + // Disable hibernation controller as it is not used as part of ARO's Hive implementation "hive.openshift.io/infra-disabled": "true", }, }, From 9296285e5063e70a23cc25910b0275ac0c320225 Mon Sep 17 00:00:00 2001 From: Tanmay Satam Date: Wed, 4 Dec 2024 14:22:33 -0500 Subject: [PATCH 3/3] Extract Hive ClusterDeployment labels/annotation keys to const values --- pkg/hive/install.go | 8 ++++---- pkg/hive/resources.go | 11 +++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pkg/hive/install.go b/pkg/hive/install.go index 498ed54a68a..754847b0c0d 100644 --- a/pkg/hive/install.go +++ b/pkg/hive/install.go @@ -203,9 +203,9 @@ func (c *clusterManager) clusterDeploymentForInstall(doc *api.OpenShiftClusterDo Name: ClusterDeploymentName, Namespace: doc.OpenShiftCluster.Properties.HiveProfile.Namespace, Labels: map[string]string{ - "hive.openshift.io/cluster-platform": "azure", - "hive.openshift.io/cluster-region": doc.OpenShiftCluster.Location, - createdByHiveLabelKey: "true", + hiveClusterPlatformLabel: "azure", + hiveClusterRegionLabel: doc.OpenShiftCluster.Location, + createdByHiveLabelKey: "true", }, Annotations: map[string]string{ // https://github.com/openshift/hive/pull/2157 @@ -217,7 +217,7 @@ func (c *clusterManager) clusterDeploymentForInstall(doc *api.OpenShiftClusterDo // https://github.com/openshift/hive/pull/2501 // Disable hibernation controller - "hive.openshift.io/infra-disabled": "true", + hiveInfraDisabledAnnotation: "true", }, }, Spec: hivev1.ClusterDeploymentSpec{ diff --git a/pkg/hive/resources.go b/pkg/hive/resources.go index 5d1d0679405..71351b1bf1a 100644 --- a/pkg/hive/resources.go +++ b/pkg/hive/resources.go @@ -29,6 +29,9 @@ const ( clusterManifestsSecretName = "cluster-manifests-secret" boundServiceAccountSigningKeySecretName = "bound-service-account-signing-key" boundServiceAccountSigningKeySecretKey = "bound-service-account-signing-key.key" + hiveClusterPlatformLabel = "hive.openshift.io/cluster-platform" + hiveClusterRegionLabel = "hive.openshift.io/cluster-region" + hiveInfraDisabledAnnotation = "hive.openshift.io/infra-disabled" ) var ( @@ -200,13 +203,13 @@ func adoptedClusterDeployment(namespace, clusterName, clusterID, infraID, resour Name: ClusterDeploymentName, Namespace: namespace, Labels: map[string]string{ - "hive.openshift.io/cluster-platform": "azure", - "hive.openshift.io/cluster-region": location, + hiveClusterPlatformLabel: "azure", + hiveClusterRegionLabel: location, }, Annotations: map[string]string{ // https://github.com/openshift/hive/pull/2501 - // Disable hibernation controller as it is not used as part of ARO's Hive implementation - "hive.openshift.io/infra-disabled": "true", + // Disable hibernation controller as it is not used as part of ARO's Hive implementation + hiveInfraDisabledAnnotation: "true", }, }, Spec: hivev1.ClusterDeploymentSpec{