From 9fd0aad365810c7fe724228eb01b4a772ecf9faf Mon Sep 17 00:00:00 2001 From: Jonathan Knight Date: Wed, 29 Sep 2021 13:37:59 +0300 Subject: [PATCH] Add labels during CRD generation --- Makefile | 1 + config/crd/kustomization.yaml | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 8e31d9081..85f78eeec 100644 --- a/Makefile +++ b/Makefile @@ -529,6 +529,7 @@ config/crd/bases/coherence.oracle.com_coherence.yaml: kustomize $(API_GO_FILES) $(CONTROLLER_GEN) "crd:trivialVersions=true,crdVersions={v1}" \ rbac:roleName=manager-role paths="{./api/...,./controllers/...}" \ output:crd:artifacts:config=config/crd/bases + cd config/crd && $(KUSTOMIZE) edit add label "app.kubernetes.io/version:$(VERSION)" -f $(KUSTOMIZE) build config/crd > $(BUILD_ASSETS)/crd_v1.yaml # ---------------------------------------------------------------------------------------------------------------------- diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 0514eecdd..62de72fd0 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -1,3 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + # This kustomization.yaml is not intended to be run by itself, # since it depends on service name and namespace that are out of this kustomize package. # It should be run by config/default @@ -5,7 +8,6 @@ resources: - bases/coherence.oracle.com_coherence.yaml # +kubebuilder:scaffold:crdkustomizeresource -patchesStrategicMerge: # patches here are for enabling the conversion webhook for each CRD #- patches/webhook_in_coherence.yaml # +kubebuilder:scaffold:crdkustomizewebhookpatch @@ -20,9 +22,16 @@ configurations: - kustomizeconfig.yaml patchesJson6902: - - path: patches/coherence.oracle.com_coherence_crd_patch.json - target: - group: apiextensions.k8s.io - version: v1 - kind: CustomResourceDefinition - name: coherence.coherence.oracle.com +- path: patches/coherence.oracle.com_coherence_crd_patch.json + target: + group: apiextensions.k8s.io + kind: CustomResourceDefinition + name: coherence.coherence.oracle.com + version: v1 + +commonLabels: + app.kubernetes.io/component: crd + app.kubernetes.io/instance: coherence-operator-crd + app.kubernetes.io/name: coherence-operator + app.kubernetes.io/part-of: coherence-operator + app.kubernetes.io/version: 3.2.3