Start snapshot controller first
@@ -48,12 +48,7 @@ func (s *Snapshot) Start() error {
}
s.stopChannel = make(chan struct{})
- if err := performRuleRecovery(); err != nil {
- log.Errorf("Failed to perform recovery for snapshot rules due to: %v", err)
- return err
- }
-
- // Start the snapshot controller
+ // Start the snapshot controller first so that the CRD gets registered
s.snapshotController = &controllers.Snapshotter{
Driver: s.Driver,
}
@@ -62,6 +57,11 @@ func (s *Snapshot) Start() error {
return fmt.Errorf("error starting snapshot controller: %v", err)
}
+ if err := performRuleRecovery(); err != nil {
+ log.Errorf("Failed to perform recovery for snapshot rules due to: %v", err)
+ return err
+ }
+
config, err := rest.InClusterConfig()
if err != nil {
return err
