Skip to content

Added Workflow job to update CFO image #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/tag-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that change really needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we are using the command to update the params file so that the image variable codeflare-operator-controller-image is updated with the passed IMG

$(KUSTOMIZE) build config/${ENV} | kubectl apply -f -
git restore config/*

Expand Down Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
containers:
- command:
- /manager
image: controller:latest
image: $(codeflare_operator_controller_image)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be codeflare-operator-controller-image instead of codeflare_operator_controller_image?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codeflare_operator_controller_image is just a variable for the image in the params file.
We specify the replacement for $(codeflare_operator_controller_image) in the kustomization file

imagePullPolicy: Always
name: manager
securityContext:
Expand Down
1 change: 1 addition & 0 deletions config/manager/params.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
codeflare-operator-controller-image=quay.io/opendatahub/codeflare-operator:v1.0.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have an agreement with the ODH operator team to change the name from odh-codeflare-operator-controller-image?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch I haven't informed anyone yet of this change. Will I just drop a message into the ODH DW channel?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

late for the party, but, if i understand this correctly, we are not going to keep CFO in the near future for ODH and RHOAI.
so the changes done in upstream(as project-codeflare) is irrelevant to ODH and RHOAI.
which means, purely from project-codeflare perspective, these changes are not needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zdtsw The CFO is still going to be part of ODH / RHOAI in the near future. It's possible we'll reconsider that in the future, but at the moment, it's preferable we operate as usual and consider that these changes are needed.

3 changes: 3 additions & 0 deletions config/manager/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
varReference:
- path: spec/template/spec/containers[]/image
kind: Deployment
3 changes: 2 additions & 1 deletion config/manifests/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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