@@ -54,9 +54,10 @@ type ServerOptions struct {
54
54
// Client will be injected by the manager if not set.
55
55
Client client.Client
56
56
57
- // InstallWebhookConfig controls if the server will automatically create webhook related objects
57
+ // DisableWebhookConfigInstaller controls if the server will automatically create webhook related objects
58
58
// during bootstrapping. e.g. webhookConfiguration, service and secret.
59
- InstallWebhookConfig bool
59
+ // If false, the server will install the webhook config objects. It is defaulted to false.
60
+ DisableWebhookConfigInstaller * bool
60
61
61
62
// BootstrapOptions contains the options for bootstrapping the admission server.
62
63
* BootstrapOptions
@@ -190,7 +191,12 @@ var _ manager.Runnable = &Server{}
190
191
// Start runs the server.
191
192
// It will install the webhook related resources depend on the server configuration.
192
193
func (s * Server ) Start (stop <- chan struct {}) error {
193
- if s .InstallWebhookConfig {
194
+ s .once .Do (s .setDefault )
195
+ if s .err != nil {
196
+ return s .err
197
+ }
198
+
199
+ if s .DisableWebhookConfigInstaller != nil && ! * s .DisableWebhookConfigInstaller {
194
200
log .Info ("installing webhook configuration in cluster" )
195
201
err := s .InstallWebhookManifests ()
196
202
if err != nil {
@@ -200,6 +206,10 @@ func (s *Server) Start(stop <-chan struct{}) error {
200
206
log .Info ("webhook installer is disabled" )
201
207
}
202
208
209
+ return s .run (stop )
210
+ }
211
+
212
+ func (s * Server ) run (stop <- chan struct {}) error {
203
213
srv := & http.Server {
204
214
Addr : fmt .Sprintf (":%v" , s .Port ),
205
215
Handler : s .sMux ,
0 commit comments