From 1cfbf9e51a100e75c93079c9d36ce5e2d7f623dd Mon Sep 17 00:00:00 2001 From: Ahmed Kadri Date: Thu, 16 May 2024 14:52:45 +0200 Subject: [PATCH 1/3] Update Helm binary --- Dockerfile | 13 +++++++++---- Makefile | 21 ++++++++++++--------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 62c15364a..fddfd9204 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,13 @@ ARG BUILDER_GOLANG_VERSION +ARG BUILDER_3RDPARTY_VERSION # Build the manager binary +FROM --platform=$TARGETPLATFORM gcr.io/spectro-images-public/builders/spectro-third-party:${BUILDER_3RDPARTY_VERSION} as thirdparty FROM --platform=linux/amd64 gcr.io/spectro-images-public/golang:${BUILDER_GOLANG_VERSION}-alpine as builder -ARG HELM=./bin/helm-linux-amd64 -ARG HELM_CHART=./bin/vcluster-0.19.5.tgz +ENV BIN_TYPE=${CRYPTO_LIB:+vertex} +ENV BIN_TYPE=${BIN_TYPE:-palette} + +ARG HELM_CHART=./bin/vcluster-0.18.1.tgz ARG TARGETOS ARG TARGETARCH @@ -11,7 +15,8 @@ WORKDIR /workspace # Copy binaries COPY ${HELM} helm -COPY ${HELM_CHART} vcluster-0.19.5.tgz +COPY --from=thirdparty /binaries/helm/latest/$BIN_TYPE/$TARGETARCH/helm /binaries/helm +COPY ${HELM_CHART} vcluster-0.18.1.tgz # Install Delve for debugging RUN if [ "${TARGETARCH}" = "amd64" ]; then go install github.com/go-delve/delve/cmd/dlv@latest; fi @@ -39,7 +44,7 @@ FROM --platform=linux/amd64 gcr.io/distroless/static:nonroot WORKDIR / COPY --from=builder /workspace/manager . COPY --from=builder /workspace/helm . -COPY --from=builder /workspace/vcluster-0.19.5.tgz . +COPY --from=builder /workspace/vcluster-0.18.1.tgz . USER 65532:65532 ENTRYPOINT ["/manager"] diff --git a/Makefile b/Makefile index 09c485305..99ed0f5e8 100644 --- a/Makefile +++ b/Makefile @@ -3,20 +3,23 @@ .DEFAULT_GOAL:=help +VERSION_SUFFIX ?= -dev +PROD_VERSION ?= 4.4.0${VERSION_SUFFIX} BUILDER_GOLANG_VERSION ?= 1.22 +BUILDER_3RDPARTY_VERSION ?= $(shell echo $(PROD_VERSION) | cut -d. -f1,2) BUILD_DATE:=$(shell date +%Y%m%d) IMG_NAME ?= cluster-api-virtual-controller # IMG_URL ?= gcr.io/spectro-images-public/release/cluster-api-virtual/ IMG_URL ?= gcr.io/spectro-common-dev/${USER}/cluster-api-virtual IMG_TAG ?= v0.1.3-spectro-${BUILD_DATE} IMG ?= $(IMG_URL)/$(IMG_NAME):$(IMG_TAG) -BUILD_ARGS = --build-arg CRYPTO_LIB=${FIPS_ENABLE} --build-arg BUILDER_GOLANG_VERSION=${BUILDER_GOLANG_VERSION} +BUILD_ARGS = --build-arg CRYPTO_LIB=${FIPS_ENABLE} --build-arg BUILDER_GOLANG_VERSION=${BUILDER_GOLANG_VERSION} --build-arg BUILDER_3RDPARTY_VERSION=${BUILDER_3RDPARTY_VERSION} # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.23 # HELM_VERSION = 3.12.0 HELM_VERSION = 3.11.2-20230627 -VCLUSTER_CHART_VERSION = 0.19.5 +VCLUSTER_CHART_VERSION = 0.18.1 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) @@ -181,18 +184,18 @@ binaries: helm download-chart ## Download binaries .PHONY: helm helm: bin-dir + if ! test -f $(BIN_DIR)/helm-linux-amd64; then \ + curl -L https://github.com/spectrocloud/helm/releases/download/v3.11.2-20230627/helm_v3.11.2-20230627_linux_amd64.tar.gz | tar xz; \ + mv linux-amd64/helm $(BIN_DIR)/helm-linux-amd64; \ + chmod +x $(BIN_DIR)/helm-linux-amd64; \ + rm -rf ./linux-amd64/; \ + fi if ! test -f $(BIN_DIR)/helm-$(GOOS)-$(GOARCH); then \ - curl -Ls https://github.com/spectrocloud/helm/releases/download/v$(HELM_VERSION)/helm_v$(HELM_VERSION)_$(GOOS)_$(GOARCH).tar.gz | tar -xz; \ + curl -L https://github.com/spectrocloud/helm/releases/download/v3.11.2-20230627/helm_v3.11.2-20230627_$(GOOS)_$(GOARCH).tar.gz | tar xz; \ mv $(GOOS)-$(GOARCH)/helm $(BIN_DIR)/helm-$(GOOS)-$(GOARCH); \ chmod +x $(BIN_DIR)/helm-$(GOOS)-$(GOARCH); \ rm -rf ./$(GOOS)-$(GOARCH)/; \ fi - if ! test -f $(BIN_DIR)/helm-linux-amd64; then \ - curl -Ls https://github.com/spectrocloud/helm/releases/download/v$(HELM_VERSION)/helm_v$(HELM_VERSION)_linux_amd64.tar.gz | tar -xz; \ - mv linux-amd64/helm $(BIN_DIR)/helm-linux-amd64; \ - chmod +x $(BIN_DIR)/helm-linux-amd64; \ - rm -rf ./linux-amd64; \ - fi HELM=$(BIN_DIR)/helm-$(GOOS)-$(GOARCH) .PHONY: download-chart From df4929f3334b095056121606ff79201e28f92a8b Mon Sep 17 00:00:00 2001 From: Ahmed Kadri Date: Thu, 16 May 2024 18:27:04 +0200 Subject: [PATCH 2/3] Update Helm binary --- Dockerfile | 1 - Makefile | 28 ++++++---------------------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index fddfd9204..f6c00f80c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,6 @@ FROM --platform=linux/amd64 gcr.io/spectro-images-public/golang:${BUILDER_GOLANG ENV BIN_TYPE=${CRYPTO_LIB:+vertex} ENV BIN_TYPE=${BIN_TYPE:-palette} -ARG HELM_CHART=./bin/vcluster-0.18.1.tgz ARG TARGETOS ARG TARGETARCH diff --git a/Makefile b/Makefile index 99ed0f5e8..0cb146b79 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ VERSION_SUFFIX ?= -dev PROD_VERSION ?= 4.4.0${VERSION_SUFFIX} BUILDER_GOLANG_VERSION ?= 1.22 +TARGETARCH ?= amd64 BUILDER_3RDPARTY_VERSION ?= $(shell echo $(PROD_VERSION) | cut -d. -f1,2) BUILD_DATE:=$(shell date +%Y%m%d) IMG_NAME ?= cluster-api-virtual-controller @@ -13,7 +14,7 @@ IMG_NAME ?= cluster-api-virtual-controller IMG_URL ?= gcr.io/spectro-common-dev/${USER}/cluster-api-virtual IMG_TAG ?= v0.1.3-spectro-${BUILD_DATE} IMG ?= $(IMG_URL)/$(IMG_NAME):$(IMG_TAG) -BUILD_ARGS = --build-arg CRYPTO_LIB=${FIPS_ENABLE} --build-arg BUILDER_GOLANG_VERSION=${BUILDER_GOLANG_VERSION} --build-arg BUILDER_3RDPARTY_VERSION=${BUILDER_3RDPARTY_VERSION} +BUILD_ARGS = --build-arg CRYPTO_LIB=${FIPS_ENABLE} --build-arg BUILDER_GOLANG_VERSION=${BUILDER_GOLANG_VERSION} --build-arg BUILDER_3RDPARTY_VERSION=${BUILDER_3RDPARTY_VERSION} --platform linux/${TARGETARCH} # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.23 @@ -177,28 +178,11 @@ release: manifests kustomize ## Builds the manifests to publish with a release. ##@ Binaries .PHONY: binaries -binaries: helm download-chart ## Download binaries - -# curl -L https://get.helm.sh/helm-v$(HELM_VERSION)-$(GOOS)-$(GOARCH).tar.gz | tar xz; \ -# curl -L https://get.helm.sh/helm-v$(HELM_VERSION)-linux-amd64.tar.gz | tar xz; \ - -.PHONY: helm -helm: bin-dir - if ! test -f $(BIN_DIR)/helm-linux-amd64; then \ - curl -L https://github.com/spectrocloud/helm/releases/download/v3.11.2-20230627/helm_v3.11.2-20230627_linux_amd64.tar.gz | tar xz; \ - mv linux-amd64/helm $(BIN_DIR)/helm-linux-amd64; \ - chmod +x $(BIN_DIR)/helm-linux-amd64; \ - rm -rf ./linux-amd64/; \ - fi - if ! test -f $(BIN_DIR)/helm-$(GOOS)-$(GOARCH); then \ - curl -L https://github.com/spectrocloud/helm/releases/download/v3.11.2-20230627/helm_v3.11.2-20230627_$(GOOS)_$(GOARCH).tar.gz | tar xz; \ - mv $(GOOS)-$(GOARCH)/helm $(BIN_DIR)/helm-$(GOOS)-$(GOARCH); \ - chmod +x $(BIN_DIR)/helm-$(GOOS)-$(GOARCH); \ - rm -rf ./$(GOOS)-$(GOARCH)/; \ - fi +binaries: download-chart ## Download binaries + HELM=$(BIN_DIR)/helm-$(GOOS)-$(GOARCH) -.PHONY: download-chart -download-chart: helm ## Download vcluster chart +.PHONY: download-chart +download-chart: ## Download vcluster chart $(HELM) repo add loft https://charts.loft.sh $(HELM) pull loft/vcluster --version $(VCLUSTER_CHART_VERSION) -d $(BIN_DIR) \ No newline at end of file From bf07237df7b7cfe033aa31928c6876e6594a8dc1 Mon Sep 17 00:00:00 2001 From: Ahmed Kadri Date: Thu, 16 May 2024 19:08:42 +0200 Subject: [PATCH 3/3] Update Helm binary --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0cb146b79..b3554ebf9 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ IMG_NAME ?= cluster-api-virtual-controller IMG_URL ?= gcr.io/spectro-common-dev/${USER}/cluster-api-virtual IMG_TAG ?= v0.1.3-spectro-${BUILD_DATE} IMG ?= $(IMG_URL)/$(IMG_NAME):$(IMG_TAG) -BUILD_ARGS = --build-arg CRYPTO_LIB=${FIPS_ENABLE} --build-arg BUILDER_GOLANG_VERSION=${BUILDER_GOLANG_VERSION} --build-arg BUILDER_3RDPARTY_VERSION=${BUILDER_3RDPARTY_VERSION} --platform linux/${TARGETARCH} +BUILD_ARGS = --build-arg CRYPTO_LIB=${FIPS_ENABLE} --build-arg BUILDER_GOLANG_VERSION=${BUILDER_GOLANG_VERSION} --build-arg BUILDER_3RDPARTY_VERSION=${BUILDER_3RDPARTY_VERSION} # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.23 @@ -95,7 +95,7 @@ run: manifests generate fmt vet ## Run a controller from your host. .PHONY: docker-build docker-build: binaries ## Build docker image with the manager. - docker build ${BUILD_ARGS} -t ${IMG} . + docker build --platform linux/${TARGETARCH} ${BUILD_ARGS} -t ${IMG} . .PHONY: docker-push docker-push: ## Push docker image with the manager.