Delete CRDs explicitly from reset
The goal is to prevent a deadlock on the finalizers where the experiment objects have finalizers and the controller that removes the finalizers has been shut down because it was also deleted.
@@ -71,6 +71,10 @@ func (o *ResetOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []st
}
func (o *ResetOptions) Run() error {
+ if err := o.crd(); err != nil {
+ return err
+ }
+
if err := o.bootstrapRole(); err != nil {
return err
}
@@ -95,3 +99,11 @@ func (o *ResetOptions) bootstrapRole() error {
deleteCmd.Stderr = o.ErrOut
return bootstrapRole(deleteCmd, false)
}
+
+func (o *ResetOptions) crd() error {
+ deleteCmd := o.Kubectl.NewCmd("delete", "--ignore-not-found", "crd",
+ "trials.redskyops.dev",
+ "experiments.redskyops.dev",
+ )
+ return deleteCmd.Run()
+}
