diff --git a/.github/workflows/test-chart.yaml b/.github/workflows/test-chart.yaml new file mode 100644 index 00000000..a7ceed4f --- /dev/null +++ b/.github/workflows/test-chart.yaml @@ -0,0 +1,41 @@ +# validate any chart changes under charts directory +name: Chart Test + +env: + HELM_VERSION: v3.17.3 + +on: + push: + # Exclude branches created by Dependabot to avoid triggering current workflow + # for PRs initiated by Dependabot. + branches-ignore: + - 'dependabot/**' + pull_request: + # paths: + # - "charts/**" + +permissions: + contents: read + +jobs: + chart-lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: install Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Set up Helm + uses: azure/setup-helm@v4 + with: + version: ${{ env.HELM_VERSION }} + + - name: Run test-deploy-with-helm + run: | + make test-deploy-with-helm diff --git a/Makefile b/Makefile index 36169874..0095e000 100644 --- a/Makefile +++ b/Makefile @@ -134,6 +134,9 @@ test-integration: manifests fmt vet envtest ginkgo ## Run integration tests. test-e2e: kustomize manifests fmt vet envtest ginkgo kind-image-build E2E_KIND_NODE_VERSION=$(E2E_KIND_NODE_VERSION) KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) KIND=$(KIND) KUBECTL=$(KUBECTL) KUSTOMIZE=$(KUSTOMIZE) GINKGO=$(GINKGO) USE_EXISTING_CLUSTER=$(USE_EXISTING_CLUSTER) IMAGE_TAG=$(IMG) ENVTEST_LWS_VERSION=$(ENVTEST_LWS_VERSION) ./hack/e2e-test.sh +test-deploy-with-helm: kind-image-build + E2E_KIND_NODE_VERSION=$(E2E_KIND_NODE_VERSION) KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) KIND=$(KIND) KUBECTL=$(KUBECTL) USE_EXISTING_CLUSTER=$(USE_EXISTING_CLUSTER) IMAGE_TAG=$(IMG) LOADER_IMAGE_TAG=${LOADER_IMAGE_TAG} ./hack/test-deploy-with-helm.sh + GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint GOLANGCI_LINT_VERSION ?= v1.63.4 golangci-lint: @@ -258,6 +261,7 @@ $(LOCALBIN): ## Tool Binaries KUBECTL ?= kubectl KUSTOMIZE ?= $(LOCALBIN)/kustomize +HELM_EXT_OPTS ?= CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen ENVTEST ?= $(LOCALBIN)/setup-envtest @@ -316,7 +320,7 @@ helm: manifests kustomize helmify .PHONY: helm-install helm-install: helm - helm upgrade --install llmaz ./chart -f ./chart/values.global.yaml --dependency-update + helm upgrade --install llmaz ./chart -f ./chart/values.global.yaml --dependency-update $(HELM_EXT_OPTS) .PHONY: helm-upgrade helm-upgrade: image-push artifacts helm-install diff --git a/chart/Chart.yaml b/chart/Chart.yaml index ea283e65..dc4c564d 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -27,9 +27,9 @@ dependencies: condition: open-webui.enabled - name: gateway-helm version: 0.0.0-latest - repository: "oci://registry-1.docker.io/envoyproxy/" + repository: "oci://registry-1.docker.io/envoyproxy" condition: envoy-gateway.enabled - name: ai-gateway-helm version: v0.0.0-latest - repository: "oci://registry-1.docker.io/envoyproxy/" + repository: "oci://registry-1.docker.io/envoyproxy" condition: envoy-ai-gateway.enabled diff --git a/hack/test-deploy-with-helm.sh b/hack/test-deploy-with-helm.sh new file mode 100755 index 00000000..3c8f5cdc --- /dev/null +++ b/hack/test-deploy-with-helm.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. + +export CWD=$(pwd) +function cleanup { + if [ $USE_EXISTING_CLUSTER == 'false' ] + then + $KIND delete cluster --name $KIND_CLUSTER_NAME + fi +} +function startup { + if [ $USE_EXISTING_CLUSTER == 'false' ] + then + $KIND create cluster --name $KIND_CLUSTER_NAME --image $E2E_KIND_NODE_VERSION --config ./hack/kind-config.yaml + fi +} +function kind_load { + $KIND load docker-image $IMAGE_TAG --name $KIND_CLUSTER_NAME +} +function deploy { + cd $CWD + HELM_EXT_OPTS='--namespace=llmaz-system --create-namespace --set controllerManager.manager.image.tag=${LOADER_IMAGE_TAG}' make helm-install + $KUBECTL wait --timeout=3m --for=condition=ready pods --namespace=llmaz-system -l app!=certgen + echo "all pods of llmaz-system is ready..." + $KUBECTL get pod -n llmaz-system +} +function deploy_kube_prometheus { + LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name) + curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | $KUBECTL create -f - +} +trap cleanup EXIT +startup +kind_load +deploy_kube_prometheus +deploy