Skip to content

Commit 1682b1d

Browse files
author
Sunil Thaha
authored
Merge pull request #2220 from sthaha/chore-helm-chart
feat: add Helm chart for Kepler deployment
2 parents 9ec7cc0 + aa29a26 commit 1682b1d

File tree

15 files changed

+886
-1
lines changed

15 files changed

+886
-1
lines changed

.github/k8s/action.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ runs:
4545
run: |
4646
kubectl version --client
4747
48+
- name: Setup Helm
49+
uses: azure/setup-helm@v4
50+
with:
51+
version: latest
52+
4853
- name: Checkout source
4954
uses: actions/checkout@v4
5055
with:
@@ -56,6 +61,11 @@ runs:
5661
go-version-file: go.mod
5762
cache: false
5863

64+
- name: Lint Helm chart
65+
shell: bash
66+
run: |
67+
helm lint manifests/helm/kepler
68+
5969
- name: Build image
6070
shell: bash
6171
run: |
@@ -128,6 +138,55 @@ runs:
128138
fi
129139
done
130140
141+
- name: Remove existing Kepler deployment
142+
shell: bash
143+
run: |
144+
echo "::group::Remove existing Kepler deployment before Helm test"
145+
make undeploy
146+
echo "::endgroup::"
147+
148+
- name: Test Helm deployment
149+
shell: bash
150+
run: |
151+
echo "::group::Deploy Kepler using Helm"
152+
# Update Helm chart to use the locally built image
153+
sed -i 's|repository: quay.io/sustainable_computing_io/kepler|repository: localhost:5001/kepler|' manifests/helm/kepler/values.yaml
154+
sed -i 's|tag: latest|tag: dev|' manifests/helm/kepler/values.yaml
155+
sed -i '/fake-cpu-meter:/{n;s/enabled: false/enabled: true/}' manifests/helm/kepler/values.yaml
156+
157+
# Install using Helm
158+
helm install kepler-helm-test manifests/helm/kepler --namespace kepler-helm --create-namespace --wait --timeout=5m
159+
echo "::endgroup::"
160+
161+
- name: Verify Helm deployment
162+
shell: bash
163+
run: |
164+
echo "::group::Verify Helm deployment"
165+
kubectl rollout status daemonset/kepler-helm-test -n kepler-helm --timeout=5m
166+
kubectl get pods -n kepler-helm
167+
echo "::endgroup::"
168+
169+
- name: Validate Helm metrics endpoint
170+
shell: bash
171+
run: |
172+
echo "::group::Test Helm deployment metrics"
173+
kubectl port-forward service/kepler-helm-test 28283:28282 -n kepler-helm &
174+
sleep 20
175+
176+
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:28283/metrics)
177+
[[ $HTTP_STATUS -ne 200 ]] && echo "Helm deployment HTTP status code is not 200" && exit 1
178+
179+
echo "Helm deployment metrics endpoint is working"
180+
echo "::endgroup::"
181+
182+
- name: Cleanup Helm deployment
183+
shell: bash
184+
run: |
185+
echo "::group::Cleanup Helm deployment"
186+
helm uninstall kepler-helm-test -n kepler-helm
187+
kubectl delete namespace kepler-helm
188+
echo "::endgroup::"
189+
131190
- name: Run must gather
132191
shell: bash
133192
run: |

.github/workflows/release.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ jobs:
3030
cache: true
3131
check-latest: true
3232

33+
- name: Setup Helm
34+
uses: azure/setup-helm@v4
35+
with:
36+
version: latest
37+
3338
- name: Login to Image Registry
3439
uses: docker/login-action@v3
3540
with:
@@ -53,6 +58,22 @@ jobs:
5358
TAG_NAME=${{ github.ref_name }}
5459
echo "version=$TAG_NAME" >> "$GITHUB_OUTPUT"
5560
61+
- name: Update Helm Chart Version
62+
shell: bash
63+
run: |
64+
VERSION=${{ steps.version.outputs.version }}
65+
# Remove 'v' prefix from version
66+
CHART_VERSION=${VERSION#v}
67+
# Update Chart.yaml with the release version
68+
sed -i "s/^version:.*/version: $CHART_VERSION/" manifests/helm/kepler/Chart.yaml
69+
sed -i "s/^appVersion:.*/appVersion: \"$VERSION\"/" manifests/helm/kepler/Chart.yaml
70+
71+
- name: Package Helm Chart
72+
shell: bash
73+
run: |
74+
mkdir -p helm-releases
75+
helm package manifests/helm/kepler -d helm-releases
76+
5677
- name: Create GitHub Release
5778
uses: softprops/action-gh-release@v2
5879
with:
@@ -61,6 +82,8 @@ jobs:
6182
generate_release_notes: true
6283
draft: false
6384
make_latest: true
85+
files: |
86+
helm-releases/*.tgz
6487
env:
6588
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6689

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ repos:
2828
rev: v1.37.0
2929
hooks:
3030
- id: yamllint
31+
exclude: ^manifests/helm/.*/templates/.*\.yaml$
3132

3233
- repo: https://github.com/igorshubovych/markdownlint-cli
3334
rev: v0.44.0
@@ -76,3 +77,13 @@ repos:
7677
hooks:
7778
- id: shellcheck
7879
args: [-x]
80+
81+
- repo: local
82+
hooks:
83+
- id: helm-lint
84+
name: helm-lint
85+
entry: helm lint
86+
language: system
87+
files: ^manifests/helm/[^/]+/(Chart\.yaml|values\.yaml|templates/.*)$
88+
pass_filenames: false
89+
args: [manifests/helm/kepler]

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,19 @@ docker-compose up -d
110110

111111
### 3️⃣ Running on Kubernetes 🐳
112112

113-
Deploy Kepler to your Kubernetes cluster:
113+
Deploy Kepler to your Kubernetes cluster using Helm or Kustomize:
114+
115+
#### Using Helm Chart (Recommended)
116+
117+
```bash
118+
# Install using Helm
119+
helm install kepler manifests/helm/kepler/ \
120+
--namespace kepler \
121+
--create-namespace \
122+
--set namespace.create=false
123+
```
124+
125+
#### Using Kustomize
114126

115127
```bash
116128
# Set up a local development cluster with Kind
@@ -134,6 +146,10 @@ make deploy IMG_BASE=<your registry> VERSION=<your version>
134146

135147
## 📖 Documentation
136148

149+
- **[Installation Guide](docs/user/installation.md)** - Detailed installation instructions for all deployment methods
150+
- **[Configuration Guide](docs/configuration/configuration.md)** - Configuration options and examples
151+
- **[Metrics Documentation](docs/metrics/metrics.md)** - Available metrics and their descriptions
152+
137153
For more detailed documentation, please visit the [official Kepler documentation](https://sustainable-computing.io/kepler/).
138154

139155
## 🤝 Contributing

0 commit comments

Comments
 (0)