-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e58b70
commit 34bc684
Showing
7 changed files
with
139 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{{/* 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 := false -}} | ||
{{- range $name, $configmap := .Values.configmap -}} | ||
{{- if $configmap.enabled -}} | ||
{{- $configMapsFound = true -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- if $configMapsFound -}} | ||
{{- printf "checksum/config: %v" (include ("common.configmap") . | sha256sum) | nindent 0 -}} | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{/* 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 -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{{/* 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 -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{{/* Expand the name of the chart */}} | ||
{{- define "common.names.name" -}} | ||
{{- $globalNameOverride := "" -}} | ||
{{- if hasKey .Values "global" -}} | ||
{{- $globalNameOverride = (default $globalNameOverride .Values.global.nameOverride) -}} | ||
{{- end -}} | ||
{{- default .Chart.Name (default .Values.nameOverride $globalNameOverride) | 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 "common.names.fullname" -}} | ||
{{- $name := include "common.names.name" . -}} | ||
{{- $globalFullNameOverride := "" -}} | ||
{{- if hasKey .Values "global" -}} | ||
{{- $globalFullNameOverride = (default $globalFullNameOverride .Values.global.fullnameOverride) -}} | ||
{{- end -}} | ||
{{- if or .Values.fullnameOverride $globalFullNameOverride -}} | ||
{{- $name = default .Values.fullnameOverride $globalFullNameOverride -}} | ||
{{- else -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- $name = .Release.Name -}} | ||
{{- else -}} | ||
{{- $name = printf "%s-%s" .Release.Name $name -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- trunc 63 $name | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* Create chart name and version as used by the chart label */}} | ||
{{- define "common.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" -}} | ||
{{- if .Values.serviceAccount.create -}} | ||
{{- default (include "common.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 -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{{/* 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 -}} |