Skip to content

Commit

Permalink
PR openshift#344 fixup
Browse files Browse the repository at this point in the history
A chunk was unfortunately left out from PR openshift#344 by mistake.

We also take this opportunity to split the condition in the daemonset
creation error checking to get rid of a long-standing logging annoyance.
No error should be logged if getting the DS returns "not found".

Signed-off-by: Pavel Mores <pmores@redhat.com>
  • Loading branch information
pmores authored and snir911 committed Oct 17, 2023
1 parent 3bdd0e7 commit 635125c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions controllers/openshift_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,14 @@ func (r *KataConfigOpenShiftReconciler) Reconcile(ctx context.Context, req ctrl.
//node. One of the ways to ensure this is to check for the existence of "kata" runtimeclass before
//creating the DS
//Alternatively we can create the DS post execution of createRuntimeClass()
if k8serrors.IsNotFound(err) && r.kataConfig.Status.RuntimeClass == "kata" {
r.Log.Info("Creating a new installation monitor daemonset", "ds.Namespace", ds.Namespace, "ds.Name", ds.Name)
err = r.Client.Create(context.TODO(), ds)
if err != nil {
r.Log.Error(err, "error when creating monitor daemonset")
res = ctrl.Result{Requeue: true, RequeueAfter: 15 * time.Second}
if k8serrors.IsNotFound(err) {
if contains(r.kataConfig.Status.RuntimeClass, "kata") {
r.Log.Info("Creating a new installation monitor daemonset", "ds.Namespace", ds.Namespace, "ds.Name", ds.Name)
err = r.Client.Create(context.TODO(), ds)
if err != nil {
r.Log.Error(err, "error when creating monitor daemonset")
res = ctrl.Result{Requeue: true, RequeueAfter: 15 * time.Second}
}
}
} else {
r.Log.Error(err, "could not get monitor daemonset, try again")
Expand Down

0 comments on commit 635125c

Please sign in to comment.