From f1abcfcca04f857387788284a0400b716416e170 Mon Sep 17 00:00:00 2001 From: Oren Cohen Date: Wed, 15 Mar 2023 10:46:41 +0200 Subject: [PATCH] OPNET-261: Integrate the ART build of nmstate-console-plugin image in the CSV kubernetes-nmstate-operator should deploy the D/S version of the console plugin image, and ART pipeline will replace the upstream image of quay.io/nmstate/nmstate-console-plugin:release-1.0.0 with its downstream counterpart Signed-off-by: Oren Cohen (cherry picked from commit 4466b2488fdf91f7b2e6cab3e494f683d57919f0) Signed-off-by: Douglas Schilling Landgraf (cherry picked from commit 4be75206bcb4fe7c883f6d254bd9fa205b1d153c) Signed-off-by: Mat Kowalski --- Makefile | 7 ++++++- deploy/operator/operator.yaml | 2 ++ hack/ocp-build-and-deploy-bundle.sh | 2 ++ hack/ocp-bundle-common.sh | 4 ++++ hack/ocp-update-bundle-manifests.sh | 5 +++++ hack/render-manifests.go | 3 +++ manifests/stable/manifests/image-references | 4 ++++ .../kubernetes-nmstate-operator.clusterserviceversion.yaml | 2 ++ 8 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c95144240..ce91028da 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,11 @@ OPERATOR_IMAGE_TAG ?= latest OPERATOR_IMAGE_FULL_NAME ?= $(IMAGE_REPO)/$(OPERATOR_IMAGE_NAME):$(OPERATOR_IMAGE_TAG) OPERATOR_IMAGE ?= $(IMAGE_REGISTRY)/$(OPERATOR_IMAGE_FULL_NAME) +PLUGIN_IMAGE_NAME ?= nmstate-console-plugin +PLUGIN_IMAGE_TAG ?= latest +PLUGIN_IMAGE_FULL_NAME ?= $(IMAGE_REPO)/$(PLUGIN_IMAGE_NAME):$(PLUGIN_IMAGE_TAG) +PLUGIN_IMAGE ?= $(IMAGE_REGISTRY)/$(PLUGIN_IMAGE_FULL_NAME) + export HANDLER_NAMESPACE ?= nmstate export OPERATOR_NAMESPACE ?= $(HANDLER_NAMESPACE) HANDLER_PULL_POLICY ?= Always @@ -155,7 +160,7 @@ check-ocp-bundle: ocp-update-bundle-manifests generate: gen-k8s gen-crds gen-rbac manifests: - GOFLAGS=-mod=mod go run hack/render-manifests.go -handler-prefix=$(HANDLER_PREFIX) -handler-namespace=$(HANDLER_NAMESPACE) -operator-namespace=$(OPERATOR_NAMESPACE) -handler-image=$(HANDLER_IMAGE) -operator-image=$(OPERATOR_IMAGE) -handler-pull-policy=$(HANDLER_PULL_POLICY) -operator-pull-policy=$(OPERATOR_PULL_POLICY) -input-dir=deploy/ -output-dir=$(MANIFESTS_DIR) + GOFLAGS=-mod=mod go run hack/render-manifests.go -handler-prefix=$(HANDLER_PREFIX) -handler-namespace=$(HANDLER_NAMESPACE) -operator-namespace=$(OPERATOR_NAMESPACE) -handler-image=$(HANDLER_IMAGE) -operator-image=$(OPERATOR_IMAGE) -handler-pull-policy=$(HANDLER_PULL_POLICY) -operator-pull-policy=$(OPERATOR_PULL_POLICY) -plugin-image=$(PLUGIN_IMAGE) -input-dir=deploy/ -output-dir=$(MANIFESTS_DIR) handler: SKIP_PUSH=true handler: push-handler diff --git a/deploy/operator/operator.yaml b/deploy/operator/operator.yaml index fe06a193b..769743ed1 100644 --- a/deploy/operator/operator.yaml +++ b/deploy/operator/operator.yaml @@ -74,6 +74,8 @@ spec: value: "" - name: HANDLER_IMAGE value: {{ .HandlerImage }} + - name: PLUGIN_IMAGE + value: {{ .PluginImage }} - name: HANDLER_IMAGE_PULL_POLICY value: {{ .HandlerPullPolicy }} - name: HANDLER_NAMESPACE diff --git a/hack/ocp-build-and-deploy-bundle.sh b/hack/ocp-build-and-deploy-bundle.sh index a7956de17..54ce92603 100755 --- a/hack/ocp-build-and-deploy-bundle.sh +++ b/hack/ocp-build-and-deploy-bundle.sh @@ -10,6 +10,8 @@ # - HANDLER_IMAGE_TAG (defaults to ${CHANNEL}) # - OPERATOR_IMAGE_NAME (defaults to origin-kubernetes-nmstate-operator) # - OPERATOR_IMAGE_TAG (defaults to ${CHANNEL}) +# - PLUGIN_IMAGE_NAME (defaults to origin-nmstate-console-plugin) +# - PLUGIN_IMAGE_TAG (defaults to ${CHANNEL}) # - CHANNEL (defaults to the latest 4.x version in manifests/) # - VERSION (defaults to ${CHANNEL}.0) # - BUNDLE_VERSION (defaults to ${VERSION}) diff --git a/hack/ocp-bundle-common.sh b/hack/ocp-bundle-common.sh index 57489164c..0ed291361 100755 --- a/hack/ocp-bundle-common.sh +++ b/hack/ocp-bundle-common.sh @@ -45,6 +45,10 @@ export OPERATOR_IMAGE_NAME="${OPERATOR_IMAGE_NAME:-origin-kubernetes-nmstate-ope export OPERATOR_IMAGE_TAG="${OPERATOR_IMAGE_TAG:-${VERSION_MAJOR_MINOR}}" # TODO(chocobomb) Do we tag as "stable" or still "4.x" ? export OPERATOR_NAMESPACE="${NAMESPACE}" +export PLUGIN_IMAGE_NAME="${PLUGIN_IMAGE_NAME:-origin-nmstate-console-plugin}" +export PLUGIN_IMAGE_TAG="${PLUGIN_IMAGE_TAG:-${VERSION_MAJOR_MINOR}}" # TODO(chocobomb) Do we tag as "stable" or still "4.x" ? +export PLUGIN_NAMESPACE="${NAMESPACE}" + export BUNDLE_VERSION="${BUNDLE_VERSION:-${VERSION_MAJOR_MINOR}}" # TODO(chocobomb) X.Y or X.Y.Z here? Is this variable even used? export BUNDLE_IMG="${BUNDLE_IMG:-${IMAGE_REGISTRY}/${IMAGE_REPO}/kubernetes-nmstate-operator-bundle:${BUNDLE_VERSION}}" # TODO(chocobomb) Is this variable even used? diff --git a/hack/ocp-update-bundle-manifests.sh b/hack/ocp-update-bundle-manifests.sh index 15092de8e..21c88b118 100755 --- a/hack/ocp-update-bundle-manifests.sh +++ b/hack/ocp-update-bundle-manifests.sh @@ -14,6 +14,7 @@ rm -rf ${BUNDLE_DIR}/manifests ${BUNDLE_DIR}/metadata IMAGE_REPO=${IMAGE_REPO} \ HANDLER_IMAGE_NAME=${HANDLER_IMAGE_NAME} HANDLER_IMAGE_TAG=${HANDLER_IMAGE_TAG} HANDLER_NAMESPACE=${HANDLER_NAMESPACE} \ OPERATOR_IMAGE_NAME=${OPERATOR_IMAGE_NAME} OPERATOR_IMAGE_TAG=${OPERATOR_IMAGE_TAG} OPERATOR_NAMESPACE=${OPERATOR_NAMESPACE} \ +PLUGIN_IMAGE_NAME=${PLUGIN_IMAGE_NAME} PLUGIN_IMAGE_TAG=${PLUGIN_IMAGE_TAG} PLUGIN_NAMESPACE=${PLUGIN_NAMESPACE} \ VERSION=${VERSION} CHANNELS=${CHANNEL},alpha DEFAULT_CHANNEL=${CHANNEL} \ BUNDLE_DIR=${BUNDLE_DIR} MANIFEST_BASES_DIR=${MANIFEST_BASES_DIR} make bundle @@ -43,6 +44,10 @@ spec: from: kind: DockerImage name: quay.io/openshift/origin-kubernetes-nmstate-handler:${VERSION_MAJOR_MINOR} + - name: nmstate-console-plugin-rhel8 + from: + kind: DockerImage + name: quay.io/openshift/origin-nmstate-console-plugin:${VERSION_MAJOR_MINOR} EOF # undo changes on "root" bundle.Dockerfile (gets updated by `make bundle`) diff --git a/hack/render-manifests.go b/hack/render-manifests.go index d368f2311..a703cec3e 100644 --- a/hack/render-manifests.go +++ b/hack/render-manifests.go @@ -41,6 +41,7 @@ func main() { OperatorNamespace string OperatorImage string OperatorPullPolicy string + PluginImage string } handlerNamespace := flag.String("handler-namespace", "nmstate", "Namespace for the NMState handler") @@ -50,6 +51,7 @@ func main() { operatorNamespace := flag.String("operator-namespace", "nmstate-operator", "Namespace for the NMState operator") operatorImage := flag.String("operator-image", "", "Image for the NMState operator") operatorPullPolicy := flag.String("operator-pull-policy", "Always", "Pull policy for the NMState operator image") + pluginImage := flag.String("plugin-image", "", "Image for the NMState console plugin") inputDir := flag.String("input-dir", "", "Input directory") outputDir := flag.String("output-dir", "", "Output directory") flag.Parse() @@ -62,6 +64,7 @@ func main() { OperatorNamespace: *operatorNamespace, OperatorImage: *operatorImage, OperatorPullPolicy: *operatorPullPolicy, + PluginImage: *pluginImage, } // Clean up output dir so we don't have old files. diff --git a/manifests/stable/manifests/image-references b/manifests/stable/manifests/image-references index 15e820aed..762ee9a8c 100644 --- a/manifests/stable/manifests/image-references +++ b/manifests/stable/manifests/image-references @@ -10,3 +10,7 @@ spec: from: kind: DockerImage name: quay.io/openshift/origin-kubernetes-nmstate-handler:4.13 + - name: nmstate-console-plugin-rhel8 + from: + kind: DockerImage + name: quay.io/openshift/origin-nmstate-console-plugin:4.13 diff --git a/manifests/stable/manifests/kubernetes-nmstate-operator.clusterserviceversion.yaml b/manifests/stable/manifests/kubernetes-nmstate-operator.clusterserviceversion.yaml index 2b0f36c92..c07a8a502 100644 --- a/manifests/stable/manifests/kubernetes-nmstate-operator.clusterserviceversion.yaml +++ b/manifests/stable/manifests/kubernetes-nmstate-operator.clusterserviceversion.yaml @@ -187,6 +187,8 @@ spec: - name: RUN_OPERATOR - name: HANDLER_IMAGE value: quay.io/openshift/origin-kubernetes-nmstate-handler:4.13 + - name: PLUGIN_IMAGE + value: quay.io/openshift/origin-nmstate-console-plugin:4.13 - name: HANDLER_IMAGE_PULL_POLICY value: Always - name: HANDLER_NAMESPACE