Add the helm chart
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2025-01-18 11:59:15 +01:00
parent 609949bb08
commit 65b90453dc
33 changed files with 1205 additions and 0 deletions

View File

@ -0,0 +1,31 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "chart.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 "chart.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 "chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

View File

@ -0,0 +1,11 @@
{{- define "lib.helpers.convertToJson" -}}
{{ toString (toJson . ) }}
{{- end -}}
{{- define "lib.helpers.convertToToml" -}}
{{ toString (toToml .) }}
{{- end -}}
{{- define "lib.helpers.convertToYaml" -}}
{{ toString (toYaml .) }}
{{- end -}}

View File

@ -0,0 +1,31 @@
{{/*
* Populate hashes from configmaps and secret to
* trigger pod restart after config was changed
* TODO: Remove the extra empty line after annotations
*/}}
{{- define "lib.helpers.hashes" -}} {{- /* define[0] */ -}}
# ---------------------------------------------------------------------
# -- A note from the library:
# -- Pod annotations currently only support hashes of mounted
# -- config files and env variables and annotations inherited from
# -- the deployment
# ---------------------------------------------------------------------
{{ range $k, $v := .env -}} {{/* range[1] */ -}}
{{- if $v.enabled -}} {{- /* if[2] */ -}}
{{
include "lib.helpers.hash"
(dict "kind" "env" "name" $k "data" $v.data)
}}
{{ end -}} {{/* /if[2] */ -}}
{{- end -}} {{- /* /range[1] */ -}}
{{ range $k, $v := .files -}} {{/* range[1] */ -}}
{{
include "lib.helpers.hash"
(dict "kind" "file" "name" $k "data" ($v).entries)
}}
{{- end -}} {{- /* /range[1] */ -}}
{{- end -}} {{- /* /define[0] */ -}}
{{- define "lib.helpers.hash" -}} {{- /* define[0] */ -}}
{{ printf "helm.badhouseplants.net/%s-%s" .kind .name }}: {{ .data | toString | sha256sum }}
{{- end -}} {{- /* /end[0] */ -}}

View File

@ -0,0 +1,32 @@
{{- define "lib.helpers.lookup.env" -}} {{- /* define[0] */ -}}
{{- include "lib.error.noCtx" . -}}
{{- include "lib.error.noKey" (dict "ctx" . "key" "key") -}}
{{- $data := (index .ctx.Values.config.env .key) -}}
{{- if not $data }} {{- /* if[1] */}}
{{- fail (printf "entry %s is not found in env" .key) }}
{{- else -}} {{- /* .if[1] */ -}}
{{ toYaml $data }}
{{- end -}} {{- /* /if[1] */ -}}
{{- end -}} {{- /* /define[0] */ -}}
{{- define "lib.helpers.lookup.storage" -}} {{- /* define[0] */ -}}
{{- include "lib.error.noCtx" . -}}
{{- include "lib.error.noKey" (dict "ctx" . "key" "key") -}}
{{- $data := (index .ctx.Values.storage .key) -}}
{{- if not $data }} {{- /* if[1] */}}
{{- fail (printf "entry %s is not found in storage" .key) }}
{{- else -}} {{- /* .if[1] */ -}}
{{ toYaml $data }}
{{- end -}} {{- /* /if[1] */ -}}
{{- end -}} {{- /* /define[0] */ -}}
{{- define "lib.helpers.lookup.service" -}} {{- /* define[0] */ -}}
{{- include "lib.error.noCtx" . -}}
{{- include "lib.error.noKey" (dict "ctx" . "key" "key") -}}
{{- $data := (index .ctx.Values.services .key) -}}
{{- if not $data }} {{- /* if[1] */}}
{{- fail (printf "entry %s is not found in services" .key) }}
{{- else -}} {{- /* .if[1] */ -}}
{{ toYaml $data }}
{{- end -}} {{- /* /if[1] */ -}}
{{- end -}} {{- /* /define[0] */ -}}