Skip to content

Commit b1db95f

Browse files
revert the changes done in the PR #4286
We are reverting the changes done in the PR #4286. We are just keeping the e2e tests improvements. We will not able to solve the issue #4146 without add new markers. We cannot skip the action to write an webhook since it will result in incomplete inplementation in the <kind>_webhook.go as in the <kind>_webhook_test.go
1 parent f3a65b6 commit b1db95f

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 6 deletions
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)