From b4cfeecf31af6dea220be921f2d81733ecfa9b30 Mon Sep 17 00:00:00 2001 From: lowang-bh Date: Sun, 3 Sep 2023 17:13:05 +0800 Subject: [PATCH] fix kustomization comments about patches file names --- hack/docs/internal/cronjob-tutorial/generate_cronjob.go | 4 ++-- .../internal/templates/config/crd/kustomization.go | 8 ++++---- .../internal/templates/config/crd/kustomization.go | 8 ++++---- .../internal/templates/config/crd/kustomization.go | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hack/docs/internal/cronjob-tutorial/generate_cronjob.go b/hack/docs/internal/cronjob-tutorial/generate_cronjob.go index 3f38b88e68d..b6cf2855c99 100644 --- a/hack/docs/internal/cronjob-tutorial/generate_cronjob.go +++ b/hack/docs/internal/cronjob-tutorial/generate_cronjob.go @@ -584,12 +584,12 @@ func updateKustomization(sp *Sample) { // uncomment crd/kustomization err = pluginutil.UncommentCode( filepath.Join(sp.ctx.Dir, "config/crd/kustomization.yaml"), - `#- path: patches/webhook_in_cronjobs.yaml`, `#`) + `#- path: patches/webhook_in_batch_cronjobs.yaml`, `#`) CheckError("fixing crd/kustomization", err) err = pluginutil.UncommentCode( filepath.Join(sp.ctx.Dir, "config/crd/kustomization.yaml"), - `#- path: patches/cainjection_in_cronjobs.yaml`, `#`) + `#- path: patches/cainjection_in_batch_cronjobs.yaml`, `#`) CheckError("fixing crd/kustomization", err) } diff --git a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/crd/kustomization.go b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/crd/kustomization.go index 25fbc18af85..e4b41ed92df 100644 --- a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/crd/kustomization.go +++ b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/crd/kustomization.go @@ -68,9 +68,9 @@ func (f *Kustomization) GetMarkers() []machinery.Marker { const ( resourceCodeFragment = `- bases/%s_%s.yaml ` - webhookPatchCodeFragment = `#- patches/webhook_in_%s.yaml + webhookPatchCodeFragment = `#- patches/webhook_in_%s_%s.yaml ` - caInjectionPatchCodeFragment = `#- patches/cainjection_in_%s.yaml + caInjectionPatchCodeFragment = `#- patches/cainjection_in_%s_%s.yaml ` ) @@ -84,11 +84,11 @@ func (f *Kustomization) GetCodeFragments() machinery.CodeFragmentsMap { // Generate resource code fragments webhookPatch := make([]string, 0) - webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Plural)) + webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Group, f.Resource.Plural)) // Generate resource code fragments caInjectionPatch := make([]string, 0) - caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Plural)) + caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Group, f.Resource.Plural)) // Only store code fragments in the map if the slices are non-empty if len(res) != 0 { diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/kustomization.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/kustomization.go index 960ad2c5da3..b9cc4aff63c 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/kustomization.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/kustomization.go @@ -68,9 +68,9 @@ func (f *Kustomization) GetMarkers() []machinery.Marker { const ( resourceCodeFragment = `- bases/%s_%s.yaml ` - webhookPatchCodeFragment = `#- path: patches/webhook_in_%s.yaml + webhookPatchCodeFragment = `#- path: patches/webhook_in_%s_%s.yaml ` - caInjectionPatchCodeFragment = `#- path: patches/cainjection_in_%s.yaml + caInjectionPatchCodeFragment = `#- path: patches/cainjection_in_%s_%s.yaml ` ) @@ -84,11 +84,11 @@ func (f *Kustomization) GetCodeFragments() machinery.CodeFragmentsMap { // Generate resource code fragments webhookPatch := make([]string, 0) - webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Plural)) + webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Group, f.Resource.Plural)) // Generate resource code fragments caInjectionPatch := make([]string, 0) - caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Plural)) + caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Group, f.Resource.Plural)) // Only store code fragments in the map if the slices are non-empty if len(res) != 0 { diff --git a/pkg/plugins/golang/v2/scaffolds/internal/templates/config/crd/kustomization.go b/pkg/plugins/golang/v2/scaffolds/internal/templates/config/crd/kustomization.go index c0e20efdf8e..1d0308ef7e1 100644 --- a/pkg/plugins/golang/v2/scaffolds/internal/templates/config/crd/kustomization.go +++ b/pkg/plugins/golang/v2/scaffolds/internal/templates/config/crd/kustomization.go @@ -68,9 +68,9 @@ func (f *Kustomization) GetMarkers() []machinery.Marker { const ( resourceCodeFragment = `- bases/%s_%s.yaml ` - webhookPatchCodeFragment = `#- patches/webhook_in_%s.yaml + webhookPatchCodeFragment = `#- patches/webhook_in_%s_%s.yaml ` - caInjectionPatchCodeFragment = `#- patches/cainjection_in_%s.yaml + caInjectionPatchCodeFragment = `#- patches/cainjection_in_%s_%s.yaml ` ) @@ -84,11 +84,11 @@ func (f *Kustomization) GetCodeFragments() machinery.CodeFragmentsMap { // Generate resource code fragments webhookPatch := make([]string, 0) - webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Plural)) + webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Group, f.Resource.Plural)) // Generate resource code fragments caInjectionPatch := make([]string, 0) - caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Plural)) + caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Group, f.Resource.Plural)) // Only store code fragments in the map if the slices are non-empty if len(res) != 0 {