Skip to content
Closed
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
51 changes: 51 additions & 0 deletions .github/workflows/helm-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Helm chart

on:
pull_request:
push:
tags:
- 'v*'

permissions: {}

jobs:
test:
name: Test Helm Chart
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Start minikube
uses: medyagh/setup-minikube@latest
- name: Set up Helm
uses: azure/[email protected]
- name: Install Helm Chart
run: |
PR_NUMBER=$(echo ${GITHUB_REF} | awk -F'/' '{print $3}')

helm dependency update

helm install test ./helm \
--set ref.image.tag=pr-${PR_NUMBER} \
--wait

kubectl get pods

publish:
name: Publish
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Chart | Push
uses: appany/[email protected]
with:
name: ref
repository: climate-ref
tag: ${{ github.ref_name }}
path: helm
registry: ghcr.io
registry_username: ${{ github.actor }}
registry_password: ${{ secrets.GITHUB_TOKEN }}
update_dependencies: 'true'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,6 @@ out
# Ignore copied LICENCE/NOTICE files
packages/*/LICENCE
packages/*/NOTICE

# Helm dependencies
helm/charts/*
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ repos:
- id: check-yaml
args:
- --unsafe
exclude: helm/templates
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
Expand Down
23 changes: 23 additions & 0 deletions helm/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions helm/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: redis-cluster
repository: oci://registry-1.docker.io/bitnamicharts
version: 11.4.3
digest: sha256:ba45d88d200a4def7a50e21e7a5fa4177b4c82ca1ef7a28223a0e475476f28ea
generated: "2025-03-12T17:05:19.517239938-04:00"
22 changes: 22 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v2
name: ref
description: A Helm chart for Kubernetes
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.2.0"

dependencies:
- name: redis-cluster
alias: redis
version: ~11
repository: oci://registry-1.docker.io/bitnamicharts
condition: redis.enabled
51 changes: 51 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ref.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "ref.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "ref.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "ref.labels" -}}
helm.sh/chart: {{ include "ref.chart" . }}
{{ include "ref.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "ref.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ref.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
77 changes: 77 additions & 0 deletions helm/templates/flower/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ref.fullname" . }}-flower
labels:
app.kubernetes.io/component: flower
{{- include "ref.labels" . | nindent 4 }}
spec:
{{- if not .Values.flower.autoscaling.enabled }}
replicas: {{ .Values.flower.replicaCount }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/component: flower
{{- include "ref.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/flower/secret.yaml") . | sha256sum }}
{{- with .Values.flower.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/component: flower
{{- include "ref.labels" . | nindent 8 }}
{{- with .Values.flower.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "ref.fullname" . }}-flower
{{- with .Values.flower.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: flower
{{- with .Values.flower.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.flower.image.repository }}:{{ .Values.flower.image.tag }}"
imagePullPolicy: {{ .Values.flower.image.pullPolicy }}
envFrom:
- secretRef:
name: {{ include "ref.fullname" . }}-flower
readinessProbe:
httpGet:
path: /healthcheck
port: http
{{- with .Values.flower.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.flower.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.flower.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.flower.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.flower.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.flower.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
9 changes: 9 additions & 0 deletions helm/templates/flower/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "ref.fullname" . }}-flower
labels:
app.kubernetes.io/component: flower
{{- include "ref.labels" . | nindent 4 }}
stringData:
{{- tpl (toYaml .Values.flower.env) . | nindent 2}}
17 changes: 17 additions & 0 deletions helm/templates/flower/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "ref.fullname" . }}-flower
labels:
app.kubernetes.io/component: flower
{{- include "ref.labels" . | nindent 4 }}
spec:
type: {{ .Values.flower.service.type }}
ports:
- port: {{ .Values.flower.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/component: flower
{{- include "ref.selectorLabels" . | nindent 4 }}
14 changes: 14 additions & 0 deletions helm/templates/flower/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.flower.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "ref.fullname" . }}-flower
labels:
app.kubernetes.io/component: flower
{{- include "ref.labels" . | nindent 4 }}
{{- with .Values.flower.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.flower.serviceAccount.automount }}
{{- end }}
31 changes: 31 additions & 0 deletions helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "ref.fullname" . }}
labels:
{{- include "ref.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.ingress.className }}
ingressClassName: {{ . }}
{{- end }}
tls:
- hosts:
- {{ .Values.ingress.host | quote }}
secretName: {{ include "ref.fullname" . }}-ingress-cert
rules:
- host: {{ .Values.ingress.host | quote }}
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: {{ include "ref.fullname" . }}-flower
port:
number: {{ .Values.flower.service.port }}
{{- end }}
Loading
Loading