Skip to content

Commit 81f7fc6

Browse files
committed
implemented Helm integration tests
1 parent 4cd66b4 commit 81f7fc6

File tree

3 files changed

+190
-1
lines changed

3 files changed

+190
-1
lines changed

.github/ct.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
# Chart testing configuration for kubeflow-trainer
3+
4+
# Directories containing charts to test
5+
chart-dirs:
6+
- charts
7+
8+
# Charts to exclude from testing (if any)
9+
excluded-charts: []
10+
11+
# Target branch for comparison (used for detecting changes)
12+
target-branch: master
13+
14+
# Version increment checking
15+
# Set to false for initial setup, enable later for strict versioning
16+
check-version-increment: false
17+
18+
# Schema validation settings
19+
validate-chart-schema: true
20+
validate-maintainers: true
21+
validate-yaml: true
22+
23+
# Helm configuration
24+
helm-extra-args: --timeout 300s --wait --debug
25+
26+
# Helm extra set args for testing
27+
helm-extra-set-args: --set=jobset.install=true --set=replicaCount=1 --set=image.pullPolicy=IfNotPresent
28+
29+
# Default namespace for chart installations
30+
namespace: kubeflow-system
31+
32+
# Additional commands to run for each chart
33+
additional-commands:
34+
- helm dependency update {{ .Path }}
35+
- helm template {{ .Path }} --debug --namespace kubeflow-system --dry-run
36+
- helm lint {{ .Path }}
37+
38+
# Debug settings
39+
debug: true
40+
41+
# Skip cleanup after testing (useful for debugging)
42+
skip-clean-up: false
43+
44+
# Test upgrades (install chart, then upgrade)
45+
upgrade: true
46+
47+
# Print config for debugging
48+
print-config: true
49+
50+
# Helm dependency build before testing
51+
helm-dependency-extra-args: --skip-refresh
52+
53+
# Test configuration
54+
test-extra-args: --logs
55+
56+
# Release name template
57+
release-label-selector: app.kubernetes.io/instance={{ .Release.Name }}

.github/workflows/test-helm.yaml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
---
2+
name: Helm Integration Tests
3+
4+
'on':
5+
pull_request:
6+
paths:
7+
- 'charts/**'
8+
- '.github/workflows/test-helm.yaml'
9+
push:
10+
branches:
11+
- master
12+
paths:
13+
- 'charts/**'
14+
15+
jobs:
16+
helm-integration-tests:
17+
name: Helm Integration Tests
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout Code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Set up Helm
27+
uses: azure/setup-helm@v4
28+
with:
29+
version: 'latest'
30+
31+
- name: Set up chart-testing
32+
uses: helm/[email protected]
33+
34+
- name: Add chart dependencies
35+
run: |
36+
# Add JobSet repository as mentioned in the original PR
37+
helm repo add jobset https://kubernetes-sigs.github.io/jobset
38+
helm repo update
39+
40+
- name: Determine target branch
41+
id: get_branch
42+
run: |
43+
if [ "${{ github.event_name }}" == "push" ]; then
44+
BRANCH="${{ github.ref_name }}"
45+
elif [ "${{ github.event_name }}" == "pull_request" ]; then
46+
BRANCH="${{ github.base_ref }}"
47+
else
48+
BRANCH="master"
49+
fi
50+
echo "Target branch: $BRANCH"
51+
echo "BRANCH=$BRANCH" >> "$GITHUB_OUTPUT"
52+
53+
- name: Run make generate (includes helm-docs)
54+
run: |
55+
# This was mentioned in the original PR commits
56+
if make help 2>/dev/null | grep -q "generate"; then
57+
make generate
58+
else
59+
echo "No generate target found, continuing..."
60+
fi
61+
62+
- name: Create kind cluster
63+
run: |
64+
# Follow the pattern from original PR
65+
if make help 2>/dev/null | grep -q "test-e2e-setup-cluster"; then
66+
echo "Using project's cluster setup..."
67+
make test-e2e-setup-cluster
68+
else
69+
echo "Setting up Kind cluster..."
70+
kind create cluster --name chart-testing --wait 300s
71+
kubectl cluster-info --context kind-chart-testing
72+
fi
73+
74+
- name: Run chart-testing (lint and install)
75+
env:
76+
BRANCH: ${{ steps.get_branch.outputs.BRANCH }}
77+
run: |
78+
# Use the combined command with configuration file
79+
ct lint-and-install \
80+
--config .github/ct.yaml \
81+
--target-branch $BRANCH \
82+
--debug
83+
84+
- name: Verify Helm installation
85+
run: |
86+
echo "=== Cluster Status ==="
87+
kubectl get nodes -o wide
88+
89+
echo "=== Namespaces ==="
90+
kubectl get namespaces
91+
92+
echo "=== All Pods ==="
93+
kubectl get pods --all-namespaces -o wide
94+
95+
echo "=== Training Operator Pods ==="
96+
kubectl get pods -n kubeflow-system \
97+
-l app.kubernetes.io/name=kubeflow-trainer || true
98+
99+
echo "=== JobSet Pods ==="
100+
kubectl get pods -n kubeflow-system \
101+
-l app.kubernetes.io/name=jobset || true
102+
103+
echo "=== Services ==="
104+
kubectl get svc --all-namespaces
105+
106+
echo "=== CRDs ==="
107+
kubectl get crd | grep -E "(training|jobset)" || \
108+
echo "No training/jobset CRDs found"
109+
110+
- name: Run basic functionality tests
111+
run: |
112+
echo "=== Testing Chart Installation ==="
113+
# Test the specific installation command from the original PR
114+
helm upgrade kubeflow-trainer charts/kubeflow-trainer \
115+
--install \
116+
--dependency-update \
117+
--namespace kubeflow-system \
118+
--create-namespace \
119+
--wait \
120+
--timeout 300s \
121+
--set jobset.install=true \
122+
--dry-run
123+
124+
echo "Chart validation successful!"
125+
126+
- name: Cleanup
127+
if: always()
128+
run: |
129+
echo "Cleaning up resources..."
130+
kubectl delete namespace kubeflow-system \
131+
--ignore-not-found=true || true
132+
kind delete cluster --name chart-testing || true

charts/kubeflow-trainer/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type: application
2626

2727
dependencies:
2828
- name: jobset
29-
repository: oci://registry.k8s.io/jobset/charts/jobset
29+
repository: oci://registry.k8s.io/jobset/charts
3030
version: v0.8.2
3131
condition: jobset.install
3232

0 commit comments

Comments
 (0)