diff --git a/.github/workflows/tag-and-build.yml b/.github/workflows/tag-and-build.yml index 038b77b0e..23c71ed74 100644 --- a/.github/workflows/tag-and-build.yml +++ b/.github/workflows/tag-and-build.yml @@ -102,6 +102,11 @@ jobs: sed -i -E "s/(.*INSTASCALE_VERSION \?= ).*/\1${{ github.event.inputs.instascale-version }}/" Makefile sed -i -E "s/(.*KUBERAY_VERSION \?= ).*/\1${{ github.event.inputs.kuberay-version }}/" Makefile + - name: Update image version in params.env + run: | + VERSION=${{ github.event.inputs.version }} perl -i -pe 's/:(.*)$/:$ENV{"VERSION"}/' config/manager/params.env + shell: bash + - name: Login to Quay.io uses: redhat-actions/podman-login@v1 with: @@ -134,7 +139,7 @@ jobs: uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: Update dependency versions for release ${{ github.event.inputs.version }} - file_pattern: 'README.md *.yaml Makefile go.mod go.sum' + file_pattern: 'README.md *.yaml Makefile go.mod go.sum *.env' create_branch: true branch: ${{ env.PR_BRANCH_NAME }} diff --git a/Makefile b/Makefile index 3f0d0f52c..c3fd37b28 100644 --- a/Makefile +++ b/Makefile @@ -198,7 +198,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified .PHONY: deploy deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} + cd config/manager && IMAGE=$(IMG) perl -i -pe 's/codeflare-operator-controller-image=(.*)$$/codeflare-operator-controller-image=$$ENV{"IMAGE"}/' params.env $(KUSTOMIZE) build config/${ENV} | kubectl apply -f - git restore config/* @@ -283,8 +283,8 @@ validate-bundle: install-operator-sdk .PHONY: bundle bundle: manifests kustomize install-operator-sdk ## Generate bundle manifests and metadata, then validate generated files. + cd config/manager && IMAGE=$(IMG) perl -i -pe 's/codeflare-operator-controller-image=(.*)$$/codeflare-operator-controller-image=$$ENV{"IMAGE"}/' params.env $(OPERATOR_SDK) generate kustomize manifests -q - cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) cd config/manifests && $(KUSTOMIZE) edit add patch --patch '[{"op":"add", "path":"/metadata/annotations/containerImage", "value": "$(IMG)" }]' --kind ClusterServiceVersion cd config/manifests && $(KUSTOMIZE) edit add patch --patch '[{"op":"add", "path":"/spec/replaces", "value": "codeflare-operator.$(PREVIOUS_VERSION)" }]' --kind ClusterServiceVersion $(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS) diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 4fe5ccaa3..847eca176 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -3,3 +3,19 @@ resources: generatorOptions: disableNameSuffixHash: true + +configMapGenerator: +- name: stack-config + envs: + - params.env +configurations: + - params.yaml + +vars: +- name: codeflare_operator_controller_image + objref: + kind: ConfigMap + name: stack-config + apiVersion: v1 + fieldref: + fieldpath: data.codeflare-operator-controller-image diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 8a4f6451b..20a34fe9d 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -34,7 +34,7 @@ spec: containers: - command: - /manager - image: controller:latest + image: $(codeflare_operator_controller_image) imagePullPolicy: Always name: manager securityContext: diff --git a/config/manager/params.env b/config/manager/params.env new file mode 100644 index 000000000..8c9de7847 --- /dev/null +++ b/config/manager/params.env @@ -0,0 +1 @@ +codeflare-operator-controller-image=quay.io/opendatahub/codeflare-operator:v1.0.1 diff --git a/config/manager/params.yaml b/config/manager/params.yaml new file mode 100644 index 000000000..43509ff29 --- /dev/null +++ b/config/manager/params.yaml @@ -0,0 +1,3 @@ +varReference: + - path: spec/template/spec/containers[]/image + kind: Deployment diff --git a/config/manifests/kustomization.yaml b/config/manifests/kustomization.yaml index 958a9e247..161a419d3 100644 --- a/config/manifests/kustomization.yaml +++ b/config/manifests/kustomization.yaml @@ -1,8 +1,9 @@ # These resources constitute the fully configured set of manifests # used to generate the 'manifests/' directory in a bundle. resources: -- bases/codeflare-operator.clusterserviceversion.yaml - ../default - ../scorecard +- bases/codeflare-operator.clusterserviceversion.yaml + apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization