Skip to content

Commit f806677

Browse files
authored
Adding simple helm CI (#1635)
1 parent 0a3bb20 commit f806677

File tree

3 files changed

+53
-3
lines changed

3 files changed

+53
-3
lines changed

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ vet: ## Run go vet against code.
133133
go vet ./...
134134

135135
.PHONY: test
136-
test: generate fmt vet envtest image-build verify-crds ## Run tests.
136+
test: generate fmt vet envtest image-build verify-crds verify-helm-charts ## Run tests.
137137
CGO_ENABLED=1 KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e | grep -v /conformance) -race -coverprofile cover.out
138138

139139
.PHONY: test-unit
@@ -174,6 +174,10 @@ verify: vet fmt-verify generate ci-lint api-lint verify-all
174174
verify-crds: kubectl-validate
175175
hack/verify-manifests.sh
176176

177+
.PHONY: verify-helm-charts
178+
verify-helm-charts: helm-install
179+
hack/verify-helm.sh
180+
177181
# Run static analysis.
178182
.PHONY: verify-all
179183
verify-all:
@@ -423,8 +427,9 @@ $(GOLANGCI_API_LINT):
423427
yq: ## Download yq locally if necessary.
424428
GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on go install github.com/mikefarah/yq/v4@$(YQ_VERSION)
425429

426-
.PHONY: helm
427-
helm: ## Download helm locally if necessary.
430+
.PHONY: helm-install
431+
helm-install: $(HELM) ## Download helm locally if necessary.
432+
$(HELM): $(LOCALBIN)
428433
GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on go install helm.sh/helm/v3/cmd/helm@$(HELM_VERSION)
429434

430435
.PHONY: kubectl-validate

hack/verify-helm.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# Copyright 2025 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/..
18+
19+
declare -A test_cases_inference_pool
20+
21+
# InferencePool Helm Chart test cases
22+
test_cases_inference_pool["basic"]="--set inferencePool.modelServers.matchLabels.app=llm-instance-gateway"
23+
test_cases_inference_pool["gke-provider"]="--set provider.name=gke --set inferencePool.modelServers.matchLabels.app=llm-instance-gateway"
24+
test_cases_inference_pool["multiple-replicas"]="--set inferencePool.replicas=3 --set inferencePool.modelServers.matchLabels.app=llm-instance-gateway"
25+
26+
# Run the install command in case this script runs from a different bash
27+
# source (such as in the verify-all script)
28+
make helm-install
29+
30+
# Running tests cases
31+
echo "Running helm template command for inferencePool chart..."
32+
# Loop through the keys of the associative array
33+
for key in "${!test_cases_inference_pool[@]}"; do
34+
echo "Running test: $key"
35+
${SCRIPT_ROOT}/bin/helm template ${SCRIPT_ROOT}/config/charts/inferencepool ${test_cases_inference_pool[$key]} --output-dir="${SCRIPT_ROOT}/bin"
36+
if [ $? -ne 0 ]; then
37+
echo "Helm template command failed for test: $key"
38+
exit 1
39+
fi
40+
done
41+
42+
43+

hack/verify-manifests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ main() {
4545
fetch_crds "https://raw.githubusercontent.com/GoogleCloudPlatform/gke-gateway-api/refs/tags/${GKE_GATEWAY_API_VERSION}/config/crd/networking.gke.io_healthcheckpolicies.yaml"
4646
fetch_crds "https://raw.githubusercontent.com/istio/istio/refs/tags/${ISTIO_VERSION}/manifests/charts/base/files/crd-all.gen.yaml"
4747

48+
# Run the install command in case this script runs from a different bash
49+
# source (such as in the verify-all script)
4850
make kubectl-validate
4951

5052
${SCRIPT_ROOT}/bin/kubectl-validate "${TEMP_DIR}"

0 commit comments

Comments
 (0)