mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
feat(common)!: Release version 1.0.0 (#68)
- Removed: **BREAKING**: Removed support for HorizontalPodAutoscaler - Added: Support services have extraSelectorLabels (#58) - Added: support for `httpGet` probes - Added: support for setting labels / annotations on volumeClaimTemplates - Changed: **BREAKING**: Restructure of template components. All Helm templates have been renamed / namespaced. E.g. `common.values.setup` has now become `bjw-s.common.loader.init`. - Changed: **BREAKING**: Raised minimum supported k8s version to 1.22 - Changed: **BREAKING**: Renamed `configmap` key to `configMaps` - Changed: **BREAKING**: Moved `serviceMonitor` from `service` to its own key - Changed: **BREAKING**: Renamed `secret` key to `secrets`, which now works similar to `configMaps` - Changed: Updated code-server image to v4.8.2 - Changed: Updated gluetun image to v3.32.0 - Fixed: Fix NOTES always showing ingress protocol as http (#62) Signed-off-by: Gavin Mogan <git@gavinmogan.com> Co-authored-by: Gavin Mogan <github@gavinmogan.com> Co-authored-by: Gabe Cook <gabe565@gmail.com>
This commit is contained in:
parent
98ee81df4e
commit
ae4233c77f
94 changed files with 1126 additions and 976 deletions
|
@ -1,27 +0,0 @@
|
|||
{{/* Common annotations shared across objects */}}
|
||||
{{- define "common.annotations" -}}
|
||||
{{- with .Values.global.annotations }}
|
||||
{{- range $k, $v := . }}
|
||||
{{- $name := $k }}
|
||||
{{- $value := tpl $v $ }}
|
||||
{{ $name }}: {{ quote $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Determine the Pod annotations used in the controller */}}
|
||||
{{- define "common.podAnnotations" -}}
|
||||
{{- if .Values.podAnnotations -}}
|
||||
{{- tpl (toYaml .Values.podAnnotations) . | nindent 0 -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $configMapsFound := dict -}}
|
||||
{{- range $name, $configmap := .Values.configmap -}}
|
||||
{{- if $configmap.enabled -}}
|
||||
{{- $_ := set $configMapsFound $name (toYaml $configmap.data | sha256sum) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $configMapsFound -}}
|
||||
{{- printf "checksum/config: %v" (toYaml $configMapsFound | sha256sum) | nindent 0 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -1,19 +0,0 @@
|
|||
{{/* Allow KubeVersion to be overridden. */}}
|
||||
{{- define "common.capabilities.ingress.kubeVersion" -}}
|
||||
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Return the appropriate apiVersion for Ingress objects */}}
|
||||
{{- define "common.capabilities.ingress.apiVersion" -}}
|
||||
{{- print "networking.k8s.io/v1" -}}
|
||||
{{- if semverCompare "<1.19" (include "common.capabilities.ingress.kubeVersion" .) -}}
|
||||
{{- print "beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Check Ingress stability */}}
|
||||
{{- define "common.capabilities.ingress.isStable" -}}
|
||||
{{- if eq (include "common.capabilities.ingress.apiVersion" .) "networking.k8s.io/v1" -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -1,22 +0,0 @@
|
|||
{{/* Common labels shared across objects */}}
|
||||
{{- define "common.labels" -}}
|
||||
helm.sh/chart: {{ include "common.names.chart" . }}
|
||||
{{ include "common.labels.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- with .Values.global.labels }}
|
||||
{{- range $k, $v := . }}
|
||||
{{- $name := $k }}
|
||||
{{- $value := tpl $v $ }}
|
||||
{{ $name }}: {{ quote $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Selector labels shared across objects */}}
|
||||
{{- define "common.labels.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
|
@ -1,5 +1,5 @@
|
|||
{{/* Expand the name of the chart */}}
|
||||
{{- define "common.names.name" -}}
|
||||
{{- define "bjw-s.common.lib.chart.names.name" -}}
|
||||
{{- $globalNameOverride := "" -}}
|
||||
{{- if hasKey .Values "global" -}}
|
||||
{{- $globalNameOverride = (default $globalNameOverride .Values.global.nameOverride) -}}
|
||||
|
@ -12,8 +12,8 @@ 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 "common.names.fullname" -}}
|
||||
{{- $name := include "common.names.name" . -}}
|
||||
{{- define "bjw-s.common.lib.chart.names.fullname" -}}
|
||||
{{- $name := include "bjw-s.common.lib.chart.names.name" . -}}
|
||||
{{- $globalFullNameOverride := "" -}}
|
||||
{{- if hasKey .Values "global" -}}
|
||||
{{- $globalFullNameOverride = (default $globalFullNameOverride .Values.global.fullnameOverride) -}}
|
||||
|
@ -31,28 +31,15 @@ If release name contains chart name it will be used as a full name.
|
|||
{{- end -}}
|
||||
|
||||
{{/* Create chart name and version as used by the chart label */}}
|
||||
{{- define "common.names.chart" -}}
|
||||
{{- define "bjw-s.common.lib.chart.names.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Create the name of the ServiceAccount to use */}}
|
||||
{{- define "common.names.serviceAccountName" -}}
|
||||
{{- define "bjw-s.common.lib.chart.names.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{- default (include "common.names.fullname" .) .Values.serviceAccount.name -}}
|
||||
{{- default (include "bjw-s.common.lib.chart.names.fullname" .) .Values.serviceAccount.name -}}
|
||||
{{- else -}}
|
||||
{{- default "default" .Values.serviceAccount.name -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Return the properly cased version of the controller type */}}
|
||||
{{- define "common.names.controllerType" -}}
|
||||
{{- if eq .Values.controller.type "deployment" -}}
|
||||
{{- print "Deployment" -}}
|
||||
{{- else if eq .Values.controller.type "daemonset" -}}
|
||||
{{- print "DaemonSet" -}}
|
||||
{{- else if eq .Values.controller.type "statefulset" -}}
|
||||
{{- print "StatefulSet" -}}
|
||||
{{- else -}}
|
||||
{{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
56
charts/library/common/templates/lib/chart/_notes.tpl
Normal file
56
charts/library/common/templates/lib/chart/_notes.tpl
Normal file
|
@ -0,0 +1,56 @@
|
|||
{{/*
|
||||
Default NOTES.txt content.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.lib.chart.notes" -}}
|
||||
|
||||
{{- $primaryIngress := get .Values.ingress (include "bjw-s.common.lib.ingress.primary" .) -}}
|
||||
{{- $primaryService := get .Values.service (include "bjw-s.common.lib.service.primary" .) -}}
|
||||
{{- $primaryPort := "" -}}
|
||||
{{- if $primaryService -}}
|
||||
{{- $primaryPort = get $primaryService.ports (include "bjw-s.common.lib.service.primaryPort" (dict "serviceName" (include "bjw-s.common.lib.service.primary" .) "values" $primaryService)) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $prefix := "http" -}}
|
||||
{{- if $primaryPort }}
|
||||
{{- if hasKey $primaryPort "protocol" }}
|
||||
{{- if eq $primaryPort.protocol "HTTPS" }}
|
||||
{{- $prefix = "https" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $primaryIngress }}
|
||||
1. Access the application by visiting one of these URL's:
|
||||
{{ range $primaryIngress.hosts }}
|
||||
{{- $prefix = "http" -}}
|
||||
{{ if $primaryIngress.tls -}}
|
||||
{{- $prefix = "https" -}}
|
||||
{{ end -}}
|
||||
{{- $host := .host -}}
|
||||
{{ if .hostTpl -}}
|
||||
{{- $host = tpl .hostTpl $ -}}
|
||||
{{ end }}
|
||||
{{- $path := (first .paths).path | default "/" -}}
|
||||
{{ if (first .paths).pathTpl -}}
|
||||
{{- $path = tpl (first .paths).pathTpl $ -}}
|
||||
{{ end }}
|
||||
- {{ $prefix }}://{{- $host }}{{- $path }}
|
||||
{{- end }}
|
||||
{{- else if and $primaryService $primaryPort }}
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if contains "NodePort" $primaryService.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "bjw-s.common.lib.chart.names.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo {{ $prefix }}://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" $primaryService.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ include "bjw-s.common.lib.chart.names.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "bjw-s.common.lib.chart.names.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo {{ $prefix }}://$SERVICE_IP:{{ $primaryPort.port }}
|
||||
{{- else if contains "ClusterIP" $primaryService.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "bjw-s.common.lib.chart.names.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit {{ $prefix }}://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:{{ $primaryPort.port }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
|
@ -1,9 +0,0 @@
|
|||
{{/* Merge the local chart values and the common chart defaults */}}
|
||||
{{- define "common.values.setup" -}}
|
||||
{{- if .Values.common -}}
|
||||
{{- $defaultValues := deepCopy .Values.common -}}
|
||||
{{- $userValues := deepCopy (omit .Values "common") -}}
|
||||
{{- $mergedValues := mustMergeOverwrite $defaultValues $userValues -}}
|
||||
{{- $_ := set . "Values" (deepCopy $mergedValues) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
Loading…
Add table
Add a link
Reference in a new issue