Skip to content

Commit c7c70bb

Browse files
fix: fixed Duplicate Webhook Patch Entries when Creating Multiple Versions of the Same Kind
1 parent e451dfe commit c7c70bb

File tree

1 file changed

+5
-1
lines changed
  • pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd

1 file changed

+5
-1
lines changed

pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/kustomization.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ func (f *Kustomization) GetCodeFragments() machinery.CodeFragmentsMap {
9191

9292
if !f.Resource.Webhooks.IsEmpty() {
9393
webhookPatch := fmt.Sprintf(webhookPatchCodeFragment, suffix)
94-
fragments[machinery.NewMarkerFor(f.Path, webhookPatchMarker)] = []string{webhookPatch}
94+
95+
marker := machinery.NewMarkerFor(f.Path, webhookPatchMarker)
96+
if _, exists := fragments[marker]; !exists {
97+
fragments[marker] = []string{webhookPatch}
98+
}
9599
}
96100

97101
// Generate resource code fragments

0 commit comments

Comments
 (0)