Skip to content

Commit

Permalink
[Operator] Modify CSV to add support for OperatorHub on arm64,amd64,p…
Browse files Browse the repository at this point in the history
…pc64le,s390x (#1394)

* Modify csv to add support for OperatorHub on arm64,amd64,ppc64le,s390x

---------

Signed-off-by: jkalinic <[email protected]>
  • Loading branch information
jankalinic authored Jan 23, 2025
1 parent 42d7261 commit 85cee62
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
# ==================== Operator-Bundle ====================
- name: Modify Bundle CSV Metadata
run: ./operator/bin/modify-bundle-metadata.sh "VERSION=${{ env.PROJECT_VERSION }}"
run: ./operator/bin/modify-bundle-metadata.sh "VERSION=${{ env.PROJECT_VERSION }}" "PLATFORMS=${{ env.PLATFORMS }}"

- name: Build Operator Bundle Image
uses: docker/build-push-action@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
# ==================== Operator-Bundle ====================
- name: Modify Bundle CSV Metadata
working-directory: target/checkout
run: ./operator/bin/modify-bundle-metadata.sh "VERSION=${{steps.metadata.outputs.current-version}}"
run: ./operator/bin/modify-bundle-metadata.sh "VERSION=${{steps.metadata.outputs.current-version}}" "PLATFORMS=${{ env.PLATFORMS }}"

- name: Build and Push Operator Bundle Image
uses: docker/build-push-action@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
# ==================== Operator-Bundle ====================
- name: Modify Bundle CSV Metadata
run: ./operator/bin/modify-bundle-metadata.sh "VERSION=${{ env.NEXT_VERSION }}"
run: ./operator/bin/modify-bundle-metadata.sh "VERSION=${{ env.NEXT_VERSION }}" "PLATFORMS=${{ env.PLATFORMS }}"

- name: Build and Push Operator Bundle Image
uses: docker/build-push-action@v6
Expand Down
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CONSOLE_OPERATOR_CATALOG_IMAGE ?= $(IMAGE_REGISTRY)/$(IMAGE_GROUP)/console-opera

CONTAINER_RUNTIME ?= $(shell which podman || which docker)
SKOPEO_TRANSPORT ?= $(shell which podman >/dev/null && echo "containers-storage:" || echo "docker-daemon:")
ARCH ?= linux/amd64
PLATFORMS ?= linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
SKIP_RANGE ?= ""

CONSOLE_UI_NEXTAUTH_SECRET ?= $(shell openssl rand -base64 32)
Expand All @@ -26,6 +26,7 @@ CONSOLE_UI_NEXTAUTH_SECRET ?= $(shell openssl rand -base64 32)
# Without this export, UI and API images could not be pulled from registry during the deployment of Console instance
export QUARKUS_CONTAINER_IMAGE_TAG=${VERSION}
export QUARKUS_KUBERNETES_VERSION=${VERSION}
export QUARKUS_DOCKER_BUILDX_PLATFORM=${PLATFORMS}

container-image-api:
mvn package -am -pl api -Pcontainer-image -DskipTests -Dquarkus.container-image.image=$(CONSOLE_API_IMAGE)
Expand All @@ -35,10 +36,10 @@ container-image-api-push: container-image-api

container-image-operator:
mvn package -am -pl operator -Pcontainer-image -DskipTests -Dquarkus.kubernetes.namespace='$${NAMESPACE}' -Dquarkus.container-image.image=$(CONSOLE_OPERATOR_IMAGE)
operator/bin/modify-bundle-metadata.sh "VERSION=$(CSV_VERSION)" "SKIP_RANGE=$(SKIP_RANGE)" "SKOPEO_TRANSPORT=$(SKOPEO_TRANSPORT)"
operator/bin/modify-bundle-metadata.sh "VERSION=$(CSV_VERSION)" "SKIP_RANGE=$(SKIP_RANGE)" "SKOPEO_TRANSPORT=$(SKOPEO_TRANSPORT)" "PLATFORMS=$(PLATFORMS)"
operator/bin/generate-catalog.sh operator/target/bundle/streamshub-console-operator
$(CONTAINER_RUNTIME) build --platform=$(ARCH) -t $(CONSOLE_OPERATOR_BUNDLE_IMAGE) -f operator/target/bundle/streamshub-console-operator/bundle.Dockerfile
$(CONTAINER_RUNTIME) build --platform=$(ARCH) -t $(CONSOLE_OPERATOR_CATALOG_IMAGE) -f operator/src/main/docker/catalog.Dockerfile operator
$(CONTAINER_RUNTIME) build --platform=$(PLATFORMS) -t $(CONSOLE_OPERATOR_BUNDLE_IMAGE) -f operator/target/bundle/streamshub-console-operator/bundle.Dockerfile
$(CONTAINER_RUNTIME) build --platform=$(PLATFORMS) -t $(CONSOLE_OPERATOR_CATALOG_IMAGE) -f operator/src/main/docker/catalog.Dockerfile operator

container-image-operator-push: container-image-operator
skopeo copy --preserve-digests $(SKOPEO_TRANSPORT)$(CONSOLE_OPERATOR_IMAGE) docker://$(CONSOLE_OPERATOR_IMAGE)
Expand All @@ -54,7 +55,7 @@ container-image-ui:
export CONSOLE_MODE=read-only && \
npm run build && \
cd $(CURDIR) && \
$(CONTAINER_RUNTIME) build --platform=$(ARCH) -t $(CONSOLE_UI_IMAGE) ./ui -f ./ui/Dockerfile
$(CONTAINER_RUNTIME) build --platform=$(PLATFORMS) -t $(CONSOLE_UI_IMAGE) ./ui -f ./ui/Dockerfile

container-image-ui-push: container-image-ui
skopeo copy --preserve-digests $(SKOPEO_TRANSPORT)$(CONSOLE_UI_IMAGE) docker://$(CONSOLE_UI_IMAGE)
Expand Down
7 changes: 7 additions & 0 deletions operator/bin/modify-bundle-metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ for ARGUMENT in "$@" ; do
VERSION) VERSION=${VALUE};;
SKIP_RANGE) SKIP_RANGE=${VALUE};;
SKOPEO_TRANSPORT) SKOPEO_TRANSPORT=${VALUE};;
PLATFORMS) PLATFORMS=${VALUE};;
*)
esac
done
Expand Down Expand Up @@ -111,6 +112,12 @@ ${YQ} eval -o yaml -i '.spec.relatedImages += [{
"image": "'${ui_image_with_digest}'"
}]' "${CSV_FILE_PATH}"

for full_arch in ${PLATFORMS//,/ } ; do
os_arch=($(echo ${full_arch} | tr '/' '\n'))
arch=${os_arch[1]}
${YQ} eval -o yaml -i ".metadata.labels[\"operatorframework.io/arch.${arch}\"] = \"supported\"" "${CSV_FILE_PATH}"
done

# Add skipRange if present
if [[ -n "$SKIP_RANGE" ]]; then
echo "[DEBUG] Setting skipRange = \"${SKIP_RANGE}\""
Expand Down

0 comments on commit 85cee62

Please sign in to comment.