Skip to content

Commit

Permalink
Merge pull request #21 from spectrocloud/PSS-23736-2
Browse files Browse the repository at this point in the history
Update Helm binary
  • Loading branch information
a-kad authored May 17, 2024
2 parents ebea9d5 + bf07237 commit 30a5328
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
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 TARGETOS
ARG TARGETARCH

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
Expand Down Expand Up @@ -39,7 +43,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"]
35 changes: 11 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@

.DEFAULT_GOAL:=help

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
# 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))
Expand Down Expand Up @@ -91,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.
Expand Down Expand Up @@ -174,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-$(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; \
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
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)

0 comments on commit 30a5328

Please sign in to comment.