@@ -24,6 +24,11 @@ GOBIN_DIR=$(abspath ./bin )
2424PATH := $(GOBIN_DIR ) :$(TOOLS_GOBIN_DIR ) :$(PATH )
2525TMPDIR := $(shell mktemp -d)
2626
27+ # Image build configuration
28+ # REV is the short git sha of latest commit.
29+ REV ?= $(shell git rev-parse --short HEAD)
30+ IMAGE_REPO ?= kube-bind
31+
2732# Detect the path used for the install target
2833ifeq (,$(shell go env GOBIN) )
2934INSTALL_GOBIN =$(shell go env GOPATH) /bin
@@ -291,25 +296,10 @@ CONTRIBS_E2E := $(patsubst %,test-e2e-contrib-%,$(CONTRIBS))
291296.PHONY : test-e2e-contribs $(CONTRIBS_E2E )
292297test-e2e-contribs : $(CONTRIBS_E2E ) # # Run e2e tests for external integrations
293298
294- .PHONY : test-e2e-contrib-kcp
295299test-e2e-contrib-kcp : $(DEX ) $(KCP )
296300$(CONTRIBS_E2E ) :
297301 cd contrib/$(patsubst test-e2e-contrib-% ,% ,$@ ) && $(GO_TEST ) -race -count $(COUNT ) $(E2E_PARALLELISM_FLAG ) ./test/e2e/...
298302
299- DESTROY_KIND_CLUSTER ?= true
300- REUSE_KIND_CLUSTER_SUFFIX ?= ""
301- KIND_CLUSTER_NAME ?= kube-bind
302-
303- .PHONY : test-e2e-kind
304- test-e2e-kind : build image-local
305- echo " Running kube-bind e2e tests"
306- KUBE_BIND_BACKEND_IMAGE=$(KO_DOCKER_REPO ) /backend:$(REV ) \
307- KUBE_BIND_KONNECTOR_IMAGE=$(KO_DOCKER_REPO ) /konnector:$(REV ) \
308- $(GO_TEST ) -v ./test/e2e-kind/... \
309- -destroy-kind-cluster=$(DESTROY_KIND_CLUSTER ) \
310- -collect-logs=true
311- echo " Kube-bind e2e tests completed"
312-
313303.PHONY : test
314304ifdef USE_GOTESTSUM
315305test : $(GOTESTSUM )
@@ -385,32 +375,29 @@ deploy-docs: venv ## Deploy docs
385375 . $(VENV ) /activate; \
386376 REMOTE=$(REMOTE ) BRANCH=$(BRANCH ) docs/scripts/deploy-docs.sh
387377
388- # Image build configuration
389- # REV is the short git sha of latest commit.
390- REV =$(shell git rev-parse --short HEAD)
391- KIND_CLUSTER ?= backend
392- KO_DOCKER_REPO ?= kube-bind
393-
378+ # Example: make IMAGE_REPO=ghcr.io/<username> image-local
394379.PHONY : image-local
395380image-local :
396381 @echo " Building images locally with tag $( REV) "
397382 @command -v ko > /dev/null 2>&1 || { echo " ko not found. Install with: go install github.com/google/ko@latest" ; exit 1; }
398383
399384 @echo "Building konnector image locally..."
400- KO_DOCKER_REPO=$(KO_DOCKER_REPO ) ko build \
385+ KO_DOCKER_REPO=$(IMAGE_REPO ) ko build \
401386 --local \
402387 -B \
403388 -t $(REV) \
404389 ./cmd/konnector
405390
406391 @echo "Building backend image locally..."
407- KO_DOCKER_REPO=$(KO_DOCKER_REPO ) ko build \
392+ KO_DOCKER_REPO=$(IMAGE_REPO ) ko build \
408393 --local \
409394 -B \
410395 -t $(REV) \
411396 ./cmd/backend
412397
413- @echo "Successfully built local images with tag $(REV)"
398+ @echo "Successfully built local images:"
399+ @echo " $(IMAGE_REPO)/konnector:$(REV)"
400+ @echo " $(IMAGE_REPO)/backend:$(REV)"
414401
415402.PHONY : kind-load
416403kind-load :
@@ -419,4 +406,67 @@ kind-load:
419406 kind load docker-image $(KO_DOCKER_REPO ) /backend:$(REV ) --name $(KIND_CLUSTER )
420407 @echo " Successfully loaded images into kind cluster '$( KIND_CLUSTER) '"
421408
409+ .PHONY : helm-build-local
410+ helm-build-local : # # Build and package Helm charts locally for testing
411+ @echo " Building Helm charts locally..."
412+ @command -v helm > /dev/null 2>&1 || { echo " helm not found. Install from: https://helm.sh/docs/intro/install/" ; exit 1; }
413+
414+ @# Set chart version to semver format for local builds (0.0.0-<git-sha>)
415+ CHART_VERSION=" 0.0.0-$( REV) " ; \
416+ for chart_dir in deploy/charts/* /; do \
417+ if [ -f " $$ {chart_dir}Chart.yaml" ]; then \
418+ chart_name=$$(basename "$$chart_dir") ; \
419+ echo " Processing chart: $$ chart_name" ; \
420+ \
421+ cp " $$ {chart_dir}Chart.yaml" " $$ {chart_dir}Chart.yaml.bak" ; \
422+ sed -i.tmp " s/^version:.*/version: $$ CHART_VERSION/" " $$ {chart_dir}Chart.yaml" ; \
423+ sed -i.tmp " s/^appVersion:.*/appVersion: $$ CHART_VERSION/" " $$ {chart_dir}Chart.yaml" ; \
424+ rm -f " $$ {chart_dir}Chart.yaml.tmp" ; \
425+ \
426+ helm package " $$ chart_dir" --version " $$ CHART_VERSION" --destination ./bin/; \
427+ echo " Packaged: ./bin/$$ chart_name-$$ CHART_VERSION.tgz" ; \
428+ \
429+ mv " $$ {chart_dir}Chart.yaml.bak" " $$ {chart_dir}Chart.yaml" ; \
430+ fi ; \
431+ done
432+ @echo " Helm charts built successfully in ./bin/"
433+
434+ .PHONY : helm-clean
435+ helm-clean : # # Clean up built helm charts
436+ rm -f ./bin/* .tgz
437+
438+ .PHONY : helm-push-local
439+ helm-push-local : # # Push Helm charts to IMAGE_REPO registry
440+ @echo " Pushing Helm charts to registry: $( IMAGE_REPO) "
441+ @command -v helm > /dev/null 2>&1 || { echo " helm not found. Install from: https://helm.sh/docs/intro/install/" ; exit 1; }
442+
443+ CHART_VERSION=" 0.0.0-$( REV) " ; \
444+ export HELM_EXPERIMENTAL_OCI=1; \
445+ for chart_file in ./bin/* -$$ CHART_VERSION.tgz; do \
446+ if [ -f " $$ chart_file" ]; then \
447+ chart_filename=$$(basename "$$chart_file") ; \
448+ chart_name=$$ {chart_filename%-$$ CHART_VERSION.tgz}; \
449+ if [[ " $$ chart_name" =~ [[:space:]] ]]; then \
450+ echo " Skipping chart with invalid name: '$$ chart_name' (contains spaces)" ; \
451+ continue ; \
452+ fi ; \
453+ echo " Pushing $$ chart_name to $( IMAGE_REPO) " ; \
454+ helm push " $$ chart_file" " oci://$( IMAGE_REPO) /charts" ; \
455+ echo " Chart available at: oci://$( IMAGE_REPO) /charts/$$ chart_name:$$ CHART_VERSION" ; \
456+ fi ; \
457+ done
458+
459+ .PHONY : helm-test
460+ helm-test : helm-build-local # # Test Helm chart installation (dry-run)
461+ @echo " Testing Helm chart installation..."
462+ CHART_VERSION=" 0.0.0-$( REV) " ; \
463+ for chart_dir in deploy/charts/* /; do \
464+ if [ -f " $$ {chart_dir}Chart.yaml" ]; then \
465+ chart_name=$$(basename "$$chart_dir") ; \
466+ echo " Testing chart: $$ chart_name" ; \
467+ helm install test-$$ chart_name " ./bin/$$ chart_name-$$ CHART_VERSION.tgz" --dry-run --debug; \
468+ echo " ✓ Chart $$ chart_name passes dry-run test" ; \
469+ fi ; \
470+ done
471+
422472include Makefile.venv
0 commit comments