mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
use helm values for crd labels (#5594)
Signed-off-by: bakito <github@bakito.ch> Signed-off-by: bakito <github@bakito.ch> Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
6cdc3f44cf
commit
616d0d3981
4 changed files with 54 additions and 38 deletions
4
Makefile
4
Makefile
|
@ -146,7 +146,7 @@ KYVERNOPRE_BIN := $(KYVERNOPRE_DIR)/kyvernopre
|
|||
CLI_BIN := $(CLI_DIR)/kubectl-kyverno
|
||||
CLEANUP_BIN := $(CLEANUP_DIR)/cleanup-controller
|
||||
PACKAGE ?= github.com/kyverno/kyverno
|
||||
CGO_ENABLED ?= 0
|
||||
CGO_ENABLED ?= 0
|
||||
LD_FLAGS = "-s -w -X $(PACKAGE)/pkg/version.BuildVersion=$(GIT_VERSION) -X $(PACKAGE)/pkg/version.BuildHash=$(GIT_HASH) -X $(PACKAGE)/pkg/version.BuildTime=$(TIMESTAMP)"
|
||||
LD_FLAGS_DEV = "-s -w -X $(PACKAGE)/pkg/version.BuildVersion=$(GIT_VERSION_DEV) -X $(PACKAGE)/pkg/version.BuildHash=$(GIT_HASH) -X $(PACKAGE)/pkg/version.BuildTime=$(TIMESTAMP)"
|
||||
|
||||
|
@ -395,7 +395,7 @@ codegen-helm-crds: $(KUSTOMIZE) codegen-crds-all ## Generate helm CRDs
|
|||
@echo Create temp folder for kustomization... >&2
|
||||
@mkdir -p config/.helm
|
||||
@echo Create kustomization... >&2
|
||||
@VERSION='"{{.Chart.AppVersion}}"' TOP_PATH=".." envsubst < config/templates/labels.yaml.envsubst > config/.helm/labels.yaml
|
||||
@VERSION='"{{.Chart.AppVersion}}"' TOP_PATH=".." envsubst < config/templates/helm-labels.yaml.envsubst > config/.helm/labels.yaml
|
||||
@VERSION=dummy TOP_PATH=".." envsubst < config/templates/kustomization.yaml.envsubst > config/.helm/kustomization.yaml
|
||||
@echo Generate helm crds... >&2
|
||||
@$(KUSTOMIZE) build ./config/.helm | $(KUSTOMIZE) cfg grep kind=CustomResourceDefinition | $(SED) -e "1i{{- if .Values.installCRDs }}" -e '$$a{{- end }}' -e '/^ creationTimestamp: null/i \ \ \ \ {{- with .Values.crds.annotations }}{{ toYaml . | nindent 4 }}{{ end }}' > ./charts/kyverno/templates/crds.yaml
|
||||
|
|
|
@ -54,3 +54,5 @@ annotations:
|
|||
description: Grafana dashboard.
|
||||
- kind: added
|
||||
description: Cleanup controller.
|
||||
- kind: changed
|
||||
description: CRD labels are in sync with other labels generated by the helm.
|
||||
|
|
|
@ -10,9 +10,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: admissionreports.kyverno.io
|
||||
spec:
|
||||
|
@ -275,9 +275,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: backgroundscanreports.kyverno.io
|
||||
spec:
|
||||
|
@ -506,9 +506,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: cleanuppolicies.kyverno.io
|
||||
spec:
|
||||
|
@ -1457,9 +1457,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: clusteradmissionreports.kyverno.io
|
||||
spec:
|
||||
|
@ -1722,9 +1722,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: clusterbackgroundscanreports.kyverno.io
|
||||
spec:
|
||||
|
@ -1953,9 +1953,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: clustercleanuppolicies.kyverno.io
|
||||
spec:
|
||||
|
@ -2904,9 +2904,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: clusterpolicies.kyverno.io
|
||||
spec:
|
||||
|
@ -10561,9 +10561,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: clusterpolicyreports.wgpolicyk8s.io
|
||||
spec:
|
||||
|
@ -10834,9 +10834,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: generaterequests.kyverno.io
|
||||
spec:
|
||||
|
@ -11010,9 +11010,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: policies.kyverno.io
|
||||
spec:
|
||||
|
@ -18668,9 +18668,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: policyreports.wgpolicyk8s.io
|
||||
spec:
|
||||
|
@ -18941,9 +18941,9 @@ metadata:
|
|||
creationTimestamp: null
|
||||
labels:
|
||||
app.kubernetes.io/component: kyverno
|
||||
app.kubernetes.io/instance: kyverno
|
||||
app.kubernetes.io/name: kyverno
|
||||
app.kubernetes.io/part-of: kyverno
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: '{{.Chart.AppVersion}}'
|
||||
name: updaterequests.kyverno.io
|
||||
spec:
|
||||
|
|
14
config/templates/helm-labels.yaml.envsubst
Normal file
14
config/templates/helm-labels.yaml.envsubst
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
apiVersion: builtin
|
||||
kind: LabelTransformer
|
||||
metadata:
|
||||
name: labelTransformer
|
||||
labels:
|
||||
app.kubernetes.io/instance: '{{ .Release.Name }}'
|
||||
app.kubernetes.io/name: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/part-of: '{{ template "kyverno.name" . }}'
|
||||
app.kubernetes.io/version: $VERSION
|
||||
fieldSpecs:
|
||||
- kind: CustomResourceDefinition
|
||||
path: metadata/labels
|
||||
create: true
|
Loading…
Reference in a new issue