rancher-partner-charts/charts/crowdstrike/falcon-sensor/templates/container_secret.yaml

37 lines
1.3 KiB
YAML

{{- if .Values.container.enabled }}
{{- if .Values.container.image.pullSecrets.enable }}
{{- if not .Values.container.image.pullSecrets.name }}
{{- $registry := .Values.container.image.pullSecrets.registryConfigJSON }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.container.image.pullSecrets.name | default (printf "%s-pull-secret" (include "falcon-sensor.fullname" .)) }}
namespace: {{ .Release.Namespace }}
data:
.dockerconfigjson: {{ $registry }}
type: kubernetes.io/dockerconfigjson
{{- if or .Values.container.image.pullSecrets.namespaces .Values.container.image.pullSecrets.allNamespaces }}
{{- $name := ( .Values.container.image.pullSecrets.name | default (printf "%s-pull-secret" (include "falcon-sensor.fullname" .))) }}
{{- $myns := split "," .Values.container.image.pullSecrets.namespaces -}}
{{- if .Values.container.image.pullSecrets.allNamespaces }}
{{- $myns = list -}}
{{- range $index, $ns := (lookup "v1" "Namespace" "" "").items -}}
{{ $myns = append $myns $ns.metadata.name }}
{{- end }}
{{- end }}
{{- range $value := $myns }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $name }}
namespace: {{ $value }}
data:
.dockerconfigjson: {{ $registry }}
type: kubernetes.io/dockerconfigjson
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}