1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-08 10:04:25 +00:00

refactor: helm templating management (#6076)

* refactor: helm templating management

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fic

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-01-22 23:53:21 +01:00 committed by GitHub
parent 4a30316336
commit e50c39ab7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View file

@ -21,6 +21,14 @@
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "kyverno.chartVersion" -}}
{{- if .Values.templating.enabled -}}
{{ required "templating.version is required when templating.enabled is true" .Values.templating.version | replace "+" "_" }}
{{- else -}}
{{ .Chart.Version | replace "+" "_" }}
{{- end -}}
{{- end -}}
{{- define "kyverno.namespace" -}}
{{ default .Release.Namespace .Values.namespaceOverride }}
{{- end -}}
@ -35,11 +43,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/* Version labels */}}
{{- define "kyverno.versionLabels" -}}
{{- if .Values.templating.enabled -}}
app.kubernetes.io/version: {{ required "templating.version is required when templating.enabled is true" .Values.templating.version | replace "+" "_" }}
{{- else -}}
app.kubernetes.io/version: {{ .Chart.Version | replace "+" "_" }}
{{- end -}}
app.kubernetes.io/version: {{ template "kyverno.chartVersion" . }}
{{- end -}}
{{/* Helm required labels */}}

View file

@ -2,7 +2,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ template "kyverno.namespace" . }}
labels:
{{- include "kyverno.labels" . | nindent 4 }}
name: {{ template "kyverno.fullname" . }}
{{- end -}}

View file

@ -2,13 +2,13 @@
apiVersion: v1
kind: Namespace
metadata:
name: kyverno
labels:
app.kubernetes.io/component: kyverno
app: kyverno
app.kubernetes.io/name: kyverno
app.kubernetes.io/part-of: kyverno
app.kubernetes.io/version: latest
name: kyverno
---
apiVersion: v1
kind: ServiceAccount