Skip to content

Commit

Permalink
Provide multi-arch images (#198)
Browse files Browse the repository at this point in the history
* redoing travis pipeline

Signed-off-by: Srikumar Venugopal <[email protected]>

* travis pipeline fixes

Signed-off-by: Srikumar Venugopal <[email protected]>

* changing makefiles for multiarch support

Signed-off-by: Srikumar Venugopal <[email protected]>

* updating gitignore for vscode

Signed-off-by: SRIKUMAR VENUGOPAL <[email protected]>

* changing helm charts to reflect multi-arch

Signed-off-by: SRIKUMAR VENUGOPAL <[email protected]>

* reverting non-privileged test for CSI-S3

Signed-off-by: SRIKUMAR VENUGOPAL <[email protected]>
  • Loading branch information
srikumar003 authored Jul 18, 2022
1 parent 280bbc4 commit 5d90fee
Show file tree
Hide file tree
Showing 15 changed files with 105 additions and 2,460 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ _tmp
*Dockerfile.csi-driver-nfs
*Dockerfile.csi-s3
*s3-secret.yaml
.vscode/*
53 changes: 39 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist: focal
services:
- docker

Expand All @@ -8,6 +9,8 @@ stages:
if: type != pull_request AND tag IS present
- name: build_release_ppc64le
if: type != pull_request AND tag IS present
- name: push_release_multiarch
if: type != pull_request AND tag IS present

- name: build_pr_arm64
if: type = pull_request
Expand All @@ -22,6 +25,8 @@ stages:
if: type != pull_request AND branch = master
- name: build_latest_ppc64le
if: type != pull_request AND branch = master
- name: push_latest_multiarch
if: type != pull_request AND branch = master

matrix:
include:
Expand All @@ -33,9 +38,9 @@ matrix:
arch: arm64
env:
- COMMON_IMAGE_TAG=${TRAVIS_TAG}
- DOCKER_REGISTRY=quay.io/datashim
- DOCKER_REGISTRY=quay.io/datashim-io
install: echo "no install"
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh && ./build_sidecars.sh
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh

- stage: build_release_amd64
services:
Expand All @@ -47,7 +52,7 @@ matrix:
- COMMON_IMAGE_TAG=${TRAVIS_TAG}
- DOCKER_REGISTRY=quay.io/datashim
install: echo "no install"
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh && ./build_sidecars.sh
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh

- stage: build_release_ppc64le
services:
Expand All @@ -56,9 +61,19 @@ matrix:
arch: ppc64le
env:
- COMMON_IMAGE_TAG=${TRAVIS_TAG}
- DOCKER_REGISTRY=quay.io/datashim
- DOCKER_REGISTRY=quay.io/datashim-io
install: echo "no install"
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh && ./build_sidecars.sh
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh

- stage: push_release_multiarch
services:
- docker
os: linux
env:
- DOCKER_REGISTRY=quay.io/datashim-io
script:
- cd build-tools
- make DOCKER_REGISTRY=${DOCKER_REGISTRY} push-multiarch

# pull request stages
- stage: build_pr_arm64
Expand All @@ -69,7 +84,7 @@ matrix:
env:
- COMMON_IMAGE_TAG="pr_${TRAVIS_COMMIT}"
install: echo "no install"
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh && ./build_sidecars.sh
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh

- stage: build_pr_amd64
services:
Expand All @@ -80,7 +95,7 @@ matrix:
env:
- COMMON_IMAGE_TAG="pr_${TRAVIS_COMMIT}"
install: echo "no install"
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh && ./build_sidecars.sh
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh

- stage: build_pr_ppc64le
services:
Expand All @@ -90,7 +105,7 @@ matrix:
env:
- COMMON_IMAGE_TAG="pr_${TRAVIS_COMMIT}"
install: echo "no install"
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh && ./build_sidecars.sh
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh

# master branch stages
- stage: build_latest_arm64
Expand All @@ -99,9 +114,9 @@ matrix:
os: linux
arch: arm64
env:
- DOCKER_REGISTRY=quay.io/datashim
- DOCKER_REGISTRY=quay.io/datashim-io
install: echo "no install"
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh && ./build_sidecars.sh
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh

- stage: build_latest_amd64
services:
Expand All @@ -110,16 +125,26 @@ matrix:
arch: amd64
dist: bionic
env:
- DOCKER_REGISTRY=quay.io/datashim
- DOCKER_REGISTRY=quay.io/datashim-io
install: echo "no install"
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh && ./build_sidecars.sh
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh

- stage: build_latest_ppc64le
services:
- docker
os: linux
arch: ppc64le
env:
- DOCKER_REGISTRY=quay.io/datashim
- DOCKER_REGISTRY=quay.io/datashim-io
install: echo "no install"
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh && ./build_sidecars.sh
script: cd build-tools && ./build_components.sh && ./build_csi_plugins.sh

- stage: push_latest_multiarch
services:
- docker
os: linux
env:
- DOCKER_REGISTRY=quay.io/datashim-io
script:
- cd build-tools
- make DOCKER_REGISTRY=${DOCKER_REGISTRY} push-multiarch
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ manifests:
helm template $(HELM_IMAGE_TAGS) --set global.sidecars.kubeletPath="/var/data/kubelet" --set global.sidecars.kubeletPath="/var/data/kubelet" --namespace=$(DATASET_OPERATOR_NAMESPACE) --name-template=default chart/ > release-tools/manifests/dlf-ibm-k8s.yaml
helm template $(HELM_IMAGE_TAGS) --set global.type="oc" --set csi-h3-chart.enabled="false" --set global.sidecars.kubeletPath="/var/data/kubelet" --namespace=$(DATASET_OPERATOR_NAMESPACE) --name-template=default chart/ > release-tools/manifests/dlf-ibm-oc.yaml
helm template $(HELM_IMAGE_TAGS) --set global.type="oc" --set csi-h3-chart.enabled="false" --namespace=$(DATASET_OPERATOR_NAMESPACE) --name-template=default chart/ > release-tools/manifests/dlf-oc.yaml
helm template $(HELM_IMAGE_TAGS) --set global.arch="arm64" --set csi-h3-chart.enabled="false" --namespace=$(DATASET_OPERATOR_NAMESPACE) --name-template=default chart/ > release-tools/manifests/dlf-arm64.yaml
helm template $(HELM_IMAGE_TAGS) --set global.arch="ppc64le" --set csi-h3-chart.enabled="false" --namespace=$(DATASET_OPERATOR_NAMESPACE) --name-template=default chart/ > release-tools/manifests/dlf-ppc64le.yaml
undeployment:
kubectl delete -f ./release-tools/manifests/dlf.yaml
kubectl label namespace default monitor-pods-datasets-
Expand Down
14 changes: 10 additions & 4 deletions build-tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,23 @@ build-csi-plugins:
$(call install_local,csi-driver-nfs,$(CSI_NFS_IMAGE))

push-sidecars:
@docker login -u="datashim+myrobot" -p=${DOCKER_TOKEN} quay.io ;\
@docker login -u=${DOCKER_USER} -p=${DOCKER_PASSWORD} quay.io ;\
docker push $(EXTERNAL_PROVISIONER_IMAGE)-$(ARCH) ;\
docker push $(EXTERNAL_ATTACHER_IMAGE)-$(ARCH) ;\
docker push $(NODE_DRIVER_REGISTRAR_IMAGE)-$(ARCH)

push-components:
@docker login -u="datashim+myrobot" -p=${DOCKER_TOKEN} quay.io ;\
@docker login -u=${DOCKER_USER} -p=${DOCKER_PASSWORD} quay.io ;\
docker push $(DATASET_OPERATOR_IMAGE)-$(ARCH) ;\
docker push $(GENERAGE_KEYS_IMAGE)-$(ARCH)
docker push $(GENERATE_KEYS_IMAGE)-$(ARCH)

push-csi-plugins:
@docker login -u="datashim+myrobot" -p=${DOCKER_TOKEN} quay.io ;\
@docker login -u=${DOCKER_USER} -p=${DOCKER_PASSWORD} quay.io ;\
docker push $(CSI_S3_IMAGE)-$(ARCH) ;\
docker push $(CSI_NFS_IMAGE)-$(ARCH)

push-multiarch:
$(call generate_push_multi_arch_manifest,$(DATASET_OPERATOR_IMAGE))
$(call generate_push_multi_arch_manifest,$(GENERATE_KEYS_IMAGE))
$(call generate_push_multi_arch_manifest,$(CSI_S3_IMAGE))
$(call generate_push_multi_arch_manifest,$(CSI_NFS_IMAGE))
11 changes: 11 additions & 0 deletions build-tools/helpers.mk
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,14 @@ endef
define install_local
cd ../src/$(1) && make container -e IMAGE_TAG=$(2)-$(ARCH) -e ARCH=$(ARCH)
endef

define generate_push_multi_arch_manifest
@export DOCKER_CLI_EXPERIMENTAL=enabled ;\
echo "generating multiarch for"+$(1) ;\
docker login -u=${DOCKER_USER} -p=${DOCKER_PASSWORD} quay.io ;\
docker manifest create $(1) $(1)-amd64 $(1)-arm64 $(1)-ppc64le ;\
docker manifest annotate $(1) $(1)-amd64 --arch amd64 ;\
docker manifest annotate $(1) $(1)-arm64 --arch arm64 ;\
docker manifest annotate $(1) $(1)-ppc64le --arch ppc64le ;\
docker manifest push $(1)
endef
Loading

0 comments on commit 5d90fee

Please sign in to comment.