Skip to content

Commit a9ee390

Browse files
authoredNov 9, 2024
Merge pull request #4308 from camilamacedo86/fix-follow-up
🐛 revert the changes done in the PR #4286
2 parents d79cfa6 + b1db95f commit a9ee390

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed
 

‎pkg/plugins/golang/v4/scaffolds/internal/templates/webhooks/webhook.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (f *Webhook) SetTemplateDefaults() error {
8181
if f.Force {
8282
f.IfExistsAction = machinery.OverwriteFile
8383
} else {
84-
f.IfExistsAction = machinery.SkipFile
84+
f.IfExistsAction = machinery.Error
8585
}
8686

8787
f.AdmissionReviewVersions = "v1"

‎pkg/plugins/golang/v4/webhook.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,9 @@ func (p *createWebhookSubcommand) InjectResource(res *resource.Resource) error {
119119
return err
120120
}
121121

122-
// Ensure at least one webhook type is specified
123-
if !p.resource.HasDefaultingWebhook() &&
124-
!p.resource.HasValidationWebhook() &&
125-
!p.resource.HasConversionWebhook() {
126-
return fmt.Errorf("%s create webhook requires at least one of --defaulting, --programmatic-validation, "+
127-
"and --conversion to be true", p.commandName)
122+
if !p.resource.HasDefaultingWebhook() && !p.resource.HasValidationWebhook() && !p.resource.HasConversionWebhook() {
123+
return fmt.Errorf("%s create webhook requires at least one of --defaulting,"+
124+
" --programmatic-validation and --conversion to be true", p.commandName)
128125
}
129126

130127
// check if resource exist to create webhook

0 commit comments

Comments
 (0)