From 37dfabc72f203c882e91f4c9942c9c731f4a9162 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Boll Date: Wed, 8 Jan 2025 09:53:46 +0100 Subject: [PATCH 1/6] Refactor to use pipeline.yaml --- hypershiftoperator/Makefile | 13 ++++++------- hypershiftoperator/config.tmpl.mk | 14 -------------- hypershiftoperator/pipeline.yaml | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 21 deletions(-) delete mode 100644 hypershiftoperator/config.tmpl.mk create mode 100644 hypershiftoperator/pipeline.yaml diff --git a/hypershiftoperator/Makefile b/hypershiftoperator/Makefile index bb7a6e795..77e64e5a9 100644 --- a/hypershiftoperator/Makefile +++ b/hypershiftoperator/Makefile @@ -1,18 +1,17 @@ -SHELL := /bin/bash -DEPLOY_ENV ?= personal-dev -$(shell ../templatize.sh $(DEPLOY_ENV) config.tmpl.mk config.mk) -include config.mk +-include ../setup-env.mk +-include ../helm-cmd.mk +HELM_CMD ?= helm upgrade --install deploy: @AZURE_TENANT_ID=$(shell az account show --query tenantId --output tsv) && \ AZURE_SUBSCRIPTION_ID=$(shell az account show --query id --output tsv) && \ CSI_SECRET_STORE_CLIENT_ID=$(shell az aks show -n ${AKS_NAME} -g ${RESOURCEGROUP} --query 'addonProfiles.azureKeyvaultSecretsProvider.identity.clientId' -o tsv) && \ - helm upgrade --install hypershift deploy/helm \ + ${HELM_CMD} hypershift deploy/helm \ --create-namespace --namespace ${HYPERSHIFT_NAMESPACE} \ - --set image=${HO_IMAGE_BASE} \ + --set image=${ARO_HCP_SVC_ACR}.azurecr.io/acm-d/rhtap-hypershift-operator \ --set imageTag=${HO_IMAGE_TAG} \ --set registryOverrides="quay.io/openshift-release-dev/ocp-v4.0-art-dev=${ARO_HCP_OCP_ACR}.azurecr.io/openshift/release\,quay.io/openshift-release-dev/ocp-release=${ARO_HCP_OCP_ACR}.azurecr.io/openshift/release-images\,registry.redhat.io/redhat=${ARO_HCP_OCP_ACR}.azurecr.io/redhat" \ --set additionalArgs="${HO_ADDITIONAL_INSTALL_ARG}" \ --set azureKeyVaultClientId=$${CSI_SECRET_STORE_CLIENT_ID} -.PHONY: helm-chart deploy +.PHONY: deploy diff --git a/hypershiftoperator/config.tmpl.mk b/hypershiftoperator/config.tmpl.mk deleted file mode 100644 index 2acb6f905..000000000 --- a/hypershiftoperator/config.tmpl.mk +++ /dev/null @@ -1,14 +0,0 @@ -ARO_HCP_SVC_ACR ?= {{ .svcAcrName }} -ARO_HCP_OCP_ACR ?= {{ .ocpAcrName }} -HO_IMAGE_TAG ?= {{ .hypershiftOperator.imageTag }} -HO_IMAGE_BASE ?= ${ARO_HCP_SVC_ACR}.azurecr.io/acm-d/rhtap-hypershift-operator -HO_IMAGE ?= ${HO_IMAGE_BASE}:${HO_IMAGE_TAG} - -RESOURCEGROUP ?= {{ .mgmt.rg }} -REGIONAL_RESOURCEGROUP ?= {{ .regionRG }} -ZONE_NAME ?= {{ .regionalDNSSubdomain }}.{{ .baseDnsZoneName }} -AKS_NAME ?= {{ .aksName }} -HYPERSHIFT_NAMESPACE ?= {{ .hypershift.namespace}} - -HO_CHART_DIR ?= deploy/helm/charts/hypershift-operator -HO_ADDITIONAL_INSTALL_ARG ?= {{ .hypershift.additionalInstallArg }} diff --git a/hypershiftoperator/pipeline.yaml b/hypershiftoperator/pipeline.yaml new file mode 100644 index 000000000..c011246c8 --- /dev/null +++ b/hypershiftoperator/pipeline.yaml @@ -0,0 +1,30 @@ +$schema: "pipeline.schema.v1" +serviceGroup: Microsoft.Azure.ARO.HCP.RP.HypershiftOperator +rolloutName: RP HypershiftOperator Rollout +resourceGroups: +- name: {{ .mgmt.rg }} + subscription: {{ .svc.subscription }} + aksCluster: {{ .aksName }} + steps: + - name: deploy + action: Shell + command: make deploy + dryRun: + variables: + - name: DRY_RUN + value: "true" + variables: + - name: ARO_HCP_SVC_ACR + configRef: svcAcrName + - name: ARO_HCP_OCP_ACR + configRef: ocpAcrName + - name: HO_IMAGE_TAG + configRef: hypershiftOperator.imageTag + - name: RESOURCEGROUP + configRef: mgmt.rg + - name: AKS_NAME + configRef: aksName + - name: HYPERSHIFT_NAMESPACE + configRef: hypershift.namespace + - name: HO_ADDITIONAL_INSTALL_ARG + configRef: hypershift.additionalInstallArg From f14da629a2e9f90d38099f4e1f462ab54eebb5b7 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Boll Date: Wed, 8 Jan 2025 09:57:52 +0100 Subject: [PATCH 2/6] Add dry run and fix lint --- .github/workflows/services-pr-check.yml | 4 ++++ hypershiftoperator/pipeline.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/services-pr-check.yml b/.github/workflows/services-pr-check.yml index 3cfb02674..5beb4c289 100644 --- a/.github/workflows/services-pr-check.yml +++ b/.github/workflows/services-pr-check.yml @@ -91,3 +91,7 @@ - name: 'Dry Maestro Server' run: | make maestro.server.dry_run + + - name: 'Dry Maestro Server' + run: | + make hypershiftoperator.dry_run diff --git a/hypershiftoperator/pipeline.yaml b/hypershiftoperator/pipeline.yaml index c011246c8..96614d062 100644 --- a/hypershiftoperator/pipeline.yaml +++ b/hypershiftoperator/pipeline.yaml @@ -27,4 +27,4 @@ resourceGroups: - name: HYPERSHIFT_NAMESPACE configRef: hypershift.namespace - name: HO_ADDITIONAL_INSTALL_ARG - configRef: hypershift.additionalInstallArg + configRef: hypershift.additionalInstallArg From c5897414b03606f676f5c2282af67f0803a2003f Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Boll Date: Wed, 8 Jan 2025 10:04:47 +0100 Subject: [PATCH 3/6] remove create namespace --- hypershiftoperator/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypershiftoperator/Makefile b/hypershiftoperator/Makefile index 77e64e5a9..84c1a8f4f 100644 --- a/hypershiftoperator/Makefile +++ b/hypershiftoperator/Makefile @@ -7,7 +7,7 @@ deploy: AZURE_SUBSCRIPTION_ID=$(shell az account show --query id --output tsv) && \ CSI_SECRET_STORE_CLIENT_ID=$(shell az aks show -n ${AKS_NAME} -g ${RESOURCEGROUP} --query 'addonProfiles.azureKeyvaultSecretsProvider.identity.clientId' -o tsv) && \ ${HELM_CMD} hypershift deploy/helm \ - --create-namespace --namespace ${HYPERSHIFT_NAMESPACE} \ + --namespace ${HYPERSHIFT_NAMESPACE} \ --set image=${ARO_HCP_SVC_ACR}.azurecr.io/acm-d/rhtap-hypershift-operator \ --set imageTag=${HO_IMAGE_TAG} \ --set registryOverrides="quay.io/openshift-release-dev/ocp-v4.0-art-dev=${ARO_HCP_OCP_ACR}.azurecr.io/openshift/release\,quay.io/openshift-release-dev/ocp-release=${ARO_HCP_OCP_ACR}.azurecr.io/openshift/release-images\,registry.redhat.io/redhat=${ARO_HCP_OCP_ACR}.azurecr.io/redhat" \ From 14656ebc0297c6f077dde598da86d72bf78ded80 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Boll Date: Wed, 8 Jan 2025 10:37:30 +0100 Subject: [PATCH 4/6] Add deployment --- .github/workflows/services-cd.yml | 2 +- Makefile | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/services-cd.yml b/.github/workflows/services-cd.yml index f30b5f525..6be8192ae 100644 --- a/.github/workflows/services-cd.yml +++ b/.github/workflows/services-cd.yml @@ -159,4 +159,4 @@ - name: 'Deploy Hypershift Operator and External DNS Operator' run: | - make hypershiftoperator.deploy + make hypershiftoperator.deploy_pipeline diff --git a/Makefile b/Makefile index 69dc055f5..3a201465e 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,7 @@ infra.clean: # Services deployed on "svc" aks cluster services_svc = istio metrics maestro.registration # Services deployed on "mgmt" aks cluster(s) -services_mgmt = acm maestro.agent pko hypershiftoperator +services_mgmt = acm maestro.agent pko # List of all services services_all = $(join services_svc,services_mgmt) @@ -125,6 +125,7 @@ services_all = $(join services_svc,services_mgmt) # This sections is used to reference pipeline runs and should replace # the usage of `svc-deploh.sh` script in the future. services_svc_pipelines = backend frontend cluster-service maestro.server +services_mgmt_pipelines = hypershiftoperator %.deploy_pipeline: $(eval export dirname=$(subst .,/,$(basename $@))) ./templatize.sh $(DEPLOY_ENV) -p ./$(dirname)/pipeline.yaml -s deploy -P run -c public @@ -134,7 +135,7 @@ services_svc_pipelines = backend frontend cluster-service maestro.server ./templatize.sh $(DEPLOY_ENV) -p ./$(dirname)/pipeline.yaml -s deploy -P run -c public -d svc.deployall: $(addsuffix .deploy, $(services_svc)) $(addsuffix .deploy_pipeline, $(services_svc_pipelines)) -mgmt.deployall: $(addsuffix .deploy, $(services_mgmt)) +mgmt.deployall: $(addsuffix .deploy, $(services_mgmt)) $(addsuffix .deploy_pipeline, $(services_mgmt_pipelines)) deployall: svc.deployall mgmt.deployall listall: From 01981664792d6c507023b43beb109f2fc774983b Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Boll Date: Wed, 8 Jan 2025 10:44:54 +0100 Subject: [PATCH 5/6] Fix typos --- .github/workflows/services-pr-check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/services-pr-check.yml b/.github/workflows/services-pr-check.yml index 5beb4c289..9b6125e6f 100644 --- a/.github/workflows/services-pr-check.yml +++ b/.github/workflows/services-pr-check.yml @@ -88,10 +88,10 @@ run: | make frontend.dry_run - - name: 'Dry Maestro Server' + - name: 'Dry Run Maestro Server' run: | make maestro.server.dry_run - - name: 'Dry Maestro Server' + - name: 'Dry Run HypershiftOperator' run: | make hypershiftoperator.dry_run From c1b81b84f9d5d033193f51b542359acdb4fc73fe Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Boll Date: Wed, 8 Jan 2025 11:19:11 +0100 Subject: [PATCH 6/6] Add removed namespace creation --- hypershiftoperator/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hypershiftoperator/Makefile b/hypershiftoperator/Makefile index 84c1a8f4f..c9a1b915d 100644 --- a/hypershiftoperator/Makefile +++ b/hypershiftoperator/Makefile @@ -3,7 +3,8 @@ HELM_CMD ?= helm upgrade --install deploy: - @AZURE_TENANT_ID=$(shell az account show --query tenantId --output tsv) && \ + @kubectl create namespace ${HYPERSHIFT_NAMESPACE} --dry-run=client -o json | kubectl apply -f - && \ + AZURE_TENANT_ID=$(shell az account show --query tenantId --output tsv) && \ AZURE_SUBSCRIPTION_ID=$(shell az account show --query id --output tsv) && \ CSI_SECRET_STORE_CLIENT_ID=$(shell az aks show -n ${AKS_NAME} -g ${RESOURCEGROUP} --query 'addonProfiles.azureKeyvaultSecretsProvider.identity.clientId' -o tsv) && \ ${HELM_CMD} hypershift deploy/helm \