-
Notifications
You must be signed in to change notification settings - Fork 3
240 lines (203 loc) · 7.38 KB
/
helm-chart-ci.yml
File metadata and controls
240 lines (203 loc) · 7.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: Helm Chart CI
on:
push:
branches: [ main, develop ]
paths:
- 'charts/**'
- '.github/workflows/helm-chart-ci.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'charts/**'
- '.github/workflows/helm-chart-ci.yml'
jobs:
lint:
name: Lint Helm Chart
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: '3.13.0'
- name: Run Helm Lint
run: |
helm lint charts/karpenter-optimizer
- name: Validate Chart Schema
run: |
helm lint charts/karpenter-optimizer --strict
test:
name: Test Helm Chart Installation
runs-on: ubuntu-latest
# Optional: Uncomment to enable full Kubernetes testing with kind
# This job tests actual chart installation in a real Kubernetes cluster
if: false # Set to true to enable (slower but more thorough)
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: '3.13.0'
- name: Set up Kubernetes (kind)
uses: helm/kind-action@v1.13.0
with:
version: 'v0.20.0'
- name: Create Kubernetes cluster
run: |
kind create cluster --name karpenter-optimizer-test --wait 60s
- name: Test Chart Installation (Default Values)
run: |
helm install karpenter-optimizer-test charts/karpenter-optimizer \
--namespace karpenter-optimizer \
--create-namespace \
--wait \
--timeout 5m \
--debug
- name: Test Chart Upgrade
run: |
helm upgrade karpenter-optimizer-test charts/karpenter-optimizer \
--namespace karpenter-optimizer \
--wait \
--timeout 5m \
--debug
- name: Test Chart Uninstall
run: |
helm uninstall karpenter-optimizer-test \
--namespace karpenter-optimizer
- name: Cleanup Kubernetes cluster
if: always()
run: |
kind delete cluster --name karpenter-optimizer-test
package:
name: Package Helm Chart
runs-on: ubuntu-latest
needs: [lint]
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: '3.13.0'
- name: Package Chart
run: |
helm package charts/karpenter-optimizer --destination ./charts
- name: Check Chart Package
run: |
ls -lh charts/*.tgz
helm show chart charts/karpenter-optimizer-*.tgz
- name: Upload Chart Artifact
uses: actions/upload-artifact@v4
with:
name: helm-chart-package
path: charts/*.tgz
retention-days: 7
publish:
name: Publish Helm Chart to GitHub Pages
runs-on: ubuntu-latest
needs: [package]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: '3.13.0'
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Package Chart
run: |
helm package charts/karpenter-optimizer --destination ./charts
- name: Checkout gh-pages branch
run: |
git fetch origin gh-pages:gh-pages || echo "gh-pages branch does not exist yet"
git checkout gh-pages || git checkout -b gh-pages
- name: Generate Index
run: |
# Copy new chart package
cp charts/karpenter-optimizer-*.tgz . || true
# Generate or update index.yaml
if [ -f index.yaml ]; then
helm repo index . --url https://kaskol10.github.io/karpenter-optimizer --merge index.yaml
else
helm repo index . --url https://kaskol10.github.io/karpenter-optimizer
fi
- name: Commit and Push
run: |
git add index.yaml *.tgz
git diff --staged --quiet || git commit -m "Add chart version $(helm show chart charts/karpenter-optimizer | grep '^version:' | awk '{print $2}')"
git push origin gh-pages
validate-values:
name: Validate Chart Values
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: '3.13.0'
- name: Validate Default Values
run: |
helm template karpenter-optimizer charts/karpenter-optimizer > /dev/null
- name: Validate Ollama Configuration
run: |
helm template karpenter-optimizer charts/karpenter-optimizer \
--set config.ollama.enabled=true \
--set config.ollama.url=http://ollama:11434 \
--set config.ollama.model=granite4:latest > /dev/null
- name: Validate LiteLLM Configuration
run: |
helm template karpenter-optimizer charts/karpenter-optimizer \
--set config.llm.enabled=true \
--set config.llm.provider=litellm \
--set config.llm.url=http://litellm:4000 \
--set config.llm.model=gpt-3.5-turbo \
--set config.llm.apiKey=test-key > /dev/null
- name: Validate Kubernetes Configuration
run: |
helm template karpenter-optimizer charts/karpenter-optimizer \
--set config.kubeconfigPath=/path/to/kubeconfig \
--set config.kubeContext=my-context > /dev/null
- name: Validate Ingress Configuration
run: |
helm template karpenter-optimizer charts/karpenter-optimizer \
--set ingress.enabled=true \
--set ingress.className=nginx \
--set ingress.hosts[0].host=karpenter-optimizer.example.com > /dev/null
- name: Validate Autoscaling Configuration
run: |
helm template karpenter-optimizer charts/karpenter-optimizer \
--set autoscaling.enabled=true \
--set autoscaling.minReplicas=2 \
--set autoscaling.maxReplicas=5 > /dev/null
- name: Validate Resource Limits
run: |
helm template karpenter-optimizer charts/karpenter-optimizer \
--set resources.limits.cpu=1000m \
--set resources.limits.memory=1Gi \
--set resources.requests.cpu=500m \
--set resources.requests.memory=512Mi > /dev/null
- name: Validate All Values Together
run: |
helm template karpenter-optimizer charts/karpenter-optimizer \
--set config.llm.enabled=true \
--set config.llm.provider=litellm \
--set config.llm.url=http://litellm:4000 \
--set config.llm.model=gpt-3.5-turbo \
--set ingress.enabled=true \
--set autoscaling.enabled=true \
--set resources.limits.cpu=1000m \
--set resources.limits.memory=1Gi > /dev/null