Skip to content

Commit

Permalink
peerpodconfig-ctrl: Handle updating the CAA DS spec
Browse files Browse the repository at this point in the history
The CAA daemonset spec was not getting updated
as the code never updated the spec post creation

Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
  • Loading branch information
bpradipt authored and huoqifeng committed Apr 22, 2024
1 parent 6c85448 commit 567287d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ func (r *PeerPodConfigReconciler) Reconcile(ctx context.Context, req ctrl.Reques
r.Log.Error(err, "Failed setting ControllerReference for cloud-api-adaptor DS")
return ctrl.Result{}, err
}
foundDs := &appsv1.DaemonSet{}
err = r.Client.Get(context.TODO(), types.NamespacedName{Name: ds.Name, Namespace: ds.Namespace}, foundDs)

err = r.Client.Update(context.TODO(), ds)
if err != nil && k8serrors.IsNotFound(err) {
r.Log.Info("Creating cloud-api-adapter daemonset", "ds.Namespace", ds.Namespace, "ds.Name", ds.Name)
r.Log.Error(err, "cloud-api-adaptor daemonset doesn't exist. Creating")
err = r.Client.Create(context.TODO(), ds)
if err != nil {
r.Log.Error(err, "failed to create cloud-api-adaptor")
r.Log.Error(err, "failed to create cloud-api-adaptor daemonset")
return ctrl.Result{}, err
}
}
Expand Down

0 comments on commit 567287d

Please sign in to comment.