Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Helm binary #21

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
TylerGillson marked this conversation as resolved.
Show resolved Hide resolved
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"]
33 changes: 10 additions & 23 deletions Makefile
TylerGillson marked this conversation as resolved.
Show resolved Hide resolved
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} --platform linux/${TARGETARCH}
TylerGillson marked this conversation as resolved.
Show resolved Hide resolved

# 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 @@ -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)