Skip to content

Commit 44ee561

Browse files
authored
Merge pull request #608 from sthaha/feat-helm-chart
chore(helm): add helm charts for operator installation
2 parents b83ed45 + ba4b4d8 commit 44ee561

32 files changed

+2980
-8
lines changed

.github/helm-e2e/action.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Helm E2E Test
3+
description: Tests Helm chart installation and operator deployment
4+
inputs:
5+
version:
6+
description: Operator version to install
7+
required: true
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Run Helm E2E tests
12+
shell: bash
13+
run: |
14+
./tests/helm.sh \
15+
--running-on-vm \
16+
--version=${{ inputs.version }}
17+
env:
18+
VERSION: ${{ inputs.version }}

.github/workflows/pr-checks.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,3 +386,62 @@ jobs:
386386
with:
387387
name: cluster-state
388388
path: cluster-state
389+
390+
helm-validate:
391+
runs-on: ubuntu-latest
392+
steps:
393+
- name: Checkout source
394+
uses: actions/checkout@v4
395+
396+
- name: Setup Go
397+
uses: actions/setup-go@v5
398+
with:
399+
go-version-file: go.mod
400+
cache: false
401+
402+
- name: Install all tools
403+
uses: ./.github/tools-cache
404+
405+
- name: Run Helm validation
406+
run: hack/helm/validate.sh
407+
408+
helm-e2e:
409+
needs: [bundle, helm-validate]
410+
env:
411+
KIND_VERSION: 0.27.0
412+
KIND_WORKER_NODES: 2
413+
name: helm-e2e
414+
runs-on: ubuntu-latest-16-cores
415+
steps:
416+
- name: Checkout source
417+
uses: actions/checkout@v4
418+
419+
- name: Install Go
420+
uses: actions/setup-go@v5
421+
with:
422+
go-version-file: go.mod
423+
cache: false
424+
425+
- name: Install all tools
426+
uses: ./.github/tools-cache
427+
428+
- name: Setup cluster with prerequisites
429+
run: make cluster-up
430+
env:
431+
PROMETHEUS_ENABLE: "true"
432+
433+
- name: Compute version
434+
uses: ./.github/compute-version
435+
id: version
436+
437+
- name: Run Helm E2E tests
438+
uses: ./.github/helm-e2e
439+
with:
440+
version: ${{ steps.version.outputs.version }}
441+
442+
- name: Archive cluster state
443+
if: always()
444+
uses: actions/upload-artifact@v4
445+
with:
446+
name: helm-cluster-state
447+
path: cluster-state

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ repos:
2929
rev: v1.37.0
3030
hooks:
3131
- id: yamllint
32-
exclude: ^(bundle|config|hack/crd)
32+
exclude: ^(bundle|config|hack/crd|manifests/helm)
3333

3434
- repo: https://github.com/igorshubovych/markdownlint-cli
3535
rev: v0.44.0
@@ -61,7 +61,7 @@ repos:
6161
hooks:
6262
- id: commitlint
6363
stages: [commit-msg]
64-
additional_dependencies: ['@commitlint/config-conventional'] # yamllint disable-line rule:quoted-strings
64+
additional_dependencies: ["@commitlint/config-conventional"] # yamllint disable-line rule:quoted-strings
6565

6666
- repo: https://github.com/fsfe/reuse-tool
6767
rev: v5.0.2

Makefile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,51 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
295295
$(KUSTOMIZE) build config/default/k8s | \
296296
kubectl delete --ignore-not-found=$(ignore-not-found) -f -
297297

298+
##@ Helm Deployment
299+
300+
HELM_CHART_DIR := manifests/helm/kepler-operator
301+
HELM_RELEASE_NAME ?= kepler-operator
302+
HELM_NAMESPACE ?= kepler-operator
303+
HELM_TIMEOUT ?= 2m
304+
305+
.PHONY: helm-template
306+
helm-template: helm manifests ## Generate manifests from Helm chart
307+
$(HELM) template $(HELM_RELEASE_NAME) $(HELM_CHART_DIR) \
308+
--namespace $(HELM_NAMESPACE) \
309+
--set operator.image=$(OPERATOR_IMG) \
310+
--set kepler.image=$(KEPLER_IMG) \
311+
--set kube-rbac-proxy.image=$(KUBE_RBAC_PROXY_IMG)
312+
313+
.PHONY: helm-install
314+
helm-install: helm manifests helm-sync-crds ## Install operator via Helm
315+
$(HELM) upgrade --install $(HELM_RELEASE_NAME) $(HELM_CHART_DIR) \
316+
--namespace $(HELM_NAMESPACE) \
317+
--create-namespace \
318+
--set operator.image=$(OPERATOR_IMG) \
319+
--set kepler.image=$(KEPLER_IMG) \
320+
--set kube-rbac-proxy.image=$(KUBE_RBAC_PROXY_IMG) \
321+
--timeout $(HELM_TIMEOUT) \
322+
--wait
323+
324+
.PHONY: helm-uninstall
325+
helm-uninstall: helm ## Uninstall operator via Helm
326+
$(HELM) uninstall $(HELM_RELEASE_NAME) --namespace $(HELM_NAMESPACE)
327+
328+
.PHONY: helm-package
329+
helm-package: helm manifests helm-sync-crds ## Package the Helm chart
330+
$(HELM) package $(HELM_CHART_DIR) --destination tmp/
331+
332+
.PHONY: helm-sync-crds
333+
helm-sync-crds: ## Sync CRDs from config/crd/bases to Helm chart
334+
@mkdir -p $(HELM_CHART_DIR)/crds
335+
cp config/crd/bases/*.yaml $(HELM_CHART_DIR)/crds/
336+
@echo "✅ CRDs synced to Helm chart"
337+
338+
.PHONY: helm-validate
339+
helm-validate: kustomize helm yq ## Validate Helm chart (syntax, templates, CRD sync, resources)
340+
@echo "Validating Helm chart against kustomize..."
341+
./hack/helm/validate.sh
342+
298343
##@ Build Dependencies
299344

300345
## Location where binaries are installed
@@ -304,11 +349,13 @@ LOCALBIN ?= $(shell pwd)/tmp/bin
304349
KUSTOMIZE ?= $(LOCALBIN)/kustomize
305350
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
306351
CRDOC ?= $(LOCALBIN)/crdoc
352+
HELM ?= $(LOCALBIN)/helm
307353

308354
# NOTE: please keep this list sorted so that it can be easily searched
309355
TOOLS = controller-gen \
310356
crdoc \
311357
govulncheck \
358+
helm \
312359
jq \
313360
kubectl \
314361
kustomize \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Deploy the operator and its dependencies:
4949
```sh
5050
make tools
5151
kubectl create -f https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.76.0/bundle.yaml
52-
kubectl create -f https://github.com/jetstack/cert-manager/releases/download/v1.15.3/cert-manager.yaml
52+
kubectl create -f https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.yaml
5353
make deploy
5454
kubectl apply -k config/samples/
5555
```

docs/developer/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,8 @@
6262
* Kube Builder Book: <https://book.kubebuilder.io/>
6363
* Operator SDK Getting Started: <https://sdk.operatorframework.io/docs/building-operators/golang/tutorial/>
6464
* Kubernetes Programming Book: <https://www.oreilly.com/library/view/programming-kubernetes/9781492047094/>
65+
66+
# Developer Guides
67+
68+
* [Helm Chart Maintenance](helm-chart-maintenance.md) - How to update and maintain the Helm chart
69+
* [Pre-commit Hooks](pre-commit-hooks.md) - Setting up and using pre-commit hooks

0 commit comments

Comments
 (0)