-
Notifications
You must be signed in to change notification settings - Fork 23
feat: add helm chart #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add helm chart #161
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: Test Chart | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| test-e2e: | ||
| name: Run on Ubuntu | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Clone the code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: Install kubebuilder | ||
| run: | | ||
| curl -L -o kubebuilder "https://go.kubebuilder.io/dl/latest/$(go env GOOS)/$(go env GOARCH)" | ||
| chmod +x kubebuilder | ||
| sudo mv kubebuilder /usr/local/bin/ | ||
| - name: Install kind | ||
| run: | | ||
| curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 | ||
| chmod +x ./kind | ||
| sudo mv ./kind /usr/local/bin/kind | ||
| - name: Create kind cluster | ||
| run: kind create cluster | ||
|
|
||
| - name: Build and load operator image | ||
| run: | | ||
| go mod tidy | ||
| make manifests # Generate fresh manifests first | ||
| # Force Docker usage in CI (simpler than handling both runtimes) | ||
| make image-build CONTAINER_RUNTIME=docker | ||
| IMAGE_NAME="docker.io/persesdev/perses-operator:v$(cat VERSION)" | ||
| kind load docker-image "${IMAGE_NAME}" | ||
| - name: Install Helm | ||
| run: | | ||
| curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash | ||
| - name: Test Helm chart | ||
| run: | | ||
| make helm-chart | ||
| helm lint dist/chart | ||
| make helm-install | ||
| - name: Check Helm release | ||
| run: | | ||
| helm status perses-operator --namespace perses-operator-system | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -488,3 +488,24 @@ generate-changelog: | |
| .PHONY: tag | ||
| tag: | ||
| ./scripts/release.sh --tag "${VERSION}" | ||
|
|
||
| ##@ Helm | ||
| .PHONY: helm-chart | ||
| helm-chart: manifests | ||
| kubebuilder edit --plugins=helm/v1-alpha | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will be great if the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi thanks for the feedback, will try to pick up this work again |
||
| @echo "Helm chart updated in dist/chart/" | ||
|
|
||
| .PHONY: helm-chart-force | ||
| helm-chart-force: manifests | ||
| kubebuilder edit --plugins=helm/v1-alpha --force | ||
| @echo "Helm chart forcibly updated in dist/chart/" | ||
|
|
||
| .PHONY: helm-install | ||
| helm-install: helm-chart | ||
| helm upgrade --install perses-operator dist/chart \ | ||
| --create-namespace \ | ||
| --namespace perses-operator-system \ | ||
| --set image.repository=$(IMAGE_TAG_BASE) \ | ||
| --set image.tag=v$(VERSION) \ | ||
| --set metrics.enable=false \ | ||
| --force | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Patterns to ignore when building Helm packages. | ||
| # Operating system files | ||
| .DS_Store | ||
|
|
||
| # Version control directories | ||
| .git/ | ||
| .gitignore | ||
| .bzr/ | ||
| .hg/ | ||
| .hgignore | ||
| .svn/ | ||
|
|
||
| # Backup and temporary files | ||
| *.swp | ||
| *.tmp | ||
| *.bak | ||
| *.orig | ||
| *~ | ||
|
|
||
| # IDE and editor-related files | ||
| .idea/ | ||
| .vscode/ | ||
|
|
||
| # Helm chart artifacts | ||
| dist/chart/*.tgz |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,7 @@ | ||||||
| apiVersion: v2 | ||||||
| name: perses-operator | ||||||
| description: A Helm chart to distribute the project perses-operator | ||||||
| type: application | ||||||
| version: 0.1.0 | ||||||
| appVersion: "0.1.0" | ||||||
| icon: "https://example.com/icon.png" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| {{- define "chart.name" -}} | ||
| {{- if .Chart }} | ||
| {{- if .Chart.Name }} | ||
| {{- .Chart.Name | trunc 63 | trimSuffix "-" }} | ||
| {{- else if .Values.nameOverride }} | ||
| {{ .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| perses-operator | ||
| {{- end }} | ||
| {{- else }} | ||
| perses-operator | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
|
|
||
| {{- define "chart.labels" -}} | ||
| {{- if .Chart.AppVersion -}} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| {{- if .Chart.Version }} | ||
| helm.sh/chart: {{ .Chart.Version | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/name: {{ include "chart.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
|
|
||
| {{- define "chart.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "chart.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| {{- end }} | ||
|
|
||
|
|
||
| {{- define "chart.hasMutatingWebhooks" -}} | ||
| {{- $hasMutating := false }} | ||
| {{- range . }} | ||
| {{- if eq .type "mutating" }} | ||
| $hasMutating = true }}{{- end }} | ||
| {{- end }} | ||
| {{ $hasMutating }}}}{{- end }} | ||
|
|
||
|
|
||
| {{- define "chart.hasValidatingWebhooks" -}} | ||
| {{- $hasValidating := false }} | ||
| {{- range . }} | ||
| {{- if eq .type "validating" }} | ||
| $hasValidating = true }}{{- end }} | ||
| {{- end }} | ||
| {{ $hasValidating }}}}{{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| {{- if .Values.certmanager.enable }} | ||
| # Self-signed Issuer | ||
| apiVersion: cert-manager.io/v1 | ||
| kind: Issuer | ||
| metadata: | ||
| labels: | ||
| {{- include "chart.labels" . | nindent 4 }} | ||
| name: selfsigned-issuer | ||
| namespace: {{ .Release.Namespace }} | ||
| spec: | ||
| selfSigned: {} | ||
| {{- if .Values.metrics.enable }} | ||
| --- | ||
| # Certificate for the metrics | ||
| apiVersion: cert-manager.io/v1 | ||
| kind: Certificate | ||
| metadata: | ||
| annotations: | ||
| {{- if .Values.crd.keep }} | ||
| "helm.sh/resource-policy": keep | ||
| {{- end }} | ||
| labels: | ||
| {{- include "chart.labels" . | nindent 4 }} | ||
| name: metrics-certs | ||
| namespace: {{ .Release.Namespace }} | ||
| spec: | ||
| dnsNames: | ||
| - perses-operator.{{ .Release.Namespace }}.svc | ||
| - perses-operator.{{ .Release.Namespace }}.svc.cluster.local | ||
| - perses-operator-metrics-service.{{ .Release.Namespace }}.svc | ||
| issuerRef: | ||
| kind: Issuer | ||
| name: selfsigned-issuer | ||
| secretName: metrics-server-cert | ||
| {{- end }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to have a workflow to release this helm chart. Same like this one