Skip to content

Commit

Permalink
CLOUDP-82639: ARM support (#1361)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
lucian-tosa and Julien-Ben authored Oct 10, 2023
1 parent c1fd94a commit 1f9193a
Show file tree
Hide file tree
Showing 26 changed files with 729 additions and 65 deletions.
1 change: 1 addition & 0 deletions .action_templates/e2e-fork-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .action_templates/e2e-pr-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .action_templates/e2e-single-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }}"
2 changes: 2 additions & 0 deletions .action_templates/steps/set-up-qemu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
5 changes: 4 additions & 1 deletion .github/workflows/e2e-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/e2e-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion deploy/openshift/operator_openshift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/install-upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
39 changes: 36 additions & 3 deletions inventories/e2e-inventory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,40 @@ vars:
registry: <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
Expand Down Expand Up @@ -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

130 changes: 122 additions & 8 deletions inventories/operator-inventory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ vars:
registry: <registry>

images:
- name: operator-ubi
- name: operator-ubi-amd64
vars:
context: .
template_context: scripts/dev/templates/operator
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Loading

0 comments on commit 1f9193a

Please sign in to comment.