@@ -54,9 +54,10 @@ type ServerOptions struct {
5454 // Client will be injected by the manager if not set.
5555 Client client.Client
5656
57- // InstallWebhookConfig controls if the server will automatically create webhook related objects
57+ // DisableWebhookConfigInstaller controls if the server will automatically create webhook related objects
5858 // 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
6061
6162 // BootstrapOptions contains the options for bootstrapping the admission server.
6263 * BootstrapOptions
@@ -190,7 +191,12 @@ var _ manager.Runnable = &Server{}
190191// Start runs the server.
191192// It will install the webhook related resources depend on the server configuration.
192193func (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 {
194200 log .Info ("installing webhook configuration in cluster" )
195201 err := s .InstallWebhookManifests ()
196202 if err != nil {
@@ -200,6 +206,10 @@ func (s *Server) Start(stop <-chan struct{}) error {
200206 log .Info ("webhook installer is disabled" )
201207 }
202208
209+ return s .run (stop )
210+ }
211+
212+ func (s * Server ) run (stop <- chan struct {}) error {
203213 srv := & http.Server {
204214 Addr : fmt .Sprintf (":%v" , s .Port ),
205215 Handler : s .sMux ,
0 commit comments