Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/helm-e2e/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Helm E2E Test
description: Tests Helm chart installation and operator deployment
inputs:
version:
description: Operator version to install
required: true
runs:
using: composite
steps:
- name: Run Helm E2E tests
shell: bash
run: |
./tests/helm.sh \
--running-on-vm \
--version=${{ inputs.version }}
env:
VERSION: ${{ inputs.version }}
59 changes: 59 additions & 0 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -386,3 +386,62 @@ jobs:
with:
name: cluster-state
path: cluster-state

helm-validate:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: false

- name: Install all tools
uses: ./.github/tools-cache

- name: Run Helm validation
run: hack/helm/validate.sh

helm-e2e:
needs: [bundle, helm-validate]
env:
KIND_VERSION: 0.27.0
KIND_WORKER_NODES: 2
name: helm-e2e
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: false

- name: Install all tools
uses: ./.github/tools-cache

- name: Setup cluster with prerequisites
run: make cluster-up
env:
PROMETHEUS_ENABLE: "true"

- name: Compute version
uses: ./.github/compute-version
id: version

- name: Run Helm E2E tests
uses: ./.github/helm-e2e
with:
version: ${{ steps.version.outputs.version }}

- name: Archive cluster state
if: always()
uses: actions/upload-artifact@v4
with:
name: helm-cluster-state
path: cluster-state
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
rev: v1.37.0
hooks:
- id: yamllint
exclude: ^(bundle|config|hack/crd)
exclude: ^(bundle|config|hack/crd|manifests/helm)

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

- repo: https://github.com/fsfe/reuse-tool
rev: v5.0.2
Expand Down
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,51 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
$(KUSTOMIZE) build config/default/k8s | \
kubectl delete --ignore-not-found=$(ignore-not-found) -f -

##@ Helm Deployment

HELM_CHART_DIR := manifests/helm/kepler-operator
HELM_RELEASE_NAME ?= kepler-operator
HELM_NAMESPACE ?= kepler-operator
HELM_TIMEOUT ?= 2m

.PHONY: helm-template
helm-template: helm manifests ## Generate manifests from Helm chart
$(HELM) template $(HELM_RELEASE_NAME) $(HELM_CHART_DIR) \
--namespace $(HELM_NAMESPACE) \
--set operator.image=$(OPERATOR_IMG) \
--set kepler.image=$(KEPLER_IMG) \
--set kube-rbac-proxy.image=$(KUBE_RBAC_PROXY_IMG)

.PHONY: helm-install
helm-install: helm manifests helm-sync-crds ## Install operator via Helm
$(HELM) upgrade --install $(HELM_RELEASE_NAME) $(HELM_CHART_DIR) \
--namespace $(HELM_NAMESPACE) \
--create-namespace \
--set operator.image=$(OPERATOR_IMG) \
--set kepler.image=$(KEPLER_IMG) \
--set kube-rbac-proxy.image=$(KUBE_RBAC_PROXY_IMG) \
--timeout $(HELM_TIMEOUT) \
--wait

.PHONY: helm-uninstall
helm-uninstall: helm ## Uninstall operator via Helm
$(HELM) uninstall $(HELM_RELEASE_NAME) --namespace $(HELM_NAMESPACE)

.PHONY: helm-package
helm-package: helm manifests helm-sync-crds ## Package the Helm chart
$(HELM) package $(HELM_CHART_DIR) --destination tmp/

.PHONY: helm-sync-crds
helm-sync-crds: ## Sync CRDs from config/crd/bases to Helm chart
@mkdir -p $(HELM_CHART_DIR)/crds
cp config/crd/bases/*.yaml $(HELM_CHART_DIR)/crds/
@echo "✅ CRDs synced to Helm chart"

.PHONY: helm-validate
helm-validate: kustomize helm yq ## Validate Helm chart (syntax, templates, CRD sync, resources)
@echo "Validating Helm chart against kustomize..."
./hack/helm/validate.sh

##@ Build Dependencies

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

# NOTE: please keep this list sorted so that it can be easily searched
TOOLS = controller-gen \
crdoc \
govulncheck \
helm \
jq \
kubectl \
kustomize \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Deploy the operator and its dependencies:
```sh
make tools
kubectl create -f https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.76.0/bundle.yaml
kubectl create -f https://github.com/jetstack/cert-manager/releases/download/v1.15.3/cert-manager.yaml
kubectl create -f https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.yaml
make deploy
kubectl apply -k config/samples/
```
Expand Down
5 changes: 5 additions & 0 deletions docs/developer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@
* Kube Builder Book: <https://book.kubebuilder.io/>
* Operator SDK Getting Started: <https://sdk.operatorframework.io/docs/building-operators/golang/tutorial/>
* Kubernetes Programming Book: <https://www.oreilly.com/library/view/programming-kubernetes/9781492047094/>

# Developer Guides

* [Helm Chart Maintenance](helm-chart-maintenance.md) - How to update and maintain the Helm chart
* [Pre-commit Hooks](pre-commit-hooks.md) - Setting up and using pre-commit hooks
Loading
Loading