Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Move the webhookcainjection_patch.yaml file creation from init project to webhook creation #1728

Merged
merged 1 commit into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pkg/plugin/v3/scaffolds/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ func (s *initScaffolder) scaffold() error {
&webhook.Kustomization{},
&webhook.KustomizeConfigWebhook{},
&webhook.Service{},
Comment on lines 126 to 128
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, I think we need also move these ones to the webhook plugin as well since they are specific to the webhook plugin and are not useful to projects which as not in the webhooks. I mean, it shows to be the same scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also thinks the same.. Should I move all the webhook related scaffolding in this PR itself? Or should we wait for discussion to be finalized on #1644 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understood that we agreed to move forward with into the bug triage. However, let's see if @estroz would like to hold on that until we finalized on #1644.

&kdefault.InjectCAPatch{},
&prometheus.Kustomization{},
&prometheus.ServiceMonitor{},
&certmanager.CertManager{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ func (f *InjectCAPatch) SetTemplateDefaults() error {

f.TemplateBody = injectCAPatchTemplate

f.IfExistsAction = file.Error
// If file webhookcainjection_patch.yaml exist, skip its creation
f.IfExistsAction = file.Skip
Copy link
Member

@camilamacedo86 camilamacedo86 Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked that 👍
Great work


return nil
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/plugin/v3/scaffolds/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"sigs.k8s.io/kubebuilder/pkg/plugin/scaffold"
"sigs.k8s.io/kubebuilder/pkg/plugin/v3/scaffolds/internal/templates"
"sigs.k8s.io/kubebuilder/pkg/plugin/v3/scaffolds/internal/templates/config/api"
"sigs.k8s.io/kubebuilder/pkg/plugin/v3/scaffolds/internal/templates/config/kdefault"
)

var _ scaffold.Scaffolder = &webhookScaffolder{}
Expand Down Expand Up @@ -82,6 +83,7 @@ You need to implement the conversion.Hub and conversion.Convertible interfaces f
s.newUniverse(),
&api.Webhook{Defaulting: s.defaulting, Validating: s.validation},
&templates.MainUpdater{WireWebhook: true},
&kdefault.InjectCAPatch{},
); err != nil {
return err
}
Expand Down

This file was deleted.