HYPERFLEET-1411 - refactor: Update konflux + dev bundles - #29
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Important Review skippedAuto reviews are limited based on label configuration. 🚫 Excluded labels (none allowed) (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
| - op: add | ||
| path: /spec/template/spec/containers/0/env/- | ||
| value: | ||
| name: RELATED_IMAGE_HYPERFLEET_OPERATOR |
There was a problem hiding this comment.
Need to properly update this in makefile?
| - op: add | ||
| path: /spec/template/spec/containers/0/env/- | ||
| value: | ||
| name: RELATED_IMAGE_HYPERFLEET_OPERATOR |
There was a problem hiding this comment.
Not 100% sure bundle-nudges ref will update this but hopefully
There was a problem hiding this comment.
Yeah you are right it won't get nudged. The build-service nudge regex is <repo>(:.*)?@(?<currentDigest>sha256:...) on a single token, so it only matches repo@sha256:digest on one line. Splitting into newName and digest means the two RELATED_IMAGE env values below get bumped but the controller image itself goes stale. Drop the images: block and patch the container image directly in the same patch list:
- op: replace
path: /spec/template/spec/containers/0/image
value: quay.io/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-operator@sha256:7504189fc375ee65457baa568487b9f083b35b882d58601cd4f4ad8ee50e639e
Nudging the redhat-services-prod path is fine btw, PR #27 already did that against the old Dockerfile.
| # Uninstall resources | ||
| # kubectl delete -f dist/install.yaml | ||
| # For image overrides edit config/manager/kustomization.yaml | ||
| .PHONY: build-deployer | ||
| build-deployer: manifests generate ## Generate a consolidated YAML with CRDs and deployment. | ||
| @mkdir -p dist | ||
| @$(KUSTOMIZE) build config/default > dist/install.yaml | ||
|
|
||
| .PHONY: build-deployer-override-img | ||
| build-deployer-override-img: manifests generate ## Generate deployer with IMG override, then restore kustomization.yaml | ||
| @mkdir -p dist | ||
| cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) |
There was a problem hiding this comment.
Need to update this to work properly
There was a problem hiding this comment.
Yeah true true, With config/manager/kustomization.yaml gone, kustomize build config/default fails so make deploy and build-deployer are broken. One way to avoid both this and the cp hack in the Dockerfile: keep config/manager/kustomization.yaml as the dev default, and make prod an overlay under config/manifests/prod with resources: [../] plus the image patch. Then the Dockerfile arg just picks which manifests dir to kustomize build.
|
|
||
| # Override the base kustomization.yaml | ||
| ARG KUSTOMIZE_VARIANT=dev/kustomization.yaml | ||
| RUN cp /workdir/config/manager/${KUSTOMIZE_VARIANT} \ |
There was a problem hiding this comment.
this won't build on Konflux. The tekton push passes KUSTOMIZE_VARIANT=config/manager/prod/kustomization.yaml but this line prefixes /workdir/config/manager/ itself, so the cp target becomes config/manager/config/manager/prod/... and fails. Pick one convention, I'd go with the full repo path in the ARG
ARG KUSTOMIZE_VARIANT=config/manager/dev/kustomization.yaml
RUN cp /workdir/${KUSTOMIZE_VARIANT} /workdir/config/manager/kustomization.yaml &&
kustomize build /workdir/config/manifests > /workdir/manifests.yaml
| - op: add | ||
| path: /spec/template/spec/containers/0/env/- | ||
| value: | ||
| name: RELATED_IMAGE_HYPERFLEET_OPERATOR |
There was a problem hiding this comment.
Yeah you are right it won't get nudged. The build-service nudge regex is <repo>(:.*)?@(?<currentDigest>sha256:...) on a single token, so it only matches repo@sha256:digest on one line. Splitting into newName and digest means the two RELATED_IMAGE env values below get bumped but the controller image itself goes stale. Drop the images: block and patch the container image directly in the same patch list:
- op: replace
path: /spec/template/spec/containers/0/image
value: quay.io/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-operator@sha256:7504189fc375ee65457baa568487b9f083b35b882d58601cd4f4ad8ee50e639e
Nudging the redhat-services-prod path is fine btw, PR #27 already did that against the old Dockerfile.
| pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch | ||
| == "main" && ( ".tekton/hyperfleet-operator-bundle-push.yaml".pathChanged() || "bundle.konflux.Dockerfile".pathChanged() | ||
| || "bundle-hack/***".pathChanged() || "bundle/***".pathChanged() ) | ||
| == "main" && ( ".tekton/hyperfleet-operator-bundle-push.yaml".pathChanged() || "bundle.Dockerfile".pathChanged()) |
There was a problem hiding this comment.
The bundle content now comes from config/, but this only fires on bundle.Dockerfile. So a nudge PR touching config/manager/prod/kustomization.yaml never rebuilds the bundle. Worse, it does match the operator push (it only excludes the bundle Dockerfile and this file), so the operator rebuilds, gets a new digest, opens another nudge, and we loop. Add "config/***".pathChanged() here, and exclude the prod kustomization in the operator push CEL
| @@ -1,3 +1,23 @@ | |||
| FROM registry.k8s.io/kustomize/kustomize:v5.0.0 AS kustomize | |||
There was a problem hiding this comment.
registry.k8s.io and quay.io/operator-framework (line 11) aren't in the app-interface-standard base image allowlist, so Conforma fails base_image_permitted on the release, same thing we hit on the catalog PR. registry.redhat.io/openshift4/ose-operator-sdk-rhel9:v4.18 has operator-sdk, and registry.redhat.io/openshift4/ose-cli-rhel9:v4.18 gives you oc kustomize for the first stage.
| provider: | ||
| name: Red Hat | ||
| url: https://github.com/openshift-hyperfleet | ||
| relatedImages: |
There was a problem hiding this comment.
I think these placeholders are dead. operator-sdk replaces spec.relatedImages wholesale from the RELATED_IMAGE_* env vars (base.Spec.RelatedImages = g.RelatedImages), so they never make it into the bundle. Can drop them to save the next person wondering why they're empty.
| $(CONTAINER_TOOL) build -f bundle.Dockerfile \ | ||
| --platform $(PLATFORM) \ | ||
| --build-arg VERSION=$(VERSION) \ | ||
| --build-arg CHANNEL=$(CHANNELS) \ |
There was a problem hiding this comment.
the Dockerfile ARG is CHANNELS but this passes CHANNEL, so make bundle-build CHANNELS=candidate silently builds stable. Also worth passing KUSTOMIZE_VARIANT through here so you can build the prod variant locally
| # Uninstall resources | ||
| # kubectl delete -f dist/install.yaml | ||
| # For image overrides edit config/manager/kustomization.yaml | ||
| .PHONY: build-deployer | ||
| build-deployer: manifests generate ## Generate a consolidated YAML with CRDs and deployment. | ||
| @mkdir -p dist | ||
| @$(KUSTOMIZE) build config/default > dist/install.yaml | ||
|
|
||
| .PHONY: build-deployer-override-img | ||
| build-deployer-override-img: manifests generate ## Generate deployer with IMG override, then restore kustomization.yaml | ||
| @mkdir -p dist | ||
| cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) |
There was a problem hiding this comment.
Yeah true true, With config/manager/kustomization.yaml gone, kustomize build config/default fails so make deploy and build-deployer are broken. One way to avoid both this and the cp hack in the Dockerfile: keep config/manager/kustomization.yaml as the dev default, and make prod an overlay under config/manifests/prod with resources: [../] plus the image patch. Then the Dockerfile arg just picks which manifests dir to kustomize build.
Summary
Consolidates bundle build workflows by eliminating
bundle.konflux.Dockerfileand using a singlebundle.Dockerfilewith build-time variant selection. This follows the same pattern as the catalog build, using aKUSTOMIZE_VARIANTbuild argument to select between dev (:latesttags) and production (digest-pinned) image references, reducing maintenance burden and ensuring consistency between development and CI builds.HYPERFLEET-1411
Changes
bundle.konflux.Dockerfileand consolidated into singlebundle.DockerfilewithKUSTOMIZE_VARIANTbuild arg (defaults toconfig/manager/dev/kustomization.yaml)config/manager/dev/kustomization.yamlfor development builds using:latestimage tagsconfig/manager/prod/kustomization.yamlfor Konflux/production builds using digest-pinned image references (updated by Konflux build-nudges)bundle-hack/update_bundle.shscript (no longer needed with new variant-based approach)bundle/directory contents (bundle manifests should be generated at build time, not committed)config/manager/kustomization.yaml(replaced by environment-specific variants).tekton/hyperfleet-operator-bundle-push.yamlto usebundle.DockerfilewithKUSTOMIZE_VARIANT=config/manager/prod/kustomization.yamlbuild argbundle.Dockerfileinstead of multiple files (bundle.konflux.Dockerfile,bundle-hack/***,bundle/***)Notes
The variant system works by having the Dockerfile copy the specified kustomization file to override the base
config/manager/kustomization.yamlbefore runningkustomize build. This allows:config/manager/dev/kustomization.yaml(default) with:latesttags for rapid iterationconfig/manager/prod/kustomization.yamlwith digest-pinned images that Konflux build-nudges automatically updateThis eliminates the need to maintain two separate Dockerfiles and the
update_bundle.shscript, reducing the surface area for drift between environments.Test Plan
make bundle-buildmake bundle-build KUSTOMIZE_VARIANT=config/manager/prod/kustomization.yamlbundle.DockerfilechangesGitlab Change: https://gitlab.cee.redhat.com/releng/konflux-release-data/-/merge_requests/22503