Skip to content

Commit 7cc7efd

Browse files
committed
chore: add ci to test deploy with helm
Signed-off-by: Lan Liang <[email protected]>
1 parent 020b97d commit 7cc7efd

File tree

4 files changed

+88
-3
lines changed

4 files changed

+88
-3
lines changed

.github/workflows/test-chart.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# validate any chart changes under charts directory
2+
name: Chart Test
3+
4+
env:
5+
HELM_VERSION: v3.17.3
6+
7+
on:
8+
push:
9+
# Exclude branches created by Dependabot to avoid triggering current workflow
10+
# for PRs initiated by Dependabot.
11+
branches-ignore:
12+
- 'dependabot/**'
13+
pull_request:
14+
# paths:
15+
# - "charts/**"
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
chart-lint-test:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: install Go
30+
uses: actions/setup-go@v5
31+
with:
32+
go-version-file: go.mod
33+
34+
- name: Set up Helm
35+
uses: azure/setup-helm@v4
36+
with:
37+
version: ${{ env.HELM_VERSION }}
38+
39+
- name: Run test-deploy-with-helm
40+
run: |
41+
make test-deploy-with-helm

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ test-integration: manifests fmt vet envtest ginkgo ## Run integration tests.
134134
test-e2e: kustomize manifests fmt vet envtest ginkgo kind-image-build
135135
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
136136

137+
test-deploy-with-helm: kind-image-build
138+
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
139+
137140
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
138141
GOLANGCI_LINT_VERSION ?= v1.63.4
139142
golangci-lint:
@@ -258,6 +261,7 @@ $(LOCALBIN):
258261
## Tool Binaries
259262
KUBECTL ?= kubectl
260263
KUSTOMIZE ?= $(LOCALBIN)/kustomize
264+
HELM_EXT_OPTS ?=
261265
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
262266
ENVTEST ?= $(LOCALBIN)/setup-envtest
263267

@@ -316,7 +320,7 @@ helm: manifests kustomize helmify
316320

317321
.PHONY: helm-install
318322
helm-install: helm
319-
helm upgrade --install llmaz ./chart -f ./chart/values.global.yaml --dependency-update
323+
helm upgrade --install llmaz ./chart -f ./chart/values.global.yaml --dependency-update $(HELM_EXT_OPTS)
320324

321325
.PHONY: helm-upgrade
322326
helm-upgrade: image-push artifacts helm-install

chart/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ dependencies:
2727
condition: open-webui.enabled
2828
- name: gateway-helm
2929
version: 0.0.0-latest
30-
repository: "oci://registry-1.docker.io/envoyproxy/"
30+
repository: "oci://registry-1.docker.io/envoyproxy"
3131
condition: envoy-gateway.enabled
3232
- name: ai-gateway-helm
3333
version: v0.0.0-latest
34-
repository: "oci://registry-1.docker.io/envoyproxy/"
34+
repository: "oci://registry-1.docker.io/envoyproxy"
3535
condition: envoy-ai-gateway.enabled

hack/test-deploy-with-helm.sh

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
8+
9+
export CWD=$(pwd)
10+
function cleanup {
11+
if [ $USE_EXISTING_CLUSTER == 'false' ]
12+
then
13+
$KIND delete cluster --name $KIND_CLUSTER_NAME
14+
fi
15+
}
16+
function startup {
17+
if [ $USE_EXISTING_CLUSTER == 'false' ]
18+
then
19+
$KIND create cluster --name $KIND_CLUSTER_NAME --image $E2E_KIND_NODE_VERSION --config ./hack/kind-config.yaml
20+
fi
21+
}
22+
function kind_load {
23+
$KIND load docker-image $IMAGE_TAG --name $KIND_CLUSTER_NAME
24+
}
25+
function deploy {
26+
cd $CWD
27+
HELM_EXT_OPTS='--namespace=llmaz-system --create-namespace --set controllerManager.manager.image.tag=${LOADER_IMAGE_TAG}' make helm-install
28+
$KUBECTL wait --timeout=3m --for=condition=ready pods --namespace=llmaz-system -l app!=certgen
29+
echo "all pods of llmaz-system is ready..."
30+
$KUBECTL get pod -n llmaz-system
31+
}
32+
function deploy_kube_prometheus {
33+
LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)
34+
curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | $KUBECTL create -f -
35+
}
36+
trap cleanup EXIT
37+
startup
38+
kind_load
39+
deploy_kube_prometheus
40+
deploy

0 commit comments

Comments
 (0)