Skip to content

Commit f171386

Browse files
committed
install helm to local bin directory
Avoid installing binaries outside of the driver tree when developers call Helm related build targets and instead keep it local to the repository within bin directory. Signed-off-by: Feruzjon Muyassarov <feruzjon.muyassarov@est.tech>
1 parent 04bf245 commit f171386

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

Makefile

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ KIND_K8S_VERSION ?= v1.36.0
3030
# paths
3131
YQ = $(OUT_DIR)/yq
3232
GOLANGCI_LINT = $(OUT_DIR)/golangci-lint
33+
HELM = $(OUT_DIR)/helm
3334

3435
# disable CGO by default for static binaries
3536
CGO_ENABLED=0
@@ -147,10 +148,10 @@ kind-load-image: build-image ## load the current container image into kind
147148
kind load docker-image ${IMAGE} ${IMAGE_LATEST} --name ${CLUSTER_NAME}
148149

149150
kind-uninstall-cpu-dra: ## remove cpu dra from kind cluster
150-
helm uninstall dra-driver-cpu --namespace kube-system || true
151+
$(HELM) uninstall dra-driver-cpu --namespace kube-system || true
151152

152153
kind-install-cpu-dra: kind-uninstall-cpu-dra build-image kind-load-image ## install on cluster mimicking production settings
153-
helm install dra-driver-cpu ${HELM_CHART} ${HELM_COMMON_ARGS} \
154+
$(HELM) install dra-driver-cpu ${HELM_CHART} ${HELM_COMMON_ARGS} \
154155
--set image.repository=${IMAGE_REPO} \
155156
--set image.tag=${TAG} \
156157
--set image.pullPolicy=IfNotPresent
@@ -177,27 +178,27 @@ endif
177178
> dist/install.yaml
178179
@rm dist/*.part.yaml
179180

180-
manifests: dist ensure-helm ## create the install manifest
181+
manifests: dist install-helm ## create the install manifest
181182
ifeq ($(OVERRIDE_IMAGE),true)
182-
helm template dra-driver-cpu ${HELM_CHART} ${HELM_COMMON_ARGS} \
183+
$(HELM) template dra-driver-cpu ${HELM_CHART} ${HELM_COMMON_ARGS} \
183184
--set podLabels.build=${GIT_VERSION} \
184185
--set image.repository=${IMAGE_REPO} \
185186
--set image.tag=${TAG} \
186187
--set image.pullPolicy=IfNotPresent \
187188
> dist/install.yaml
188189
else
189-
helm template dra-driver-cpu ${HELM_CHART} ${HELM_COMMON_ARGS} \
190+
$(HELM) template dra-driver-cpu ${HELM_CHART} ${HELM_COMMON_ARGS} \
190191
> dist/install.yaml
191192
endif
192193

193-
ci-kind-setup: ensure-kind-node-image ensure-helm build-image build-test-image ## setup a CI cluster from scratch using reserved CPUs
194+
ci-kind-setup: ensure-kind-node-image install-helm build-image build-test-image ## setup a CI cluster from scratch using reserved CPUs
194195
ifneq ($(DRACPU_E2E_VERBOSE),)
195196
@echo "creating a kind cluster for mode=$(DRACPU_E2E_CPU_DEVICE_MODE)"
196197
endif
197198
kind create cluster --name ${CLUSTER_NAME} --image=kindest/node:$(KIND_K8S_VERSION) --config hack/ci/kind-ci.yaml
198199
kubectl label node ${CLUSTER_NAME}-worker node-role.kubernetes.io/worker=''
199200
kind load docker-image --name ${CLUSTER_NAME} ${IMAGE_CI} ${IMAGE_TEST}
200-
helm install dra-driver-cpu ${HELM_CHART} ${HELM_COMMON_ARGS} \
201+
$(HELM) install dra-driver-cpu ${HELM_CHART} ${HELM_COMMON_ARGS} \
201202
--set image.repository=${IMAGE_REPO_CI} \
202203
--set image.tag=${TAG} \
203204
--set image.pullPolicy=IfNotPresent \
@@ -240,8 +241,8 @@ install-yq: $(OUT_DIR) ## make sure the yq tool is available locally
240241
install-golangci-lint: $(OUT_DIR) ## make sure the golangci-lint tool is available locally
241242
@hack/fetch-golangci-lint.sh $(OUT_DIR) $(GOLANGCI_LINT_VERSION)
242243

243-
helm-lint: ## lint helm chart with strict mode
244-
helm lint --strict ${HELM_CHART}
244+
helm-lint: install-helm ## lint helm chart with strict mode
245+
$(HELM) lint --strict ${HELM_CHART}
245246

246247
.PHONY: helm-docs
247248
helm-docs: ## regenerate helm chart README from values.yaml annotations and README.md.gotmpl
@@ -267,20 +268,20 @@ helm-schema-check: helm-schema ## verify values.schema.json is up to date; fails
267268
CHART_REGISTRY?=$(REGISTRY)/$(IMAGE_NAME)/charts
268269
HELM_VERSION_SHA?=a2369ca71c0ef633bf6e4fccd66d634eb379b371 # v3.20.1
269270

270-
.PHONY: ensure-helm
271-
ensure-helm:
272-
@if ! helm version >/dev/null 2>&1; then \
271+
.PHONY: install-helm
272+
install-helm: $(OUT_DIR)
273+
@if ! $(HELM) version >/dev/null 2>&1; then \
273274
echo "Helm not found, installing helm@$(HELM_VERSION_SHA) ..."; \
274-
go install helm.sh/helm/v3/cmd/helm@$(HELM_VERSION_SHA); \
275+
GOBIN=$(OUT_DIR) go install helm.sh/helm/v3/cmd/helm@$(HELM_VERSION_SHA); \
275276
fi
276277

277278
.PHONY: helm-package
278-
helm-package: ensure-helm ## package helm chart for release
279-
helm package ${HELM_CHART} \
279+
helm-package: install-helm ## package helm chart for release
280+
$(HELM) package deployment/helm/dra-driver-cpu \
280281
--version "$(CHART_VERSION)" \
281282
--app-version "$(TAG)" \
282283
--destination $(OUT_DIR)
283284

284285
.PHONY: helm-push
285286
helm-push: helm-package ## push helm chart to OCI registry
286-
helm push $(OUT_DIR)/dra-driver-cpu-$(CHART_VERSION).tgz oci://$(CHART_REGISTRY)
287+
$(HELM) push $(OUT_DIR)/dra-driver-cpu-$(CHART_VERSION).tgz oci://$(CHART_REGISTRY)

0 commit comments

Comments
 (0)