Skip to content

Commit

Permalink
chore: add helm install (#323)
Browse files Browse the repository at this point in the history
**Commit Message**

Add helm install.

**Related Issues/PRs (if applicable)**

Fixes #302

---------

Signed-off-by: Loong <long0dai@foxmail.com>
  • Loading branch information
daixiang0 authored Feb 12, 2025
1 parent 7c269de commit 4649ba3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
16 changes: 5 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ test-controller: envtest apigen
#
# This requires the docker images to be built.
.PHONY: test-e2e
test-e2e: kind
test-e2e: helm kind
@$(MAKE) docker-build DOCKER_BUILD_ARGS="--load"
@$(MAKE) docker-build.testupstream CMD_PATH_PREFIX=tests/internal/testupstreamlib DOCKER_BUILD_ARGS="--load"
@echo "Run E2E tests"
Expand Down Expand Up @@ -250,26 +250,20 @@ docker-build:
HELM_DIR := ./manifests/charts/ai-gateway-helm

# This lints the helm chart, ensuring that it is for packaging.
#
# This uses the locally installed helm binary (TODO make helm installed via Makefile.tools.mk).
.PHONY: helm-lint
helm-lint:
helm-lint: helm
@echo "helm-lint => .${HELM_DIR}"
@helm lint ${HELM_DIR}
@$(HELM) lint ${HELM_DIR}

# This packages the helm chart into a tgz file, ready for deployment as well as for pushing to the OCI registry.
# This must pass before `helm-push` can be run as well as on any commit.
#
# This uses the locally installed helm binary (TODO make helm installed via Makefile.tools.mk).
.PHONY: helm-package
helm-package: helm-lint
@echo "helm-package => ${HELM_DIR}"
@helm package ${HELM_DIR} --version ${HELM_CHART_VERSION} -d ${OUTPUT_DIR}
@$(HELM) package ${HELM_DIR} --version ${HELM_CHART_VERSION} -d ${OUTPUT_DIR}

# This pushes the helm chart to the OCI registry, requiring the access to the registry endpoint.
#
# This uses the locally installed helm binary (TODO make helm installed via Makefile.tools.mk).
.PHONY: helm-push
helm-push: helm-package
@echo "helm-push => .${HELM_DIR}"
@helm push ${OUTPUT_DIR}/ai-gateway-helm-${HELM_CHART_VERSION}.tgz oci://${OCI_REGISTRY}
@$(HELM) push ${OUTPUT_DIR}/ai-gateway-helm-${HELM_CHART_VERSION}.tgz oci://${OCI_REGISTRY}
8 changes: 8 additions & 0 deletions Makefile.tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ YAMLLINT = $(LOCALBIN)/.venv/yamllint@1.35.1/bin/yamllint
KIND ?= $(LOCALBIN)/kind
CRD_REF_DOCS = $(LOCALBIN)/crd-ref-docs
GO_TEST_COVERAGE ?= $(LOCALBIN)/go-test-coverage
HELM ?= $(LOCALBIN)/helm

## Tool versions.
# Note: Ensure no blank after version and no comments, or the version value would have a blank as suffix.
Expand All @@ -35,6 +36,8 @@ KIND_VERSION ?= v0.26.0
CRD_REF_DOCS_VERSION ?= v0.1.0
# https://github.com/vladopajic/go-test-coverage/releases
GO_TEST_COVERAGE_VERSION ?= v2.11.4
# https://github.com/helm/helm/releases
HELM_VERSION ?= v3.17.0

.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT)
Expand Down Expand Up @@ -81,6 +84,11 @@ go-test-coverage: $(GO_TEST_COVERAGE)
$(GO_TEST_COVERAGE): $(LOCALBIN)
$(call go-install-tool,$(GO_TEST_COVERAGE),github.com/vladopajic/go-test-coverage/v2,$(GO_TEST_COVERAGE_VERSION))

.PHONY: helm
helm: $(HELM)
$(HELM): $(LOCALBIN)
$(call go-install-tool,$(HELM),helm.sh/helm/v3/cmd/helm,$(HELM_VERSION))

.bin/.venv/%:
mkdir -p $(@D)
python3 -m venv $@
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const (
egLatest = "v0.0.0-latest" // This defaults to the latest dev version.
egNamespace = "envoy-gateway-system"
egDefaultPort = 10080

helmPath = "../../.bin/helm"
)

var egVersion = func() string {
Expand Down Expand Up @@ -126,7 +128,7 @@ func initEnvoyGateway(ctx context.Context) (err error) {
initLog(fmt.Sprintf("\tdone (took %.2fs in total)", elapsed.Seconds()))
}()
initLog("\tHelm Install")
helm := exec.CommandContext(ctx, "helm", "upgrade", "-i", "eg",
helm := exec.CommandContext(ctx, helmPath, "upgrade", "-i", "eg",
"oci://docker.io/envoyproxy/gateway-helm", "--version", egVersion,
"-n", "envoy-gateway-system", "--create-namespace")
helm.Stdout = os.Stdout
Expand Down Expand Up @@ -155,7 +157,7 @@ func initAIGateway(ctx context.Context) (err error) {
initLog(fmt.Sprintf("\tdone (took %.2fs in total)\n", elapsed.Seconds()))
}()
initLog("\tHelm Install")
helm := exec.CommandContext(ctx, "helm", "upgrade", "-i", "ai-eg",
helm := exec.CommandContext(ctx, helmPath, "upgrade", "-i", "ai-eg",
"../../manifests/charts/ai-gateway-helm",
"-n", "envoy-ai-gateway-system", "--create-namespace")
helm.Stdout = os.Stdout
Expand Down

0 comments on commit 4649ba3

Please sign in to comment.