mirror of
https://github.com/truenas/charts.git
synced 2026-04-05 11:48:55 +08:00
Add method to retrieve image/annotations and secrets configuration
This commit is contained in:
6
library/common/templates/lib/chart/_annotations.tpl
Normal file
6
library/common/templates/lib/chart/_annotations.tpl
Normal file
@@ -0,0 +1,6 @@
|
||||
{{/*
|
||||
Common workload annotations
|
||||
*/}}
|
||||
{{- define "common.annotations" -}}
|
||||
rollme: {{ randAlphaNum 5 | quote }}
|
||||
{{- end -}}
|
||||
@@ -5,8 +5,17 @@ Render environment variables
|
||||
{{- $values := . -}}
|
||||
{{- include "common.schema.validateKeys" (dict "values" $values "checkKeys" (list "environmentVariables")) -}}
|
||||
{{- range $envVariable := $values.environmentVariables -}}
|
||||
{{- include "common.schema.validateKeys" (dict "values" $envVariable "checkKeys" (list "name" "value")) -}}
|
||||
{{- include "common.schema.validateKeys" (dict "values" $envVariable "checkKeys" (list "name")) -}}
|
||||
- name: {{ $envVariable.name }}
|
||||
{{- if $envVariable.valueFromSecret -}}
|
||||
{{- include "common.schema.validateKeys" (dict "values" $envVariable "checkKeys" (list "secretName" "secretKey")) -}}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $envVariable.secretName }}
|
||||
key: {{ $envVariable.secretKey }}
|
||||
{{- else -}}
|
||||
{{- include "common.schema.validateKeys" (dict "values" $envVariable "checkKeys" (list "value")) -}}
|
||||
value: {{ $envVariable.value }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
9
library/common/templates/lib/containers/_image.tpl
Normal file
9
library/common/templates/lib/containers/_image.tpl
Normal file
@@ -0,0 +1,9 @@
|
||||
{{/*
|
||||
Retrieve image configuration for container
|
||||
*/}}
|
||||
{{- define "common.containers.imageConfig" -}}
|
||||
{{- $values := . -}}
|
||||
{{- include "common.schema.validateKeys" (dict "values" $values "checkKeys" (list "repository" "tag" "pullPolicy")) -}}
|
||||
image: "{{ $values.repository }}:{{ $values.tag }}"
|
||||
imagePullPolicy: {{ $values.pullPolicy }}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user