2021-05-17 22:30:18 +00:00
|
|
|
--- charts-original/templates/_helpers.tpl
|
|
|
|
+++ charts/templates/_helpers.tpl
|
2021-05-28 18:23:41 +00:00
|
|
|
@@ -56,3 +56,68 @@
|
2021-05-17 22:30:18 +00:00
|
|
|
{{- end }}
|
|
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
|
|
{{- end -}}
|
|
|
|
+
|
|
|
|
+{{- define "system_default_registry" -}}
|
|
|
|
+{{- if .Values.global.cattle.systemDefaultRegistry -}}
|
|
|
|
+{{- printf "%s/" .Values.global.cattle.systemDefaultRegistry -}}
|
|
|
|
+{{- else -}}
|
|
|
|
+{{- "" -}}
|
|
|
|
+{{- end -}}
|
|
|
|
+{{- end -}}
|
|
|
|
+
|
|
|
|
+{{- define "windowsEnabled" }}
|
2021-05-17 22:34:49 +00:00
|
|
|
+{{- if not (kindIs "invalid" .Values.global.cattle.windows) }}
|
|
|
|
+{{- if not (kindIs "invalid" .Values.global.cattle.windows.enabled) }}
|
|
|
|
+{{- if .Values.global.cattle.windows.enabled }}
|
2021-05-17 22:30:18 +00:00
|
|
|
+true
|
2021-05-17 22:34:49 +00:00
|
|
|
+{{- end }}
|
|
|
|
+{{- end }}
|
|
|
|
+{{- end }}
|
|
|
|
+{{- end }}
|
|
|
|
+
|
2021-05-28 18:23:41 +00:00
|
|
|
+{{- define "windowsPathPrefix" -}}
|
|
|
|
+{{- trimSuffix "/" (default "c:\\" .Values.global.cattle.rkeWindowsPathPrefix | replace "\\" "/" | replace "//" "/" | replace "c:" "C:") -}}
|
|
|
|
+{{- end -}}
|
|
|
|
+
|
|
|
|
+{{- define "windowsKubernetesFilter" -}}
|
|
|
|
+{{- printf "kubernetes.%s" ((include "windowsPathPrefix" .) | replace ":" "" | replace "/" ".") -}}
|
|
|
|
+{{- end -}}
|
|
|
|
+
|
|
|
|
+{{- define "windowsInputTailMount" -}}
|
|
|
|
+{{- (include "windowsPathPrefix" .) | replace "C:" "" -}}
|
|
|
|
+{{- end -}}
|
|
|
|
+
|
|
|
|
+{{/*
|
|
|
|
+Set the controlplane selector based on kubernetes distribution
|
|
|
|
+*/}}
|
|
|
|
+{{- define "controlplaneSelector" -}}
|
|
|
|
+{{- $master := or .Values.additionalLoggingSources.rke2.enabled .Values.additionalLoggingSources.k3s.enabled -}}
|
|
|
|
+{{- $defaultSelector := $master | ternary (dict "node-role.kubernetes.io/master" "true") (dict "node-role.kubernetes.io/controlplane" "true") -}}
|
|
|
|
+{{ default $defaultSelector .Values.additionalLoggingSources.kubeAudit.nodeSelector | toYaml }}
|
|
|
|
+{{- end -}}
|
|
|
|
+
|
|
|
|
+{{/*
|
|
|
|
+Set kube-audit file path prefix based on distribution
|
|
|
|
+*/}}
|
|
|
|
+{{- define "kubeAuditPathPrefix" -}}
|
|
|
|
+{{- if .Values.additionalLoggingSources.rke.enabled -}}
|
|
|
|
+{{ default "/var/log/kube-audit" .Values.additionalLoggingSources.kubeAudit.pathPrefix }}
|
|
|
|
+{{- else if .Values.additionalLoggingSources.rke2.enabled -}}
|
|
|
|
+{{ default "/var/lib/rancher/rke2/server/logs" .Values.additionalLoggingSources.kubeAudit.pathPrefix }}
|
|
|
|
+{{- else -}}
|
|
|
|
+{{ required "Directory PathPrefix of the kube-audit location is required" .Values.additionalLoggingSources.kubeAudit.pathPrefix }}
|
|
|
|
+{{- end -}}
|
|
|
|
+{{- end -}}
|
|
|
|
+
|
|
|
|
+{{/*
|
|
|
|
+Set kube-audit file name based on distribution
|
|
|
|
+*/}}
|
|
|
|
+{{- define "kubeAuditFilename" -}}
|
|
|
|
+{{- if .Values.additionalLoggingSources.rke.enabled -}}
|
|
|
|
+{{ default "audit-log.json" .Values.additionalLoggingSources.kubeAudit.auditFilename }}
|
|
|
|
+{{- else if .Values.additionalLoggingSources.rke2.enabled -}}
|
|
|
|
+{{ default "audit.log" .Values.additionalLoggingSources.kubeAudit.auditFilename }}
|
|
|
|
+{{- else -}}
|
|
|
|
+{{ required "Filename of the kube-audit log is required" .Values.additionalLoggingSources.kubeAudit.auditFilename }}
|
|
|
|
+{{- end -}}
|
|
|
|
+{{- end -}}
|
|
|
|
\ No newline at end of file
|