Move reusable macros to root chart (#218)

This patch adds the start of a library to help reduce code duplication.
It will be split out to its own library chart at the same time the other
charts are split out.

---------

Signed-off-by: Kevin Fox <[email protected]>
This commit is contained in:
kfox1111
2023-04-18 08:54:46 +02:00
committed by GitHub
parent 3fc81780d9
commit 3cc8955429
20 changed files with 69 additions and 152 deletions
@@ -72,19 +72,6 @@ Create the name of the service account to use
{{- end }}
{{- end }}
{{- define "spiffe-csi-driver.image" -}}
{{- if eq (substr 0 7 .image.version) "sha256:" -}}
{{- printf "%s/%s@%s" .image.registry .image.repository .image.version -}}
{{- else if .appVersion -}}
{{- printf "%s/%s:%s" .image.registry .image.repository (default .appVersion .image.version) -}}
{{- else if .image.version -}}
{{- printf "%s/%s:%s" .image.registry .image.repository .image.version -}}
{{- else -}}
{{- printf "%s/%s" .image.registry .image.repository -}}
{{- end -}}
{{- end }}
{{- define "spiffe-csi-driver.agent-socket-path" -}}
{{- print .Values.agentSocketPath }}
{{- end }}
@@ -31,7 +31,7 @@ spec:
containers:
# This is the container which runs the SPIFFE CSI driver.
- name: {{ .Chart.Name }}
image: {{ template "spiffe-csi-driver.image" (dict "appVersion" $.Chart.AppVersion "image" .Values.image) }}
image: {{ template "spire-lib.image" (dict "appVersion" $.Chart.AppVersion "image" .Values.image) }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: [
"-workload-api-socket-dir", "/spire-agent-socket",
@@ -71,7 +71,7 @@ spec:
# of all the little details required to register a CSI driver with
# the kubelet.
- name: node-driver-registrar
image: {{ template "spiffe-csi-driver.image" .Values.nodeDriverRegistrar }}
image: {{ template "spire-lib.image" .Values.nodeDriverRegistrar }}
imagePullPolicy: {{ .Values.nodeDriverRegistrar.image.pullPolicy }}
args: [
"-csi-address", "/spiffe-csi/csi.sock",