From 1f9193a1efbbc22aea27860fc71a070007ba087d Mon Sep 17 00:00:00 2001 From: Lucian Tosa <49226451+lucian-tosa@users.noreply.github.com> Date: Tue, 10 Oct 2023 11:02:52 +0200 Subject: [PATCH] CLOUDP-82639: ARM support (#1361) * Build multi-arch * Set up emulation * Uncomment s3 dockerfile * Create manifest for github image tags * Multi-arch for ubi agent * Default to UBI distro * Add docstring * Remove comment * Remove whitespace * Reuse dockerfiles * Make multi-arch context images * Use new community images supporting ARM --------- Co-authored-by: Julien Benhaim --- .action_templates/e2e-fork-template.yaml | 1 + .action_templates/e2e-pr-template.yaml | 1 + .action_templates/e2e-single-template.yaml | 1 + .../build-and-push-development-images.yaml | 2 +- .action_templates/steps/set-up-qemu.yaml | 2 + .github/workflows/e2e-dispatch.yml | 5 +- .github/workflows/e2e-fork.yml | 5 +- .github/workflows/e2e.yml | 5 +- Makefile | 2 +- config/manager/manager.yaml | 2 +- deploy/openshift/operator_openshift.yaml | 2 +- docs/install-upgrade.md | 4 +- inventories/e2e-inventory.yaml | 39 +- inventories/operator-inventory.yaml | 130 ++++++- inventory.yaml | 357 ++++++++++++++++-- pipeline.py | 186 ++++++++- .../automation_config_builder.go | 12 + scripts/ci/config.json | 2 +- scripts/dev/dev_config.py | 5 +- scripts/dev/e2e.py | 2 +- scripts/dev/templates/Dockerfile.e2e | 5 +- scripts/dev/templates/Dockerfile.template | 4 +- .../dev/templates/operator/Dockerfile.builder | 6 +- .../templates/readiness/Dockerfile.builder | 6 +- .../templates/versionhook/Dockerfile.builder | 6 +- test/e2e/setup/test_config.go | 2 +- 26 files changed, 729 insertions(+), 65 deletions(-) create mode 100644 .action_templates/steps/set-up-qemu.yaml diff --git a/.action_templates/e2e-fork-template.yaml b/.action_templates/e2e-fork-template.yaml index 40070737f..c6378cceb 100644 --- a/.action_templates/e2e-fork-template.yaml +++ b/.action_templates/e2e-fork-template.yaml @@ -9,6 +9,7 @@ jobs: - template: checkout-fork - template: setup-and-install-python - template: quay-login + - template: set-up-qemu - template: build-and-push-development-images - template: tests steps: diff --git a/.action_templates/e2e-pr-template.yaml b/.action_templates/e2e-pr-template.yaml index ac3fce7b3..8c4e79d14 100644 --- a/.action_templates/e2e-pr-template.yaml +++ b/.action_templates/e2e-pr-template.yaml @@ -9,6 +9,7 @@ jobs: - template: checkout - template: setup-and-install-python - template: quay-login + - template: set-up-qemu - template: build-and-push-development-images - template: tests steps: diff --git a/.action_templates/e2e-single-template.yaml b/.action_templates/e2e-single-template.yaml index 03e9c511e..36e586af3 100644 --- a/.action_templates/e2e-single-template.yaml +++ b/.action_templates/e2e-single-template.yaml @@ -6,6 +6,7 @@ jobs: - template: checkout - template: setup-and-install-python - template: quay-login + - template: set-up-qemu - template: build-and-push-development-images - template: single-test steps: diff --git a/.action_templates/steps/build-and-push-development-images.yaml b/.action_templates/steps/build-and-push-development-images.yaml index 063ae446a..9e740af06 100644 --- a/.action_templates/steps/build-and-push-development-images.yaml +++ b/.action_templates/steps/build-and-push-development-images.yaml @@ -1,6 +1,6 @@ - name: Build and Push Images run: | - python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false + python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false --tag ${{ github.run_id }} env: MONGODB_COMMUNITY_CONFIG: "${{ github.workspace }}/scripts/ci/config.json" version_id: "${{ github.run_id }}" diff --git a/.action_templates/steps/set-up-qemu.yaml b/.action_templates/steps/set-up-qemu.yaml new file mode 100644 index 000000000..7ae0e920a --- /dev/null +++ b/.action_templates/steps/set-up-qemu.yaml @@ -0,0 +1,2 @@ +- name: Set up QEMU + uses: docker/setup-qemu-action@v2 diff --git a/.github/workflows/e2e-dispatch.yml b/.github/workflows/e2e-dispatch.yml index 93bb2caeb..508a9207e 100644 --- a/.github/workflows/e2e-dispatch.yml +++ b/.github/workflows/e2e-dispatch.yml @@ -70,10 +70,13 @@ jobs: registry: quay.io username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_ROBOT_TOKEN }} + # template: .action_templates/steps/set-up-qemu.yaml + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 # template: .action_templates/steps/build-and-push-development-images.yaml - name: Build and Push Images run: | - python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false + python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false --tag ${{ github.run_id }} env: MONGODB_COMMUNITY_CONFIG: ${{ github.workspace }}/scripts/ci/config.json version_id: ${{ github.run_id }} diff --git a/.github/workflows/e2e-fork.yml b/.github/workflows/e2e-fork.yml index 4b99bf960..4cb8b75e1 100644 --- a/.github/workflows/e2e-fork.yml +++ b/.github/workflows/e2e-fork.yml @@ -72,10 +72,13 @@ jobs: registry: quay.io username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_ROBOT_TOKEN }} + # template: .action_templates/steps/set-up-qemu.yaml + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 # template: .action_templates/steps/build-and-push-development-images.yaml - name: Build and Push Images run: | - python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false + python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false --tag ${{ github.run_id }} env: MONGODB_COMMUNITY_CONFIG: ${{ github.workspace }}/scripts/ci/config.json version_id: ${{ github.run_id }} diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index bab745b9b..a3a20e3ec 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -78,10 +78,13 @@ jobs: registry: quay.io username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_ROBOT_TOKEN }} + # template: .action_templates/steps/set-up-qemu.yaml + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 # template: .action_templates/steps/build-and-push-development-images.yaml - name: Build and Push Images run: | - python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false + python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false --tag ${{ github.run_id }} env: MONGODB_COMMUNITY_CONFIG: ${{ github.workspace }}/scripts/ci/config.json version_id: ${{ github.run_id }} diff --git a/Makefile b/Makefile index 9e723dbb4..6226a8eda 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ NAMESPACE := $(shell jq -r .namespace < $(MONGODB_COMMUNITY_CONFIG)) UPGRADE_HOOK_IMG := $(shell jq -r .version_upgrade_hook_image < $(MONGODB_COMMUNITY_CONFIG)) READINESS_PROBE_IMG := $(shell jq -r .readiness_probe_image < $(MONGODB_COMMUNITY_CONFIG)) REGISTRY := $(shell jq -r .repo_url < $(MONGODB_COMMUNITY_CONFIG)) -AGENT_IMAGE_NAME := $(shell jq -r .agent_image_ubuntu < $(MONGODB_COMMUNITY_CONFIG)) +AGENT_IMAGE_NAME := $(shell jq -r .agent_image_ubi < $(MONGODB_COMMUNITY_CONFIG)) HELM_CHART ?= ./helm-charts/charts/community-operator diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index a973bd64b..c1296043c 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -53,7 +53,7 @@ spec: - name: MONGODB_IMAGE value: mongodb-community-server - name: MONGODB_REPO_URL - value: docker.io/mongodb + value: quay.io/mongodb image: quay.io/mongodb/mongodb-kubernetes-operator:0.8.2 imagePullPolicy: Always name: mongodb-kubernetes-operator diff --git a/deploy/openshift/operator_openshift.yaml b/deploy/openshift/operator_openshift.yaml index 3a0374ba3..461d00414 100644 --- a/deploy/openshift/operator_openshift.yaml +++ b/deploy/openshift/operator_openshift.yaml @@ -55,7 +55,7 @@ spec: - name: MONGODB_IMAGE value: mongo - name: MONGODB_REPO_URL - value: docker.io + value: quay.io image: quay.io/mongodb/mongodb-kubernetes-operator:0.8.2 imagePullPolicy: Always name: mongodb-kubernetes-operator diff --git a/docs/install-upgrade.md b/docs/install-upgrade.md index 971c55bfa..1b0972edb 100644 --- a/docs/install-upgrade.md +++ b/docs/install-upgrade.md @@ -179,9 +179,9 @@ for MongoDB Docker images: - MongoDB tests, maintains, and supports them. | Environment Variable | Description | Default | - |----|------------------------------|----| + |----|------------------------------|------------------------------| | `MONGODB_IMAGE` | From the `MONGODB_REPO_URL`, absolute path to the MongoDB Docker image that you want to deploy. | `"mongodb-community-server"` | - | `MONGODB_REPO_URL` | URL of the container registry that contains the MongoDB Docker image that you want to deploy. | `"docker.io/mongodb"` | + | `MONGODB_REPO_URL` | URL of the container registry that contains the MongoDB Docker image that you want to deploy. | `"quay.io/mongodb"` | ```yaml spec: diff --git a/inventories/e2e-inventory.yaml b/inventories/e2e-inventory.yaml index a56f787b6..8b65252d2 100644 --- a/inventories/e2e-inventory.yaml +++ b/inventories/e2e-inventory.yaml @@ -2,7 +2,40 @@ vars: registry: images: - - name: e2e + - name: e2e-arm64 + vars: + context: . + template_context: scripts/dev/templates + inputs: + - e2e_image + platform: linux/arm64 + stages: + - name: e2e-template + task_type: dockerfile_template + distro: e2e + + inputs: + - builder + - base_image + + output: + - dockerfile: scripts/dev/templates/Dockerfile.ubi-$(inputs.params.version_id) + + - name: e2e-build + task_type: docker_build + + dockerfile: scripts/dev/templates/Dockerfile.ubi-$(inputs.params.version_id) + + labels: + quay.expires-after: 48h + + output: + - registry: $(inputs.params.registry)/$(inputs.params.e2e_image) + tag: $(inputs.params.version_id)-arm64 + - registry: $(inputs.params.registry)/$(inputs.params.e2e_image) + tag: latest-arm64 + + - name: e2e-amd64 vars: context: . template_context: scripts/dev/templates @@ -31,7 +64,7 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.e2e_image) - tag: $(inputs.params.version_id) + tag: $(inputs.params.version_id)-amd64 - registry: $(inputs.params.registry)/$(inputs.params.e2e_image) - tag: latest + tag: latest-amd64 diff --git a/inventories/operator-inventory.yaml b/inventories/operator-inventory.yaml index 6646d7e18..3a9a440c2 100644 --- a/inventories/operator-inventory.yaml +++ b/inventories/operator-inventory.yaml @@ -2,7 +2,7 @@ vars: registry: images: - - name: operator-ubi + - name: operator-ubi-amd64 vars: context: . template_context: scripts/dev/templates/operator @@ -30,7 +30,7 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev) - tag: $(inputs.params.version_id)-context + tag: $(inputs.params.version_id)-context-amd64 - name: operator-template-dev task_type: dockerfile_template @@ -51,16 +51,16 @@ images: - version_id buildargs: - imagebase: $(inputs.params.registry)/$(inputs.params.operator_image_dev):$(inputs.params.version_id)-context + imagebase: $(inputs.params.registry)/$(inputs.params.operator_image_dev):$(inputs.params.version_id)-context-amd64 labels: quay.expires-after: 48h output: - registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev) - tag: $(inputs.params.version_id) + tag: $(inputs.params.version_id)-amd64 - registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev) - tag: latest + tag: latest-amd64 # # Release build stages @@ -83,7 +83,7 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.operator_image) - tag: $(inputs.params.release_version)-context + tag: $(inputs.params.release_version)-context-amd64 - name: operator-template-release task_type: dockerfile_template @@ -107,11 +107,125 @@ images: dockerfile: scripts/dev/templates/operator/Dockerfile.operator-$(inputs.params.release_version) buildargs: - imagebase: $(inputs.params.registry)/$(inputs.params.operator_image):$(inputs.params.release_version)-context + imagebase: $(inputs.params.registry)/$(inputs.params.operator_image):$(inputs.params.release_version)-context-amd64 labels: quay.expires-after: Never output: - registry: $(inputs.params.registry)/$(inputs.params.operator_image) - tag: $(inputs.params.release_version) + tag: $(inputs.params.release_version)-amd64 + + - name: operator-ubi-arm64 + vars: + context: . + template_context: scripts/dev/templates/operator + + inputs: + - operator_image + - operator_image_dev + + platform: linux/arm64 + + stages: + # + # Dev build stages + # + - name: operator-builder-dev + task_type: docker_build + tags: [ "ubi" ] + dockerfile: scripts/dev/templates/operator/Dockerfile.builder + + buildargs: + builder_image: $(inputs.params.builder_image) + + labels: + quay.expires-after: 48h + + output: + - registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev) + tag: $(inputs.params.version_id)-context-arm64 + + - name: operator-template-dev + task_type: dockerfile_template + tags: [ "ubi" ] + template_file_extension: operator + inputs: + - base_image + + output: + - dockerfile: scripts/dev/templates/operator/Dockerfile.operator-$(inputs.params.version_id) + + - name: operator-build-dev + task_type: docker_build + tags: [ "ubi" ] + dockerfile: scripts/dev/templates/operator/Dockerfile.operator-$(inputs.params.version_id) + + inputs: + - version_id + + buildargs: + imagebase: $(inputs.params.registry)/$(inputs.params.operator_image_dev):$(inputs.params.version_id)-context-arm64 + + labels: + quay.expires-after: 48h + + output: + - registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev) + tag: $(inputs.params.version_id)-arm64 + - registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev) + tag: latest-arm64 + + # + # Release build stages + # + - name: operator-builder-release + task_type: docker_build + tags: [ "ubi", "release" ] + + inputs: + - builder_image + - release_version + + dockerfile: scripts/dev/templates/operator/Dockerfile.builder + + labels: + quay.expires-after: Never + + buildargs: + builder_image: $(inputs.params.builder_image) + + output: + - registry: $(inputs.params.registry)/$(inputs.params.operator_image) + tag: $(inputs.params.release_version)-context-arm64 + + - name: operator-template-release + task_type: dockerfile_template + tags: [ "ubi", "release" ] + template_file_extension: operator + inputs: + - base_image + - release_version + + output: + - dockerfile: scripts/dev/templates/operator/Dockerfile.operator-$(inputs.params.release_version) + - dockerfile: $(inputs.params.s3_bucket)/mongodb-kubernetes-operator/$(inputs.params.release_version)/ubi/Dockerfile + + - name: operator-build-release + task_type: docker_build + tags: [ "ubi", "release" ] + + inputs: + - release_version + + dockerfile: scripts/dev/templates/operator/Dockerfile.operator-$(inputs.params.release_version) + + buildargs: + imagebase: $(inputs.params.registry)/$(inputs.params.operator_image):$(inputs.params.release_version)-context-arm64 + + labels: + quay.expires-after: Never + + output: + - registry: $(inputs.params.registry)/$(inputs.params.operator_image) + tag: $(inputs.params.release_version)-arm64 diff --git a/inventory.yaml b/inventory.yaml index 025d63c1a..d442b5fae 100644 --- a/inventory.yaml +++ b/inventory.yaml @@ -106,7 +106,7 @@ images: - registry: $(inputs.params.registry)/$(inputs.params.agent_image) tag: $(inputs.params.agent_version) - - name: agent-ubi + - name: agent-ubi-amd64 vars: context: . template_context: scripts/dev/templates/agent @@ -134,7 +134,7 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.agent_image_dev) - tag: $(inputs.params.version_id)-context + tag: $(inputs.params.version_id)-context-amd64 - name: agent-template-ubi task_type: dockerfile_template @@ -151,7 +151,7 @@ images: dockerfile: scripts/dev/templates/agent/Dockerfile.ubi-$(inputs.params.version_id) buildargs: - imagebase: $(inputs.params.registry)/$(inputs.params.agent_image_dev):$(inputs.params.version_id)-context + imagebase: $(inputs.params.registry)/$(inputs.params.agent_image_dev):$(inputs.params.version_id)-context-amd64 agent_version: $(inputs.params.agent_version) labels: @@ -159,9 +159,9 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.agent_image_dev) - tag: $(inputs.params.version_id) + tag: $(inputs.params.version_id)-amd64 - registry: $(inputs.params.registry)/$(inputs.params.agent_image_dev) - tag: latest + tag: latest-amd64 - name: agent-template-ubi-s3 task_type: dockerfile_template @@ -189,7 +189,7 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.agent_image) - tag: $(inputs.params.agent_version)-context + tag: $(inputs.params.agent_version)-context-amd64 - name: agent-ubi-release task_type: docker_build @@ -197,7 +197,7 @@ images: dockerfile: scripts/dev/templates/agent/Dockerfile.ubi-$(inputs.params.version_id) buildargs: - imagebase: $(inputs.params.registry)/$(inputs.params.agent_image):$(inputs.params.agent_version)-context + imagebase: $(inputs.params.registry)/$(inputs.params.agent_image):$(inputs.params.agent_version)-context-amd64 agent_version: $(inputs.params.agent_version) labels: @@ -205,9 +205,110 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.agent_image) - tag: $(inputs.params.agent_version) + tag: $(inputs.params.agent_version)-amd64 + + - name: agent-ubi-arm64 + vars: + context: . + template_context: scripts/dev/templates/agent + + inputs: + - agent_version + - tools_version + - agent_image + - agent_image_dev + + platform: linux/arm64 + stages: + - name: agent-ubi-context + task_type: docker_build + dockerfile: scripts/dev/templates/agent/Dockerfile.builder + tags: [ "ubi" ] + buildargs: + agent_version: $(inputs.params.agent_version) + tools_version: $(inputs.params.tools_version) + agent_distro: amzn2_aarch64 + tools_distro: rhel82-aarch64 + + labels: + quay.expires-after: 48h + + output: + - registry: $(inputs.params.registry)/$(inputs.params.agent_image_dev) + tag: $(inputs.params.version_id)-context-arm64 + + - name: agent-template-ubi + task_type: dockerfile_template + distro: ubi + tags: [ "ubi" ] + + output: + - dockerfile: scripts/dev/templates/agent/Dockerfile.ubi-$(inputs.params.version_id) + + - name: agent-ubi-build + task_type: docker_build + tags: [ "ubi" ] + + dockerfile: scripts/dev/templates/agent/Dockerfile.ubi-$(inputs.params.version_id) + + buildargs: + imagebase: $(inputs.params.registry)/$(inputs.params.agent_image_dev):$(inputs.params.version_id)-context-arm64 + agent_version: $(inputs.params.agent_version) + + labels: + quay.expires-after: 48h + + output: + - registry: $(inputs.params.registry)/$(inputs.params.agent_image_dev) + tag: $(inputs.params.version_id)-arm64 + - registry: $(inputs.params.registry)/$(inputs.params.agent_image_dev) + tag: latest-arm64 + + - name: agent-template-ubi-s3 + task_type: dockerfile_template + tags: [ "ubi", "release" ] + distro: ubi + + inputs: + - release_version + + output: + - dockerfile: $(inputs.params.s3_bucket)/mongodb-agent/$(inputs.params.release_version)/ubi/Dockerfile + + - name: agent-context-ubi-release + task_type: docker_build + dockerfile: scripts/dev/templates/agent/Dockerfile.builder + tags: [ "ubi", "release" ] + buildargs: + agent_version: $(inputs.params.agent_version) + tools_version: $(inputs.params.tools_version) + agent_distro: amzn2_aarch64 + tools_distro: rhel82-aarch64 + + labels: + quay.expires-after: Never + + output: + - registry: $(inputs.params.registry)/$(inputs.params.agent_image) + tag: $(inputs.params.agent_version)-context-arm64 + + - name: agent-ubi-release + task_type: docker_build + tags: [ "ubi", "release" ] + dockerfile: scripts/dev/templates/agent/Dockerfile.ubi-$(inputs.params.version_id) + + buildargs: + imagebase: $(inputs.params.registry)/$(inputs.params.agent_image):$(inputs.params.agent_version)-context-arm64 + agent_version: $(inputs.params.agent_version) + + labels: + quay.expires-after: Never - - name: readiness-probe-init + output: + - registry: $(inputs.params.registry)/$(inputs.params.agent_image) + tag: $(inputs.params.agent_version)-arm64 + + - name: readiness-probe-init-amd64 vars: context: . template_context: scripts/dev/templates/readiness @@ -230,7 +331,7 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.readiness_probe_image_dev) - tag: $(inputs.params.version_id)-context + tag: $(inputs.params.version_id)-context-amd64 - name: readiness-template-ubi task_type: dockerfile_template @@ -249,7 +350,7 @@ images: dockerfile: scripts/dev/templates/readiness/Dockerfile.readiness-$(inputs.params.version_id) buildargs: - imagebase: $(inputs.params.registry)/$(inputs.params.readiness_probe_image_dev):$(inputs.params.version_id)-context + imagebase: $(inputs.params.registry)/$(inputs.params.readiness_probe_image_dev):$(inputs.params.version_id)-context-amd64 labels: @@ -257,9 +358,9 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.readiness_probe_image_dev) - tag: $(inputs.params.version_id) + tag: $(inputs.params.version_id)-amd64 - registry: $(inputs.params.registry)/$(inputs.params.readiness_probe_image_dev) - tag: latest + tag: latest-amd64 - name: readiness-init-context-release task_type: docker_build @@ -278,7 +379,7 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.readiness_probe_image) - tag: $(inputs.params.release_version)-context + tag: $(inputs.params.release_version)-context-amd64 - name: readiness-template-release task_type: dockerfile_template @@ -298,7 +399,7 @@ images: tags: [ "readiness-probe", "release" , "ubi" ] buildargs: - imagebase: $(inputs.params.registry)/$(inputs.params.readiness_probe_image):$(inputs.params.release_version)-context + imagebase: $(inputs.params.registry)/$(inputs.params.readiness_probe_image):$(inputs.params.release_version)-context-amd64 labels: quay.expires-after: Never @@ -309,9 +410,113 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.readiness_probe_image) - tag: $(inputs.params.release_version) + tag: $(inputs.params.release_version)-amd64 - - name: version-post-start-hook-init + - name: readiness-probe-init-arm64 + vars: + context: . + template_context: scripts/dev/templates/readiness + + inputs: + - readiness_probe_image + - readiness_probe_image_dev + + platform: linux/arm64 + stages: + - name: readiness-init-context-build + task_type: docker_build + dockerfile: scripts/dev/templates/readiness/Dockerfile.builder + tags: [ "readiness-probe", "ubi" ] + labels: + quay.expires-after: 48h + + buildargs: + builder_image: $(inputs.params.builder_image) + + output: + - registry: $(inputs.params.registry)/$(inputs.params.readiness_probe_image_dev) + tag: $(inputs.params.version_id)-context-arm64 + + - name: readiness-template-ubi + task_type: dockerfile_template + tags: [ "ubi" ] + template_file_extension: readiness + + inputs: + - base_image + + output: + - dockerfile: scripts/dev/templates/readiness/Dockerfile.readiness-$(inputs.params.version_id) + + - name: readiness-init-build + task_type: docker_build + tags: [ "readiness-probe", "ubi" ] + dockerfile: scripts/dev/templates/readiness/Dockerfile.readiness-$(inputs.params.version_id) + + buildargs: + imagebase: $(inputs.params.registry)/$(inputs.params.readiness_probe_image_dev):$(inputs.params.version_id)-context-arm64 + + + labels: + quay.expires-after: 48h + + output: + - registry: $(inputs.params.registry)/$(inputs.params.readiness_probe_image_dev) + tag: $(inputs.params.version_id)-arm64 + - registry: $(inputs.params.registry)/$(inputs.params.readiness_probe_image_dev) + tag: latest-arm64 + + - name: readiness-init-context-release + task_type: docker_build + dockerfile: scripts/dev/templates/readiness/Dockerfile.builder + tags: [ "readiness-probe", "release" , "ubi" ] + + labels: + quay.expires-after: Never + + buildargs: + builder_image: $(inputs.params.builder_image) + + inputs: + - release_version + - builder_image + + output: + - registry: $(inputs.params.registry)/$(inputs.params.readiness_probe_image) + tag: $(inputs.params.release_version)-context-arm64 + + - name: readiness-template-release + task_type: dockerfile_template + tags: [ "readiness-probe", "release", "ubi" ] + template_file_extension: readiness + inputs: + - base_image + - release_version + + output: + - dockerfile: scripts/dev/templates/readiness/Dockerfile.readiness-$(inputs.params.release_version) + - dockerfile: $(inputs.params.s3_bucket)/mongodb-kubernetes-readinessprobe/$(inputs.params.release_version)/ubi/Dockerfile + + - name: readiness-init-build-release + task_type: docker_build + dockerfile: scripts/dev/templates/readiness/Dockerfile.readiness-$(inputs.params.release_version) + tags: [ "readiness-probe", "release" , "ubi" ] + + buildargs: + imagebase: $(inputs.params.registry)/$(inputs.params.readiness_probe_image):$(inputs.params.release_version)-context-arm64 + + labels: + quay.expires-after: Never + + inputs: + - base_image + - release_version + + output: + - registry: $(inputs.params.registry)/$(inputs.params.readiness_probe_image) + tag: $(inputs.params.release_version)-arm64 + + - name: version-post-start-hook-init-amd64 vars: context: . template_context: scripts/dev/templates/versionhook @@ -335,7 +540,7 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image_dev) - tag: $(inputs.params.version_id)-context + tag: $(inputs.params.version_id)-context-amd64 - name: version-post-start-hook-template-ubi task_type: dockerfile_template @@ -354,16 +559,120 @@ images: tags: [ "post-start-hook", "ubi" ] buildargs: - imagebase: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image_dev):$(inputs.params.version_id)-context + imagebase: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image_dev):$(inputs.params.version_id)-context-amd64 labels: quay.expires-after: 48h output: - registry: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image_dev) - tag: $(inputs.params.version_id) + tag: $(inputs.params.version_id)-amd64 - registry: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image_dev) - tag: latest + tag: latest-amd64 + + - name: version-post-start-hook-init-context-release + task_type: docker_build + dockerfile: scripts/dev/templates/versionhook/Dockerfile.builder + tags: [ "release", "post-start-hook", "ubi", ] + + labels: + quay.expires-after: Never + + buildargs: + builder_image: $(inputs.params.builder_image) + + inputs: + - release_version + - builder_image + + output: + - registry: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image) + tag: $(inputs.params.release_version)-context-amd64 + + - name: versionhook-template-release + task_type: dockerfile_template + tags: [ "post-start-hook", "release", "ubi" ] + template_file_extension: versionhook + inputs: + - base_image + - release_version + + output: + - dockerfile: scripts/dev/templates/versionhook/Dockerfile.versionhook-$(inputs.params.release_version) + - dockerfile: $(inputs.params.s3_bucket)/mongodb-kubernetes-operator-version-upgrade-post-start-hook/$(inputs.params.release_version)/ubi/Dockerfile + + - name: version-post-start-hook-init-build-release + task_type: docker_build + dockerfile: scripts/dev/templates/versionhook/Dockerfile.versionhook-$(inputs.params.release_version) + tags: [ "release", "post-start-hook", "ubi" ] + + buildargs: + imagebase: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image):$(inputs.params.release_version)-context-amd64 + + labels: + quay.expires-after: Never + + inputs: + - base_image + - release_version + + output: + - registry: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image) + tag: $(inputs.params.release_version)-amd64 + + - name: version-post-start-hook-init-arm64 + vars: + context: . + template_context: scripts/dev/templates/versionhook + + inputs: + - version_post_start_hook_image + - version_post_start_hook_image_dev + + platform: linux/arm64 + stages: + - name: version-post-start-hook-init-context-build + task_type: docker_build + dockerfile: scripts/dev/templates/versionhook/Dockerfile.builder + tags: [ "post-start-hook", "ubi" ] + + buildargs: + builder_image: $(inputs.params.builder_image) + + labels: + quay.expires-after: 48h + + output: + - registry: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image_dev) + tag: $(inputs.params.version_id)-context-arm64 + + - name: version-post-start-hook-template-ubi + task_type: dockerfile_template + tags: [ "ubi" ] + template_file_extension: versionhook + + inputs: + - base_image + + output: + - dockerfile: scripts/dev/templates/versionhook/Dockerfile.versionhook-$(inputs.params.version_id) + + - name: version-post-start-hook-init-build + task_type: docker_build + dockerfile: scripts/dev/templates/versionhook/Dockerfile.versionhook-$(inputs.params.version_id) + tags: [ "post-start-hook", "ubi" ] + + buildargs: + imagebase: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image_dev):$(inputs.params.version_id)-context-arm64 + + labels: + quay.expires-after: 48h + + output: + - registry: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image_dev) + tag: $(inputs.params.version_id)-arm64 + - registry: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image_dev) + tag: latest-arm64 - name: version-post-start-hook-init-context-release task_type: docker_build @@ -382,7 +691,7 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image) - tag: $(inputs.params.release_version)-context + tag: $(inputs.params.release_version)-context-arm64 - name: versionhook-template-release task_type: dockerfile_template @@ -402,7 +711,7 @@ images: tags: [ "release", "post-start-hook", "ubi" ] buildargs: - imagebase: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image):$(inputs.params.release_version)-context + imagebase: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image):$(inputs.params.release_version)-context-arm64 labels: quay.expires-after: Never @@ -413,4 +722,4 @@ images: output: - registry: $(inputs.params.registry)/$(inputs.params.version_post_start_hook_image) - tag: $(inputs.params.release_version) \ No newline at end of file + tag: $(inputs.params.release_version)-arm64 \ No newline at end of file diff --git a/pipeline.py b/pipeline.py index 0dc90ebb7..6350a757b 100644 --- a/pipeline.py +++ b/pipeline.py @@ -1,6 +1,7 @@ import argparse import json import sys +import subprocess from typing import Dict, Optional from sonar.sonar import process_image @@ -42,18 +43,33 @@ def _build_agent_args(config: DevConfig) -> Dict[str, str]: def build_agent_image_ubi(config: DevConfig) -> None: - image_name = "agent-ubi" args = _build_agent_args(config) args["agent_image"] = config.agent_image_ubi args["agent_image_dev"] = config.agent_dev_image_ubi config.ensure_tag_is_run("ubi") sonar_build_image( - image_name, + "agent-ubi-amd64", + config, + args=args, + ) + sonar_build_image( + "agent-ubi-arm64", config, args=args, ) + create_and_push_manifest(config, config.agent_dev_image_ubi) + + if config.gh_run_id is not None and config.gh_run_id != "": + create_and_push_manifest(config, config.agent_dev_image_ubi, config.gh_run_id) + + if "release" in config.include_tags: + create_and_push_manifest(config, config.agent_image_ubi, args["agent_version"]) + create_and_push_manifest( + config, config.agent_image_ubi, args["agent_version"] + "-context" + ) + def build_agent_image_ubuntu(config: DevConfig) -> None: image_name = "agent-ubuntu" @@ -75,7 +91,22 @@ def build_readiness_probe_image(config: DevConfig) -> None: config.ensure_tag_is_run("ubi") sonar_build_image( - "readiness-probe-init", + "readiness-probe-init-amd64", + config, + args={ + "builder": "true", + "base_image": "registry.access.redhat.com/ubi8/ubi-minimal:latest", + "registry": config.repo_url, + "release_version": release["readiness-probe"], + "readiness_probe_image": config.readiness_probe_image, + "readiness_probe_image_dev": config.readiness_probe_image_dev, + "builder_image": release["golang-builder-image"], + "s3_bucket": config.s3_bucket, + }, + ) + + sonar_build_image( + "readiness-probe-init-arm64", config, args={ "builder": "true", @@ -89,6 +120,23 @@ def build_readiness_probe_image(config: DevConfig) -> None: }, ) + create_and_push_manifest(config, config.readiness_probe_image_dev) + + if config.gh_run_id is not None and config.gh_run_id != "": + create_and_push_manifest( + config, config.readiness_probe_image_dev, config.gh_run_id + ) + + if "release" in config.include_tags: + create_and_push_manifest( + config, config.readiness_probe_image, release["readiness-probe"] + ) + create_and_push_manifest( + config, + config.readiness_probe_image, + release["readiness-probe"] + "-context", + ) + def build_version_post_start_hook_image(config: DevConfig) -> None: release = _load_release() @@ -96,7 +144,7 @@ def build_version_post_start_hook_image(config: DevConfig) -> None: config.ensure_tag_is_run("ubi") sonar_build_image( - "version-post-start-hook-init", + "version-post-start-hook-init-amd64", config, args={ "builder": "true", @@ -110,12 +158,44 @@ def build_version_post_start_hook_image(config: DevConfig) -> None: }, ) + sonar_build_image( + "version-post-start-hook-init-arm64", + config, + args={ + "builder": "true", + "base_image": "registry.access.redhat.com/ubi8/ubi-minimal:latest", + "registry": config.repo_url, + "release_version": release["version-upgrade-hook"], + "version_post_start_hook_image": config.version_upgrade_hook_image, + "version_post_start_hook_image_dev": config.version_upgrade_hook_image_dev, + "builder_image": release["golang-builder-image"], + "s3_bucket": config.s3_bucket, + }, + ) + + create_and_push_manifest(config, config.version_upgrade_hook_image_dev) + + if config.gh_run_id is not None and config.gh_run_id != "": + create_and_push_manifest( + config, config.version_upgrade_hook_image_dev, config.gh_run_id + ) + + if "release" in config.include_tags: + create_and_push_manifest( + config, config.version_upgrade_hook_image, release["version-upgrade-hook"] + ) + create_and_push_manifest( + config, + config.version_upgrade_hook_image, + release["version-upgrade-hook"] + "-context", + ) + def build_operator_ubi_image(config: DevConfig) -> None: release = _load_release() config.ensure_tag_is_run("ubi") sonar_build_image( - "operator-ubi", + "operator-ubi-amd64", config, args={ "registry": config.repo_url, @@ -129,12 +209,52 @@ def build_operator_ubi_image(config: DevConfig) -> None: }, inventory="inventories/operator-inventory.yaml", ) + sonar_build_image( + "operator-ubi-arm64", + config, + args={ + "registry": config.repo_url, + "builder": "true", + "builder_image": release["golang-builder-image"], + "base_image": "registry.access.redhat.com/ubi8/ubi-minimal:latest", + "operator_image": config.operator_image, + "operator_image_dev": config.operator_image_dev, + "release_version": release["mongodb-kubernetes-operator"], + "s3_bucket": config.s3_bucket, + }, + inventory="inventories/operator-inventory.yaml", + ) + + create_and_push_manifest(config, config.operator_image_dev) + + if config.gh_run_id is not None and config.gh_run_id != "": + create_and_push_manifest(config, config.operator_image_dev, config.gh_run_id) + + if "release" in config.include_tags: + create_and_push_manifest( + config, config.operator_image, release["mongodb-kubernetes-operator"] + ) + create_and_push_manifest( + config, + config.operator_image, + release["mongodb-kubernetes-operator"] + "-context", + ) def build_e2e_image(config: DevConfig) -> None: release = _load_release() sonar_build_image( - "e2e", + "e2e-arm64", + config, + args={ + "registry": config.repo_url, + "base_image": release["golang-builder-image"], + "e2e_image": config.e2e_image, + }, + inventory="inventories/e2e-inventory.yaml", + ) + sonar_build_image( + "e2e-amd64", config, args={ "registry": config.repo_url, @@ -144,6 +264,57 @@ def build_e2e_image(config: DevConfig) -> None: inventory="inventories/e2e-inventory.yaml", ) + create_and_push_manifest(config, config.e2e_image) + + if config.gh_run_id is not None and config.gh_run_id != "": + create_and_push_manifest(config, config.e2e_image, config.gh_run_id) + + +""" +Generates docker manifests by running the following commands: +1. Clear existing manifests +docker manifest rm config.repo_url/image:tag +2. Create the manifest +docker manifest create config.repo_url/image:tag --amend config.repo_url/image:tag-amd64 --amend config.repo_url/image:tag-arm64 +3. Push the manifest +docker manifest push config.repo_url/image:tag +""" + + +def create_and_push_manifest( + config: DevConfig, image: str, tag: str = "latest" +) -> None: + final_manifest = "{0}/{1}:{2}".format(config.repo_url, image, tag) + args = ["docker", "manifest", "rm", final_manifest] + args_str = " ".join(args) + print(f"removing existing manifest: {args_str}") + subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + args = [ + "docker", + "manifest", + "create", + final_manifest, + "--amend", + final_manifest + "-amd64", + "--amend", + final_manifest + "-arm64", + ] + args_str = " ".join(args) + print(f"creating new manifest: {args_str}") + cp = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + if cp.returncode != 0: + raise Exception(cp.stderr) + + args = ["docker", "manifest", "push", final_manifest] + args_str = " ".join(args) + print(f"pushing new manifest: {args_str}") + cp = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + if cp.returncode != 0: + raise Exception(cp.stderr) + def sonar_build_image( image_name: str, @@ -165,6 +336,7 @@ def _parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser() parser.add_argument("--image-name", type=str) parser.add_argument("--release", type=lambda x: x.lower() == "true") + parser.add_argument("--tag", type=str) return parser.parse_args() @@ -184,6 +356,8 @@ def main() -> int: # use the --release flag to run them. config.ensure_skip_tag("release") + config.gh_run_id = args.tag + # specify --release to release the image if args.release: config.ensure_tag_is_run("release") diff --git a/pkg/automationconfig/automation_config_builder.go b/pkg/automationconfig/automation_config_builder.go index 589a56eba..02411c0e1 100644 --- a/pkg/automationconfig/automation_config_builder.go +++ b/pkg/automationconfig/automation_config_builder.go @@ -436,6 +436,18 @@ func buildDummyMongoDbVersionConfig(version string) MongoDbVersionConfig { Flavor: "ubuntu", Modules: []string{}, }, + { + Platform: "linux", + Architecture: "aarch64", + Flavor: "ubuntu", + Modules: []string{}, + }, + { + Platform: "linux", + Architecture: "aarch64", + Flavor: "rhel", + Modules: []string{}, + }, }, } diff --git a/scripts/ci/config.json b/scripts/ci/config.json index ca6a6b292..ce2a8c6ee 100644 --- a/scripts/ci/config.json +++ b/scripts/ci/config.json @@ -1,7 +1,7 @@ { "namespace": "default", "repo_url": "quay.io/mongodb", - "mongodb_image_repo_url": "docker.io/mongodb", + "mongodb_image_repo_url": "quay.io/mongodb", "mongodb_image_name": "mongodb-community-server", "operator_image": "mongodb-kubernetes-operator", "operator_image_dev": "community-operator-dev", diff --git a/scripts/dev/dev_config.py b/scripts/dev/dev_config.py index ccba5eba2..cd7715a25 100644 --- a/scripts/dev/dev_config.py +++ b/scripts/dev/dev_config.py @@ -35,6 +35,7 @@ def __init__(self, config: Dict, distro: Distro): self._distro = distro self.include_tags: List[str] = [] self.skip_tags: List[str] = [] + self.gh_run_id = "" def ensure_tag_is_run(self, tag: str) -> None: if tag not in self.include_tags: @@ -113,7 +114,7 @@ def mongodb_image_name(self) -> str: @property def mongodb_image_repo_url(self) -> str: - return self._config.get("mongodb_image_repo_url", "docker.io/mongodb") + return self._config.get("mongodb_image_repo_url", "quay.io/mongodb") @property def agent_dev_image_ubi(self) -> str: @@ -160,7 +161,7 @@ def _get_dev_image(self, dev_image: str, image: str) -> str: def load_config( - config_file_path: Optional[str] = None, distro: Distro = Distro.UBUNTU + config_file_path: Optional[str] = None, distro: Distro = Distro.UBI ) -> DevConfig: if config_file_path is None: config_file_path = get_config_path() diff --git a/scripts/dev/e2e.py b/scripts/dev/e2e.py index 9336b6fa9..47f539e90 100644 --- a/scripts/dev/e2e.py +++ b/scripts/dev/e2e.py @@ -247,7 +247,7 @@ def parse_args() -> argparse.Namespace: "--distro", help="The distro of images that should be used", type=str, - default="ubuntu", + default="ubi", ) parser.add_argument("--config_file", help="Path to the config file") return parser.parse_args() diff --git a/scripts/dev/templates/Dockerfile.e2e b/scripts/dev/templates/Dockerfile.e2e index 03805305b..ec42f7a05 100644 --- a/scripts/dev/templates/Dockerfile.e2e +++ b/scripts/dev/templates/Dockerfile.e2e @@ -4,9 +4,10 @@ COPY testdata/tls/ testdata/tls/ {% endblock -%} - +ARG TARGETOS +ARG TARGETARCH {% block install_helm -%} -RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" \ +RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/${TARGETOS}/${TARGETARCH}/kubectl" \ && chmod +x ./kubectl \ && mv ./kubectl /usr/local/bin/kubectl \ && curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 \ diff --git a/scripts/dev/templates/Dockerfile.template b/scripts/dev/templates/Dockerfile.template index ce5f06b3c..44320ed8c 100644 --- a/scripts/dev/templates/Dockerfile.template +++ b/scripts/dev/templates/Dockerfile.template @@ -1,8 +1,8 @@ {% if builder %} -FROM {{builder_image}} AS builder +FROM --platform=$TARGETPLATFORM {{builder_image}} AS builder {% else %} -FROM {{base_image}} +FROM --platform=$TARGETPLATFORM {{base_image}} {% endif %} {% block packages -%} diff --git a/scripts/dev/templates/operator/Dockerfile.builder b/scripts/dev/templates/operator/Dockerfile.builder index 08b7e9911..e2d6e092f 100644 --- a/scripts/dev/templates/operator/Dockerfile.builder +++ b/scripts/dev/templates/operator/Dockerfile.builder @@ -1,12 +1,14 @@ ARG builder_image -FROM ${builder_image} AS builder +FROM --platform=$BUILDPLATFORM ${builder_image} AS builder RUN mkdir /workspace WORKDIR /workspace COPY . . -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager cmd/manager/main.go +ARG TARGETOS +ARG TARGETARCH +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o manager cmd/manager/main.go FROM busybox diff --git a/scripts/dev/templates/readiness/Dockerfile.builder b/scripts/dev/templates/readiness/Dockerfile.builder index 1d1b864e5..4887b1a57 100644 --- a/scripts/dev/templates/readiness/Dockerfile.builder +++ b/scripts/dev/templates/readiness/Dockerfile.builder @@ -1,12 +1,14 @@ ARG builder_image -FROM ${builder_image} as builder +FROM --platform=$BUILDPLATFORM ${builder_image} as builder RUN mkdir /workspace WORKDIR /workspace COPY . . -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o readinessprobe cmd/readiness/main.go +ARG TARGETOS +ARG TARGETARCH +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o readinessprobe cmd/readiness/main.go FROM busybox diff --git a/scripts/dev/templates/versionhook/Dockerfile.builder b/scripts/dev/templates/versionhook/Dockerfile.builder index cba7e5cb4..7a75bbfd3 100644 --- a/scripts/dev/templates/versionhook/Dockerfile.builder +++ b/scripts/dev/templates/versionhook/Dockerfile.builder @@ -1,12 +1,14 @@ ARG builder_image -FROM ${builder_image} as builder +FROM --platform=$BUILDPLATFORM ${builder_image} as builder RUN mkdir /workspace WORKDIR /workspace COPY . . -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o version-upgrade-hook cmd/versionhook/main.go +ARG TARGETOS +ARG TARGETARCH +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o version-upgrade-hook cmd/versionhook/main.go FROM busybox diff --git a/test/e2e/setup/test_config.go b/test/e2e/setup/test_config.go index ebf6a59c8..19e7c5d92 100644 --- a/test/e2e/setup/test_config.go +++ b/test/e2e/setup/test_config.go @@ -39,7 +39,7 @@ func LoadTestConfigFromEnv() TestConfig { CertManagerVersion: envvar.GetEnvOrDefault(testCertManagerVersionEnvName, "v1.5.3"), OperatorImage: envvar.GetEnvOrDefault(operatorImageEnvName, "quay.io/mongodb/community-operator-dev:latest"), MongoDBImage: envvar.GetEnvOrDefault(construct.MongodbImageEnv, "mongodb-community-server"), - MongoDBRepoUrl: envvar.GetEnvOrDefault(construct.MongodbRepoUrl, "docker.io/mongodb"), + MongoDBRepoUrl: envvar.GetEnvOrDefault(construct.MongodbRepoUrl, "quay.io/mongodb"), VersionUpgradeHookImage: envvar.GetEnvOrDefault(construct.VersionUpgradeHookImageEnv, "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.2"), AgentImage: envvar.GetEnvOrDefault(construct.AgentImageEnv, "quay.io/mongodb/mongodb-agent:10.29.0.6830-1"), // TODO: better way to decide default agent image. ClusterWide: envvar.ReadBool(clusterWideEnvName),