no message
This commit is contained in:
@ -0,0 +1,146 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for DaemonSet objects.
|
||||
*/}}
|
||||
{{- define "common.capabilities.daemonset.apiVersion" -}}
|
||||
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "apps/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Waiting on https://github.com/helm/helm/pull/8608
|
||||
{{- define "common.capabilities.daemonset.apiVersion" -}}
|
||||
{{- if .Capabilities.APIVersions.Has "apps/v1/DaemonSet" -}}
|
||||
{{- print "apps/v1" -}}
|
||||
{{- else -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
*/}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for Deployment objects.
|
||||
*/}}
|
||||
{{- define "common.capabilities.deployment.apiVersion" -}}
|
||||
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "apps/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Waiting on https://github.com/helm/helm/pull/8608
|
||||
{{- define "common.capabilities.deployment.apiVersion" -}}
|
||||
{{- if .Capabilities.APIVersions.Has "apps/v1/Deployment" -}}
|
||||
{{- print "apps/v1" -}}
|
||||
{{- else -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
*/}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for StatefulSet objects.
|
||||
*/}}
|
||||
{{- define "common.capabilities.statefulset.apiVersion" -}}
|
||||
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "apps/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "apps/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Waiting on https://github.com/helm/helm/pull/8608
|
||||
{{- define "common.capabilities.statefulset.apiVersion" -}}
|
||||
{{- if .Capabilities.APIVersions.Has "apps/v1/StatefulSet" -}}
|
||||
{{- print "apps/v1" -}}
|
||||
{{- else -}}
|
||||
{{- print "apps/v1beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
*/}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for Ingress objects.
|
||||
*/}}
|
||||
|
||||
{{- define "common.capabilities.ingress.apiVersion" -}}
|
||||
{{- if .Values.ingress.apiVersion -}}
|
||||
{{- .Values.ingress.apiVersion -}}
|
||||
{{- else if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- else if semverCompare "<1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "networking.k8s.io/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "networking.k8s.io/v1" -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Waiting on https://github.com/helm/helm/pull/8608
|
||||
{{- define "common.capabilities.ingress.apiVersion" -}}
|
||||
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
|
||||
{{- print "networking.k8s.io/v1" -}}
|
||||
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" -}}
|
||||
{{- print "networking.k8s.io/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
*/}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for RBAC resources.
|
||||
*/}}
|
||||
{{- define "common.capabilities.rbac.apiVersion" -}}
|
||||
{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||
{{- print "rbac.authorization.k8s.io/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "rbac.authorization.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for CRDs.
|
||||
*/}}
|
||||
{{- define "common.capabilities.crd.apiVersion" -}}
|
||||
{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||
{{- print "apiextensions.k8s.io/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "apiextensions.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Returns true if the used Helm version is 3.3+.
|
||||
A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure.
|
||||
This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error.
|
||||
**To be removed when the catalog's minimun Helm version is 3.3**
|
||||
*/}}
|
||||
{{- define "common.capabilities.supportsHelmVersion" -}}
|
||||
{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,38 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Through error when upgrading using empty passwords values that must not be empty.
|
||||
|
||||
Usage:
|
||||
{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
|
||||
{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
|
||||
{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
|
||||
|
||||
Required password params:
|
||||
- validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
|
||||
- context - Context - Required. Parent context.
|
||||
*/}}
|
||||
{{- define "common.errors.upgrade.passwords.empty" -}}
|
||||
{{- $validationErrors := join "" .validationErrors -}}
|
||||
{{- if and $validationErrors .context.Release.IsUpgrade -}}
|
||||
{{- $errorString := "\nPASSWORDS ERROR: you must provide your current passwords when upgrade the release%s" -}}
|
||||
{{- printf $errorString $validationErrors | fail -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,65 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Return the proper image name
|
||||
{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }}
|
||||
*/}}
|
||||
{{- define "common.images.image" -}}
|
||||
{{- $registryName := .imageRoot.registry -}}
|
||||
{{- $repositoryName := .imageRoot.repository -}}
|
||||
{{- $tag := .imageRoot.tag | toString -}}
|
||||
{{- if .global }}
|
||||
{{- if .global.imageRegistry }}
|
||||
{{- $registryName = .global.imageRegistry -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $registryName }}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s:%s" $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names
|
||||
{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }}
|
||||
*/}}
|
||||
{{- define "common.images.pullSecrets" -}}
|
||||
{{- $pullSecrets := list }}
|
||||
|
||||
{{- if .global }}
|
||||
{{- range .global.imagePullSecrets -}}
|
||||
{{- $pullSecrets = append $pullSecrets . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range .images -}}
|
||||
{{- range .pullSecrets -}}
|
||||
{{- $pullSecrets = append $pullSecrets . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (not (empty $pullSecrets)) }}
|
||||
imagePullSecrets:
|
||||
{{- range $pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
@ -0,0 +1,55 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
{{/*
|
||||
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 }}
|
||||
{{- 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 }}
|
||||
|
||||
|
||||
## Bitnami Compatibility links
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Kubernetes standard labels
|
||||
*/}}
|
||||
{{- define "common.labels.standard" -}}
|
||||
{{ include "common.labels" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
|
||||
*/}}
|
||||
{{- define "common.labels.matchLabels" -}}
|
||||
{{ include "common.labels.selectorLabels" . }}
|
||||
{{- end -}}
|
@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "common.names.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 "common.names.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 "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 }}
|
@ -0,0 +1,80 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Print instructions to get a secret value.
|
||||
Usage:
|
||||
{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.utils.secret.getvalue" -}}
|
||||
{{- $varname := include "common.utils.fieldToEnvVar" . -}}
|
||||
export {{ $varname }}=$(kubectl get secret --namespace {{ .context.Release.Namespace | quote }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 --decode)
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Build env var name given a field
|
||||
Usage:
|
||||
{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }}
|
||||
*/}}
|
||||
{{- define "common.utils.fieldToEnvVar" -}}
|
||||
{{- $fieldNameSplit := splitList "-" .field -}}
|
||||
{{- $upperCaseFieldNameSplit := list -}}
|
||||
|
||||
{{- range $fieldNameSplit -}}
|
||||
{{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ join "_" $upperCaseFieldNameSplit }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Gets a value from .Values given
|
||||
Usage:
|
||||
{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.utils.getValueFromKey" -}}
|
||||
{{- $splitKey := splitList "." .key -}}
|
||||
{{- $value := "" -}}
|
||||
{{- $latestObj := $.context.Values -}}
|
||||
{{- range $splitKey -}}
|
||||
{{- if not $latestObj -}}
|
||||
{{- printf "please review the entire path of '%s' exists in values" $.key | fail -}}
|
||||
{{- end -}}
|
||||
{{- $value = ( index $latestObj . ) -}}
|
||||
{{- $latestObj = $value -}}
|
||||
{{- end -}}
|
||||
{{- printf "%v" (default "" $value) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Returns first .Values key with a defined value or first of the list if all non-defined
|
||||
Usage:
|
||||
{{ include "common.utils.getKeyFromList" (dict "keys" (list "path.to.key1" "path.to.key2") "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.utils.getKeyFromList" -}}
|
||||
{{- $key := first .keys -}}
|
||||
{{- $reverseKeys := reverse .keys }}
|
||||
{{- range $reverseKeys }}
|
||||
{{- $value := include "common.utils.getValueFromKey" (dict "key" . "context" $.context ) }}
|
||||
{{- if $value -}}
|
||||
{{- $key = . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- printf "%s" $key -}}
|
||||
{{- end -}}
|
@ -0,0 +1,29 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
{{/*
|
||||
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 }}
|
@ -0,0 +1,92 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
|
||||
{{- /*
|
||||
The main container included in the controller.
|
||||
*/ -}}
|
||||
{{- define "common.controller.mainContainer" -}}
|
||||
- name: {{ include "common.names.fullname" . }}
|
||||
image: "{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- with .Values.command }}
|
||||
command: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.args }}
|
||||
args: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: PUID
|
||||
value: {{ .Values.PUID | quote }}
|
||||
- name: PGID
|
||||
value: {{ .Values.PGID | quote }}
|
||||
- name: UMASK
|
||||
value: {{ .Values.UMASK | quote }}
|
||||
{{- if .Values.timezone }}
|
||||
- name: TZ
|
||||
value: {{ .Values.timezone | quote }}
|
||||
{{- end }}
|
||||
{{- if or .Values.env .Values.envTpl .Values.envValueFrom .Values.envVariable .Values.environmentVariables }}
|
||||
{{- range $envVariable := .Values.environmentVariables }}
|
||||
{{- if and $envVariable.name $envVariable.value }}
|
||||
- name: {{ $envVariable.name }}
|
||||
value: {{ $envVariable.value | quote }}
|
||||
{{- else }}
|
||||
{{- fail "Please specify name/value for environment variable" }}
|
||||
{{- end }}
|
||||
{{- end}}
|
||||
{{- range $key, $value := .Values.env }}
|
||||
- name: {{ $key }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.envTpl }}
|
||||
- name: {{ $key }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.envValueFrom }}
|
||||
- name: {{ $key }}
|
||||
valueFrom:
|
||||
{{- $value | toYaml | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.envFrom }}
|
||||
envFrom:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- include "common.controller.ports" . | trim | nindent 2 }}
|
||||
|
||||
{{- with (include "common.controller.volumeMounts" . | trim) }}
|
||||
volumeMounts:
|
||||
{{- . | nindent 2 }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{- include "common.controller.probes" . | nindent 2 }}
|
||||
resources:
|
||||
{{- with .Values.resources }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.gpuConfiguration }}
|
||||
limits:
|
||||
{{- toYaml .Values.gpuConfiguration | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
@ -0,0 +1,69 @@
|
||||
{{- /*
|
||||
The pod definition included in the controller.
|
||||
*/ -}}
|
||||
{{- define "common.controller.pod" -}}
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "common.names.serviceAccountName" . }}
|
||||
{{- with .Values.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.priorityClassName }}
|
||||
priorityClassName: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.schedulerName }}
|
||||
schedulerName: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.hostNetwork }}
|
||||
hostNetwork: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.hostname }}
|
||||
hostname: {{ . }}
|
||||
{{- end }}
|
||||
{{- if .Values.dnsPolicy }}
|
||||
{{- with .Values.dnsPolicy }}
|
||||
dnsPolicy: {{ . }}
|
||||
{{- end }}
|
||||
{{- else if .Values.hostNetwork }}
|
||||
dnsPolicy: "ClusterFirstWithHostNet"
|
||||
{{- else }}
|
||||
dnsPolicy: ClusterFirst
|
||||
{{- end }}
|
||||
{{- with .Values.dnsConfig }}
|
||||
dnsConfig:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
enableServiceLinks: {{ .Values.enableServiceLinks }}
|
||||
{{- with .Values.initContainers }}
|
||||
initContainers:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
{{- include "common.controller.mainContainer" . | nindent 0 }}
|
||||
{{- with .Values.additionalContainers }}
|
||||
{{- toYaml . | nindent 0 }}
|
||||
{{- end }}
|
||||
{{- with (include "common.controller.volumes" . | trim) }}
|
||||
volumes:
|
||||
{{- . | nindent 0 }}
|
||||
{{- end }}
|
||||
{{- with .Values.hostAliases }}
|
||||
hostAliases:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
@ -0,0 +1,76 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
|
||||
{{/*
|
||||
Ports included by the controller.
|
||||
*/}}
|
||||
{{- define "common.controller.ports" -}}
|
||||
{{- $ports := list -}}
|
||||
{{/* append the ports for each appAdditionalService - TrueCharts */}}
|
||||
{{- if $.Values.services -}}
|
||||
{{- range $name, $_ := $.Values.services }}
|
||||
{{- if or ( .enabled ) ( eq $name "main" ) -}}
|
||||
{{- if eq $name "main" -}}
|
||||
{{- $_ := set .port "name" (default "http" .port.name) -}}
|
||||
{{- else if kindIs "string" $name -}}
|
||||
{{- $_ := set .port "name" (default .port.name | default $name) -}}
|
||||
{{- else -}}
|
||||
{{- $_ := set .port "name" (required "Missing port.name" .port.name) -}}
|
||||
{{- end -}}
|
||||
{{- $ports = mustAppend $ports .port -}}
|
||||
{{- range $_ := .additionalPorts -}}
|
||||
{{/* append the additonalPorts for each additional service */}}
|
||||
{{- $ports = mustAppend $ports . -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $.Values.additionalServices -}}
|
||||
{{- range $_ := $.Values.additionalServices }}
|
||||
{{- if .enabled -}}
|
||||
{{- $_ := set .port "name" (required "Missing port.name" .port.name) -}}
|
||||
{{- $ports = mustAppend $ports .port -}}
|
||||
{{- range $_ := .additionalPorts -}}
|
||||
{{/* append the additonalPorts for each additional service */}}
|
||||
{{- $ports = mustAppend $ports . -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* export/render the list of ports */}}
|
||||
{{- if $ports -}}
|
||||
ports:
|
||||
{{- range $_ := $ports }}
|
||||
{{- $protocol := "" -}}
|
||||
{{- if or ( eq .protocol "HTTP" ) ( eq .protocol "HTTPS" ) }}
|
||||
{{- $protocol = "TCP" -}}
|
||||
{{- else }}
|
||||
{{- $protocol = .protocol | default "TCP" -}}
|
||||
{{- end }}
|
||||
- name: {{ required "The port's 'name' is not defined" .name }}
|
||||
{{- if and .targetPort (kindIs "string" .targetPort) }}
|
||||
{{- fail (printf "Our charts do not support named ports for targetPort. (port name %s, targetPort %s)" .name .targetPort) }}
|
||||
{{- end }}
|
||||
containerPort: {{ .targetPort | default .port }}
|
||||
protocol: {{ $protocol | default "TCP" }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,41 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
|
||||
{{/*
|
||||
Probes selection logic.
|
||||
*/}}
|
||||
{{- define "common.controller.probes" -}}
|
||||
{{- $svcPort := .Values.services.main.port.name -}}
|
||||
{{- range $probeName, $probe := .Values.probes }}
|
||||
{{- if $probe.enabled -}}
|
||||
{{- "" | nindent 0 }}
|
||||
{{- $probeName }}Probe:
|
||||
{{- if $probe.custom -}}
|
||||
{{- $probe.spec | toYaml | nindent 2 }}
|
||||
{{- else }}
|
||||
{{- "tcpSocket:" | nindent 2 }}
|
||||
{{- printf "port: %v" $svcPort | nindent 4 }}
|
||||
{{- printf "initialDelaySeconds: %v" $probe.spec.initialDelaySeconds | nindent 2 }}
|
||||
{{- printf "failureThreshold: %v" $probe.spec.failureThreshold | nindent 2 }}
|
||||
{{- printf "timeoutSeconds: %v" $probe.spec.timeoutSeconds | nindent 2 }}
|
||||
{{- printf "periodSeconds: %v" $probe.spec.periodSeconds | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@ -0,0 +1,62 @@
|
||||
|
||||
{{/*
|
||||
Volumes included by the controller.
|
||||
*/}}
|
||||
{{- define "common.controller.volumeMounts" -}}
|
||||
{{- range $index, $PVC := .Values.persistence }}
|
||||
{{- if and ( $PVC.enabled ) ( $PVC.mountPath ) }}
|
||||
- mountPath: {{ $PVC.mountPath }}
|
||||
name: {{ $index }}
|
||||
{{- if $PVC.subPath }}
|
||||
subPath: {{ $PVC.subPath }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{ range $name, $dmm := .Values.deviceMounts }}
|
||||
{{- if $dmm.enabled -}}
|
||||
{{ if $dmm.name }}
|
||||
{{ $name = $dmm.name }}
|
||||
{{ end }}
|
||||
- name: devicemount-{{ $name }}
|
||||
mountPath: {{ $dmm.devicePath }}
|
||||
{{ if $dmm.subPath }}
|
||||
subPath: {{ $dmm.subPath }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
|
||||
{{ range $name, $csm := .Values.customStorage }}
|
||||
{{- if $csm.enabled -}}
|
||||
{{ if $csm.name }}
|
||||
{{ $name = $csm.name }}
|
||||
{{ end }}
|
||||
- name: customstorage-{{ $name }}
|
||||
mountPath: {{ $csm.mountPath }}
|
||||
{{ if $csm.subPath }}
|
||||
subPath: {{ $csm.subPath }}
|
||||
{{ end }}
|
||||
{{ if $csm.readOnly }}
|
||||
readOnly: {{ $csm.readOnly }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{- if .Values.additionalVolumeMounts }}
|
||||
{{- toYaml .Values.additionalVolumeMounts | nindent 0 }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{- if eq .Values.controllerType "statefulset" }}
|
||||
{{- range $index, $vct := .Values.volumeClaimTemplates }}
|
||||
- mountPath: {{ $vct.mountPath }}
|
||||
name: {{ $vct.name }}
|
||||
{{- if $vct.subPath }}
|
||||
subPath: {{ $vct.subPath }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- end -}}
|
@ -0,0 +1,84 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
|
||||
{{/*
|
||||
Volumes included by the controller.
|
||||
*/}}
|
||||
{{- define "common.controller.volumes" -}}
|
||||
{{- range $index, $persistence := .Values.persistence }}
|
||||
{{- if $persistence.enabled }}
|
||||
- name: {{ $index }}
|
||||
{{- if $persistence.existingClaim }}
|
||||
{{- /* Always prefer an existingClaim if that is set */}}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ $persistence.existingClaim }}
|
||||
{{- else -}}
|
||||
{{- if $persistence.emptyDir -}}
|
||||
{{- /* Always prefer an emptyDir next if that is set */}}
|
||||
emptyDir: {}
|
||||
{{- else -}}
|
||||
{{- /* Otherwise refer to the PVC name */}}
|
||||
persistentVolumeClaim:
|
||||
{{- if $persistence.nameOverride }}
|
||||
claimName: {{ $persistence.nameOverride }}
|
||||
{{- else if $persistence.nameSuffix }}
|
||||
claimName: {{ printf "%s-%s" (include "common.names.fullname" $) $persistence.nameSuffix }}
|
||||
{{- else }}
|
||||
claimName: {{ printf "%s-%s" (include "common.names.fullname" $) $index }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- range $name, $dm := .Values.deviceMounts -}}
|
||||
{{ if $dm.enabled }}
|
||||
{{ if $dm.name }}
|
||||
{{ $name = $dm.name }}
|
||||
{{ end }}
|
||||
- name: devicemount-{{ $name }}
|
||||
{{ if $dm.emptyDir }}
|
||||
emptyDir: {}
|
||||
{{- else -}}
|
||||
hostPath:
|
||||
path: {{ required "hostPath not set" $dm.devicePath }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $name, $cs := .Values.customStorage -}}
|
||||
{{ if $cs.enabled }}
|
||||
{{ if $cs.name }}
|
||||
{{ $name = $cs.name }}
|
||||
{{ end }}
|
||||
- name: customstorage-{{ $name }}
|
||||
{{ if $cs.emptyDir }}
|
||||
emptyDir: {}
|
||||
{{- else -}}
|
||||
hostPath:
|
||||
path: {{ required "hostPath not set" $cs.hostPath }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- if .Values.additionalVolumes }}
|
||||
{{- toYaml .Values.additionalVolumes | nindent 0 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
@ -0,0 +1,32 @@
|
||||
{{/*
|
||||
Retrieve true/false if certificate is configured
|
||||
*/}}
|
||||
{{- define "common.resources.cert.available" -}}
|
||||
{{- if .ObjectValues.certHolder.certificate -}}
|
||||
{{- $values := (. | mustDeepCopy) -}}
|
||||
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.ObjectValues.certHolder.certificate) -}}
|
||||
{{- template "common.resources.cert_present" $values -}}
|
||||
{{- else -}}
|
||||
{{- false -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Retrieve public key of certificate
|
||||
*/}}
|
||||
{{- define "common.resources.cert.publicKey" -}}
|
||||
{{- $values := (. | mustDeepCopy) -}}
|
||||
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.ObjectValues.certHolder.certificate "publicKey" true) -}}
|
||||
{{ include "common.resources.cert" $values }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Retrieve private key of certificate
|
||||
*/}}
|
||||
{{- define "common.resources.cert.privateKey" -}}
|
||||
{{- $values := (. | mustDeepCopy) -}}
|
||||
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.ObjectValues.certHolder.certificate) -}}
|
||||
{{ include "common.resources.cert" $values }}
|
||||
{{- end -}}
|
@ -0,0 +1,25 @@
|
||||
{{- define "common.resources.cert.secret" -}}
|
||||
|
||||
|
||||
{{- $secretName := include "common.names.fullname" . -}}
|
||||
|
||||
{{- if .ObjectValues.certHolder -}}
|
||||
{{- if hasKey .ObjectValues.certHolder "nameSuffix" -}}
|
||||
{{- $secretName = printf "%v-%v" $secretName .ObjectValues.certHolder.nameSuffix -}}
|
||||
{{ end -}}
|
||||
{{ else }}
|
||||
{{- $_ := set $ "ObjectValues" (dict "certHolder" .Values) -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if eq (include "common.resources.cert.available" $ ) "true" -}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ $secretName }}
|
||||
labels: {{ include "common.labels" . | nindent 4 }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: {{ (include "common.resources.cert.publicKey" $ ) | toString | b64enc | quote }}
|
||||
tls.key: {{ (include "common.resources.cert.privateKey" $ ) | toString | b64enc | quote }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,24 @@
|
||||
{{/*
|
||||
Retrieve true/false if certificate is available in ixCertificates
|
||||
*/}}
|
||||
{{- define "common.resources.cert_present" -}}
|
||||
{{- $values := . -}}
|
||||
{{- hasKey $values.Values.ixCertificates ($values.commonCertOptions.certKeyName | toString) -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Retrieve certificate from variable name
|
||||
*/}}
|
||||
{{- define "common.resources.cert" -}}
|
||||
{{- $values := . -}}
|
||||
{{- $certKey := ($values.commonCertOptions.certKeyName | toString) -}}
|
||||
{{- if hasKey $values.Values.ixCertificates $certKey -}}
|
||||
{{- $cert := get $values.Values.ixCertificates $certKey -}}
|
||||
{{- if $values.commonCertOptions.publicKey -}}
|
||||
{{ $cert.certificate }}
|
||||
{{- else -}}
|
||||
{{ $cert.privatekey }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -0,0 +1,64 @@
|
||||
{{- define "common.resources.portal" -}}
|
||||
|
||||
{{- if .Values.portal }}
|
||||
{{- if .Values.portal.enabled }}
|
||||
{{- $host := "$node_ip" }}
|
||||
{{- $port := 443 }}
|
||||
{{- $protocol := "https" }}
|
||||
{{- $portProtocol := "" }}
|
||||
|
||||
{{- if hasKey .Values "ingress" }}
|
||||
{{- if hasKey .Values.ingress "main" -}}
|
||||
{{- if .Values.ingress.main.host }}
|
||||
{{- $host = .Values.ingress.main.host }}
|
||||
{{- else }}
|
||||
{{- range .Values.ingress.main.hosts }}
|
||||
{{- $host = ( .host | quote ) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and ( .Values.portal.ingressPort ) ( ne $host "$node_ip" ) }}
|
||||
{{- $port = .Values.portal.ingressPort }}
|
||||
{{- else if and ( eq $host "$node_ip" ) ( hasKey .Values "services" ) }}
|
||||
{{- if hasKey .Values.services "main" }}
|
||||
{{- if and (hasKey .Values.services.main.port "nodePort" ) ( eq .Values.services.main.type "NodePort" ) }}
|
||||
{{- $port = .Values.services.main.port.nodePort }}
|
||||
{{- if or ( eq .Values.services.main.port.protocol "HTTP" ) ( eq .Values.services.main.port.protocol "HTTPS" ) }}
|
||||
{{- $portProtocol = .Values.services.main.port.protocol }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and ( $portProtocol ) ( eq $host "$node_ip" ) }}
|
||||
{{- $protocol = $portProtocol }}
|
||||
{{- else if and ( ne $host "$node_ip" ) }}
|
||||
{{- if .Values.ingress.main.certType }}
|
||||
{{- if eq .Values.ingress.main.certType "" }}
|
||||
{{- $protocol = "http" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and ( .Values.portal.host ) ( eq $host "$node_ip" ) }}
|
||||
{{- $host = .Values.portal.host }}
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: portal
|
||||
labels: {{ include "common.labels" . | nindent 4 }}
|
||||
data:
|
||||
protocol: {{ $protocol }}
|
||||
host: {{ $host }}
|
||||
port: {{ $port | quote }}
|
||||
url: {{ printf "%v%v%v%v%v" $protocol "://" $host ":" $port }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
@ -0,0 +1,77 @@
|
||||
{{/*
|
||||
This template serves as the blueprint for the mountPermissions job that is run
|
||||
before chart installation.
|
||||
*/}}
|
||||
{{- define "common.storage.permissions" -}}
|
||||
{{- if .Values.fixMountPermissions }}
|
||||
|
||||
|
||||
{{- $jobName := include "common.names.fullname" . -}}
|
||||
{{- $values := .Values -}}
|
||||
|
||||
|
||||
{{- print "---" | nindent 0 -}}
|
||||
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ $jobName }}-autopermissions
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install,pre-upgrade
|
||||
"helm.sh/hook-weight": "-10"
|
||||
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed,before-hook-creation
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: set-mount-permissions
|
||||
image: "alpine:3.3"
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- | {{ range $index, $cs := .Values.customStorage}}{{ if and $cs.enabled $cs.setPermissions}}
|
||||
chown -R {{ if eq $values.podSecurityContext.runAsNonRoot false }}{{ print $values.PUID }}{{ else }}{{ print $values.podSecurityContext.runAsUser }}{{ end }}:{{ print $values.podSecurityContext.fsGroup }} {{ print $cs.mountPath }}{{ end }}{{ end }}
|
||||
#args:
|
||||
#
|
||||
#securityContext:
|
||||
#
|
||||
volumeMounts:
|
||||
{{ range $name, $csm := .Values.customStorage }}
|
||||
{{- if $csm.enabled -}}
|
||||
{{- if $csm.setPermissions -}}
|
||||
{{ if $csm.name }}
|
||||
{{ $name = $csm.name }}
|
||||
{{ end }}
|
||||
- name: customstorage-{{ $name }}
|
||||
mountPath: {{ $csm.mountPath }}
|
||||
{{ if $csm.subPath }}
|
||||
subPath: {{ $csm.subPath }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
volumes:
|
||||
{{- range $name, $cs := .Values.customStorage -}}
|
||||
{{ if $cs.enabled }}
|
||||
{{ if $cs.setPermissions }}
|
||||
{{ if $cs.name }}
|
||||
{{ $name = $cs.name }}
|
||||
{{ end }}
|
||||
- name: customstorage-{{ $name }}
|
||||
{{ if $cs.emptyDir }}
|
||||
emptyDir: {}
|
||||
{{- else -}}
|
||||
hostPath:
|
||||
path: {{ required "hostPath not set" $cs.hostPath }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
Reference in New Issue
Block a user