Skip to content

Commit

Permalink
create multiarch images (gardener#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
reshnm authored Feb 28, 2024
1 parent cdd3478 commit f652b7f
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 30 deletions.
54 changes: 36 additions & 18 deletions .landscaper/components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ components:
- name: helm-deployer-image
type: ociImage
input:
type: docker
path: helm-deployer-controller:${VERSION}
type: dockermulti
variants:
- helm-deployer-controller:${VERSION}-linux-amd64
- helm-deployer-controller:${VERSION}-linux-arm64
repository: images/helm-deployer-controller

- name: github.com/gardener/landscaper/manifest-deployer
Expand Down Expand Up @@ -63,8 +65,10 @@ components:
- name: manifest-deployer-image
type: ociImage
input:
type: docker
path: manifest-deployer-controller:${VERSION}
type: dockermulti
variants:
- manifest-deployer-controller:${VERSION}-linux-amd64
- manifest-deployer-controller:${VERSION}-linux-arm64
repository: images/manifest-deployer-controller

- name: github.com/gardener/landscaper/container-deployer
Expand Down Expand Up @@ -97,20 +101,26 @@ components:
- name: container-deployer-image
type: ociImage
input:
type: docker
path: container-deployer-controller:${VERSION}
type: dockermulti
variants:
- container-deployer-controller:${VERSION}-linux-amd64
- container-deployer-controller:${VERSION}-linux-arm64
repository: images/container-deployer-controller
- name: container-init-image
type: ociImage
input:
type: docker
path: container-deployer-init:${VERSION}
type: dockermulti
variants:
- container-deployer-init:${VERSION}-linux-amd64
- container-deployer-init:${VERSION}-linux-arm64
repository: images/container-deployer-init
- name: container-wait-image
type: ociImage
input:
type: docker
path: container-deployer-wait:${VERSION}
type: dockermulti
variants:
- container-deployer-wait:${VERSION}-linux-amd64
- container-deployer-wait:${VERSION}-linux-arm64
repository: images/container-deployer-wait

- name: github.com/gardener/landscaper/mock-deployer
Expand Down Expand Up @@ -143,8 +153,10 @@ components:
- name: mock-deployer-image
type: ociImage
input:
type: docker
path: mock-deployer-controller:${VERSION}
type: dockermulti
variants:
- mock-deployer-controller:${VERSION}-linux-amd64
- mock-deployer-controller:${VERSION}-linux-arm64
repository: images/mock-deployer-controller

- name: github.com/gardener/landscaper
Expand Down Expand Up @@ -200,18 +212,24 @@ components:
- name: landscaper-controller
type: ociImage
input:
type: docker
path: landscaper-controller:${VERSION}
type: dockermulti
variants:
- landscaper-controller:${VERSION}-linux-amd64
- landscaper-controller:${VERSION}-linux-arm64
repository: images/landscaper-controller
- name: landscaper-webhooks-server
type: ociImage
input:
type: docker
path: landscaper-webhooks-server:${VERSION}
type: dockermulti
variants:
- landscaper-webhooks-server:${VERSION}-linux-amd64
- landscaper-webhooks-server:${VERSION}-linux-arm64
repository: images/landscaper-webhooks-server
- name: landscaper-agent
type: ociImage
input:
type: docker
path: landscaper-agent:${VERSION}
type: dockermulti
variants:
- landscaper-agent:${VERSION}-linux-amd64
- landscaper-agent:${VERSION}-linux-arm64
repository: images/landscaper-agent
35 changes: 24 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ EFFECTIVE_VERSION := $(shell $(REPO_ROOT)/hack/get-

REGISTRY := europe-docker.pkg.dev/sap-gcp-cp-k8s-stable-hub/landscaper
DOCKER_BUILDER_NAME := "ls-multiarch"
DOCKER_PLATFORM := "linux/amd64"
DOCKER_PLATFORM_AMD64 := "linux/amd64"
DOCKER_PLATFORM_ARM64 := "linux/arm64"

DISABLE_CLEANUP := false

Expand Down Expand Up @@ -86,16 +87,28 @@ install:
.PHONY: docker-images
docker-images:
@$(REPO_ROOT)/hack/prepare-docker-builder.sh
@echo "Building docker images for version $(EFFECTIVE_VERSION)"
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM) -t landscaper-controller:$(EFFECTIVE_VERSION) -f Dockerfile --target landscaper-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM) -t landscaper-webhooks-server:$(EFFECTIVE_VERSION) -f Dockerfile --target landscaper-webhooks-server .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM) -t landscaper-agent:$(EFFECTIVE_VERSION) -f Dockerfile --target landscaper-agent .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM) -t container-deployer-controller:$(EFFECTIVE_VERSION) -f Dockerfile --target container-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM) -t container-deployer-init:$(EFFECTIVE_VERSION) -f Dockerfile --target container-deployer-init .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM) -t container-deployer-wait:$(EFFECTIVE_VERSION) -f Dockerfile --target container-deployer-wait .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM) -t helm-deployer-controller:$(EFFECTIVE_VERSION) -f Dockerfile --target helm-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM) -t manifest-deployer-controller:$(EFFECTIVE_VERSION) -f Dockerfile --target manifest-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM) -t mock-deployer-controller:$(EFFECTIVE_VERSION) -f Dockerfile --target mock-deployer-controller .

@echo "Building docker images for version $(EFFECTIVE_VERSION) / $(DOCKER_PLATFORM_AMD64)"
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t landscaper-controller:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target landscaper-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t landscaper-webhooks-server:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target landscaper-webhooks-server .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t landscaper-agent:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target landscaper-agent .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t container-deployer-controller:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target container-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t container-deployer-init:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target container-deployer-init .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t container-deployer-wait:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target container-deployer-wait .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t helm-deployer-controller:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target helm-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t manifest-deployer-controller:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target manifest-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t mock-deployer-controller:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target mock-deployer-controller .

@echo "Building docker images for version $(EFFECTIVE_VERSION) / $(DOCKER_PLATFORM_ARM64)"
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t landscaper-controller:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target landscaper-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t landscaper-webhooks-server:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target landscaper-webhooks-server .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t landscaper-agent:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target landscaper-agent .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t container-deployer-controller:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target container-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t container-deployer-init:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target container-deployer-init .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t container-deployer-wait:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target container-deployer-wait .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t helm-deployer-controller:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target helm-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t manifest-deployer-controller:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target manifest-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t mock-deployer-controller:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target mock-deployer-controller .

.PHONY: component
component:
Expand Down
2 changes: 1 addition & 1 deletion hack/generate-cd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ MOCK_DEPLOYER_CHART_PATH="${SOURCE_PATH}/charts/mock-deployer"
ocm add componentversions --create --file ${COMPONENT_ARCHIVE_PATH} ${SOURCE_PATH}/.landscaper/components.yaml \
-- VERSION=${EFFECTIVE_VERSION} \
COMMIT_SHA=${COMMIT_SHA} \
PROVIDER=${PROVIDER} \
PROVIDER=landscaper.gardener.cloud \
LANDSCAPER_CHART_PATH=${LANDSCAPER_CHART_PATH} \
LANDSCAPER_CONTROLLER_RBAC_CHART_PATH=${LANDSCAPER_CONTROLLER_RBAC_CHART_PATH} \
LANDSCAPER_CONTROLLER_DEPLOYMENT_CHART_PATH=${LANDSCAPER_CONTROLLER_DEPLOYMENT_CHART_PATH} \
Expand Down

0 comments on commit f652b7f

Please sign in to comment.