add flag to enable/disable webhook controller
@@ -137,6 +137,10 @@ func main() {
Name: "pvc-watcher",
Usage: "Start the controller to monitor PVC creation and deletions (default: true)",
},
+ cli.BoolTFlag{
+ Name: "webhook",
+ Usage: "Enable webhook controller to start driver apps with scheduler as stork (default: true)",
+ },
}
if err := app.Run(os.Args); err != nil {
@@ -191,6 +195,7 @@ func run(c *cli.Context) {
log.Fatalf("Error starting scheduler extender: %v", err)
}
}
+ if c.Bool("webhook") {
webhook = &webhookadmission.Controller{
Driver: d,
Recorder: recorder,
@@ -199,6 +204,7 @@ func run(c *cli.Context) {
log.Fatalf("error starting webhook controller: %v", err)
}
}
+ }
// Create operator-sdk manager that will manage all controllers.
mgr, err := manager.New(config, manager.Options{})
if err != nil {
@@ -371,10 +377,11 @@ func runStork(mgr manager.Manager, d volume.Driver, recorder record.EventRecorde
if err := d.Stop(); err != nil {
log.Warnf("Error stopping driver: %v", err)
}
+ if c.Bool("webhook") {
if err := webhook.Stop(); err != nil {
log.Warnf("error stopping webhook controller %v", err)
}
-
+ }
stopCh <- struct{}{}
}
}()
