From 9e86e1ea92b11700746dc4ade103fd7e1f95a6d3 Mon Sep 17 00:00:00 2001 From: Camila Macedo Date: Sat, 18 Jun 2022 10:05:43 +0100 Subject: [PATCH] update files basic --- pkg/plugins/common/kustomize/v2/plugin.go | 2 +- .../templates/config/certmanager/certificate.go | 6 +++--- .../config/crd/patches/enablecainjection_patch.go | 2 +- .../config/kdefault/enablecainection_patch.go | 6 +++--- .../templates/config/kdefault/kustomization.go | 13 +++++++++---- testdata/project-v3-with-kustomize-v2/Makefile | 2 +- .../config/certmanager/certificate.yaml | 6 +++--- .../crd/patches/cainjection_in_admirales.yaml | 2 +- .../config/crd/patches/cainjection_in_captains.yaml | 2 +- .../crd/patches/cainjection_in_firstmates.yaml | 2 +- .../config/default/kustomization.yaml | 11 ++++++++--- .../config/default/webhookcainjection_patch.yaml | 6 +++--- 12 files changed, 35 insertions(+), 25 deletions(-) diff --git a/pkg/plugins/common/kustomize/v2/plugin.go b/pkg/plugins/common/kustomize/v2/plugin.go index 62a168001ba..8cd87eb81a6 100644 --- a/pkg/plugins/common/kustomize/v2/plugin.go +++ b/pkg/plugins/common/kustomize/v2/plugin.go @@ -25,7 +25,7 @@ import ( ) // KustomizeVersion is the kubernetes-sigs/kustomize version to be used in the project -const KustomizeVersion = "v4.5.3" +const KustomizeVersion = "v4.5.5" const pluginName = "kustomize.common." + plugins.DefaultNameQualifier diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/certmanager/certificate.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/certmanager/certificate.go index 70f4192219b..22cb17b3d49 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/certmanager/certificate.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/certmanager/certificate.go @@ -60,10 +60,10 @@ metadata: name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml namespace: system spec: - # SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize + # SERVICE_NAME_PLACEHOLDER and SERVICE_NAMESPACE_PLACEHOLDER will be substituted by kustomize dnsNames: - - SERVICE_NAME.SERVICE_NAMESPACE.svc - - SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local + - SERVICE_NAME_PLACEHOLDER.SERVICE_NAMESPACE_PLACEHOLDER.svc + - SERVICE_NAME_PLACEHOLDER.SERVICE_NAMESPACE_PLACEHOLDER.svc.cluster.local issuerRef: kind: Issuer name: selfsigned-issuer diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/patches/enablecainjection_patch.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/patches/enablecainjection_patch.go index d6c4114681f..702a8ef5c24 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/patches/enablecainjection_patch.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/patches/enablecainjection_patch.go @@ -56,6 +56,6 @@ apiVersion: apiextensions.k8s.io/{{ .Resource.API.CRDVersion }} kind: CustomResourceDefinition metadata: annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE)/CERTIFICATE_NAME + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE_PLACEHOLDER/CERTIFICATE_NAME_PLACEHOLDER name: {{ .Resource.Plural }}.{{ .Resource.QualifiedGroup }} ` diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/enablecainection_patch.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/enablecainection_patch.go index baf7cc67ebe..a0b3c1d3c56 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/enablecainection_patch.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/enablecainection_patch.go @@ -45,18 +45,18 @@ func (f *WebhookCAInjectionPatch) SetTemplateDefaults() error { } const injectCAPatchTemplate = `# This patch add annotation to admission webhook config and -# the variables CERTIFICATE_NAMESPACE CERTIFICATE_NAME will be substituted by kustomize. +# CERTIFICATE_NAMESPACE_PLACEHOLDER and CERTIFICATE_NAME_PLACEHOLDER will be substituted by kustomize apiVersion: admissionregistration.k8s.io/{{ .Resource.Webhooks.WebhookVersion }} kind: MutatingWebhookConfiguration metadata: name: mutating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE_PLACEHOLDER/CERTIFICATE_NAME_PLACEHOLDER --- apiVersion: admissionregistration.k8s.io/{{ .Resource.Webhooks.WebhookVersion }} kind: ValidatingWebhookConfiguration metadata: name: validating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE_PLACEHOLDER/CERTIFICATE_NAME_PLACEHOLDER ` diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/kustomization.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/kustomization.go index 2f3032f7045..05d627ddb4d 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/kustomization.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/kustomization.go @@ -44,7 +44,10 @@ func (f *Kustomization) SetTemplateDefaults() error { return nil } -const kustomizeTemplate = `# Adds namespace to all resources. +const kustomizeTemplate = `apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +# Adds namespace to all resources. namespace: {{ .ProjectName }}-system # Value of this field is prepended to the @@ -55,10 +58,12 @@ namespace: {{ .ProjectName }}-system namePrefix: {{ .ProjectName }}- # Labels to add to all resources and selectors. -#commonLabels: -# someName: someValue +#labels: +#- includeSelectors: true +# pairs: +# someName: someValue -bases: +resources: - ../crd - ../rbac - ../manager diff --git a/testdata/project-v3-with-kustomize-v2/Makefile b/testdata/project-v3-with-kustomize-v2/Makefile index 05361d23a2a..05520d8715b 100644 --- a/testdata/project-v3-with-kustomize-v2/Makefile +++ b/testdata/project-v3-with-kustomize-v2/Makefile @@ -113,7 +113,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen ENVTEST ?= $(LOCALBIN)/setup-envtest ## Tool Versions -KUSTOMIZE_VERSION ?= v4.5.3 +KUSTOMIZE_VERSION ?= v4.5.5 CONTROLLER_TOOLS_VERSION ?= v0.9.0 KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" diff --git a/testdata/project-v3-with-kustomize-v2/config/certmanager/certificate.yaml b/testdata/project-v3-with-kustomize-v2/config/certmanager/certificate.yaml index 7301f1bf7b3..44c273790e3 100644 --- a/testdata/project-v3-with-kustomize-v2/config/certmanager/certificate.yaml +++ b/testdata/project-v3-with-kustomize-v2/config/certmanager/certificate.yaml @@ -15,10 +15,10 @@ metadata: name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml namespace: system spec: - # SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize + # SERVICE_NAME_PLACEHOLDER and SERVICE_NAMESPACE_PLACEHOLDER will be substituted by kustomize dnsNames: - - SERVICE_NAME.SERVICE_NAMESPACE.svc - - SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local + - SERVICE_NAME_PLACEHOLDER.SERVICE_NAMESPACE_PLACEHOLDER.svc + - SERVICE_NAME_PLACEHOLDER.SERVICE_NAMESPACE_PLACEHOLDER.svc.cluster.local issuerRef: kind: Issuer name: selfsigned-issuer diff --git a/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_admirales.yaml b/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_admirales.yaml index 06c75954480..4f7dcf59c15 100644 --- a/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_admirales.yaml +++ b/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_admirales.yaml @@ -3,5 +3,5 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE)/CERTIFICATE_NAME + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE_PLACEHOLDER/CERTIFICATE_NAME_PLACEHOLDER name: admirales.crew.testproject.org diff --git a/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_captains.yaml b/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_captains.yaml index fc6783ba6a5..3d3663450e3 100644 --- a/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_captains.yaml +++ b/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_captains.yaml @@ -3,5 +3,5 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE)/CERTIFICATE_NAME + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE_PLACEHOLDER/CERTIFICATE_NAME_PLACEHOLDER name: captains.crew.testproject.org diff --git a/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_firstmates.yaml b/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_firstmates.yaml index 76eeb04dab1..689c235b3d2 100644 --- a/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_firstmates.yaml +++ b/testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_firstmates.yaml @@ -3,5 +3,5 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE)/CERTIFICATE_NAME + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE_PLACEHOLDER/CERTIFICATE_NAME_PLACEHOLDER name: firstmates.crew.testproject.org diff --git a/testdata/project-v3-with-kustomize-v2/config/default/kustomization.yaml b/testdata/project-v3-with-kustomize-v2/config/default/kustomization.yaml index 64e0ed85302..13879f10cfb 100644 --- a/testdata/project-v3-with-kustomize-v2/config/default/kustomization.yaml +++ b/testdata/project-v3-with-kustomize-v2/config/default/kustomization.yaml @@ -1,3 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + # Adds namespace to all resources. namespace: project-v3-with-kustomize-v2-system @@ -9,10 +12,12 @@ namespace: project-v3-with-kustomize-v2-system namePrefix: project-v3-with-kustomize-v2- # Labels to add to all resources and selectors. -#commonLabels: -# someName: someValue +#labels: +#- includeSelectors: true +# pairs: +# someName: someValue -bases: +resources: - ../crd - ../rbac - ../manager diff --git a/testdata/project-v3-with-kustomize-v2/config/default/webhookcainjection_patch.yaml b/testdata/project-v3-with-kustomize-v2/config/default/webhookcainjection_patch.yaml index d8f4f906e98..f3dd3f57093 100644 --- a/testdata/project-v3-with-kustomize-v2/config/default/webhookcainjection_patch.yaml +++ b/testdata/project-v3-with-kustomize-v2/config/default/webhookcainjection_patch.yaml @@ -1,15 +1,15 @@ # This patch add annotation to admission webhook config and -# the variables CERTIFICATE_NAMESPACE CERTIFICATE_NAME will be substituted by kustomize. +# CERTIFICATE_NAMESPACE_PLACEHOLDER and CERTIFICATE_NAME_PLACEHOLDER will be substituted by kustomize apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: name: mutating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE_PLACEHOLDER/CERTIFICATE_NAME_PLACEHOLDER --- apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: validating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE_PLACEHOLDER/CERTIFICATE_NAME_PLACEHOLDER