Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Enhance error handling for uninstall procedure
Signed-off-by: Daniel Fan <[email protected]>
  • Loading branch information
Daniel-Fan committed Dec 5, 2023
commit 58ec123b92392d2babd6c20d55bbca3952c8cafc
10 changes: 8 additions & 2 deletions controllers/operandrequest/reconcile_operand.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ func (r *Reconciler) deleteAllCustomResource(ctx context.Context, csv *olmv1alph
wg.Wait()

if len(merr.Errors) != 0 {
klog.Errorf("Failed to delete custom resource from OperandRequest for operator %s", operandName)
return merr
}

Expand Down Expand Up @@ -621,6 +622,7 @@ func (r *Reconciler) deleteAllCustomResource(ctx context.Context, csv *olmv1alph
r.Mutex.Lock()
defer r.Mutex.Unlock()
merr.Add(err)
return
}
}()
}
Expand All @@ -631,6 +633,7 @@ func (r *Reconciler) deleteAllCustomResource(ctx context.Context, csv *olmv1alph
}
wg.Wait()
if len(merr.Errors) != 0 {
klog.Errorf("Failed to delete custom resource from OperandConfig for operator %s", operandName)
return merr
}

Expand Down Expand Up @@ -839,7 +842,7 @@ func (r *Reconciler) deleteCustomResource(ctx context.Context, existingCR unstru
if strings.EqualFold(kind, "OperandRequest") {
return true, nil
}
klog.V(3).Infof("Waiting for CR %s is removed ...", kind)
klog.V(3).Infof("Waiting for CR %s to be removed ...", kind)
err := r.Client.Get(ctx, types.NamespacedName{
Name: name,
Namespace: namespace,
Expand Down Expand Up @@ -1135,7 +1138,10 @@ func (r *Reconciler) deleteK8sResource(ctx context.Context, existingK8sRes unstr
return errors.Wrapf(err, "failed to delete k8s resource -- Kind: %s, NamespacedName: %s/%s", kind, namespace, name)
}
err = wait.PollImmediate(constant.DefaultCRDeletePeriod, constant.DefaultCRDeleteTimeout, func() (bool, error) {
klog.V(3).Infof("Waiting for k8s resource %s is removed ...", kind)
if strings.EqualFold(kind, "OperandRequest") {
return true, nil
}
klog.V(3).Infof("Waiting for resource %s to be removed ...", kind)
err := r.Client.Get(ctx, types.NamespacedName{
Name: name,
Namespace: namespace,
Expand Down
1 change: 1 addition & 0 deletions controllers/operandrequest/reconcile_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ func (r *Reconciler) absentOperatorsAndOperands(ctx context.Context, requestInst
r.Mutex.Lock()
defer r.Mutex.Unlock()
merr.Add(err)
return // return here to avoid removing the operand from remainingOperands
}
requestInstance.RemoveServiceStatus(fmt.Sprintf("%v", o), &r.Mutex)
(*remainingOperands).Remove(o)
Expand Down
2 changes: 1 addition & 1 deletion controllers/operator/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewODLMOperator(mgr manager.Manager, name string) *ODLMOperator {
Config: mgr.GetConfig(),
Recorder: mgr.GetEventRecorderFor(name),
Scheme: mgr.GetScheme(),
MaxConcurrentReconciles: 5,
MaxConcurrentReconciles: 10,
}
}

Expand Down