refactor(workloadmonitor): use k8s.io/utils/ptr instead of pointer

The pointer package is deprecated; its Bool and BoolPtr are aliases of
ptr.To, so the values written are unchanged.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
Aleksei Sviridkin committed 2026-11-13 12:35:04 +03:00
1 parent 939a1ec44b
commit 648928f272
1 file changed
+6 -6
@@ -28,7 +28,7 @@ import (
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/retry"
"k8s.io/client-go/util/workqueue"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -423,8 +423,8 @@ func updateOwnerReferences(obj metav1.Object, monitor client.Object) {
Name: monitor.GetName(),
UID: monitor.GetUID(),
// Set Controller to false to avoid conflict as multiple controllers are not allowed
Controller: pointer.BoolPtr(false),
BlockOwnerDeletion: pointer.BoolPtr(true),
Controller: ptr.To(false),
BlockOwnerDeletion: ptr.To(true),
}
owners = append(owners, newOwnerRef)
}
@@ -1174,9 +1174,9 @@ func (r *WorkloadMonitorReconciler) Reconcile(ctx context.Context, req ctrl.Requ
// Default to operational = true, but check MinReplicas if set.
// Use fresh.Spec to avoid making decisions based on a stale cached copy
// when the spec was updated between the initial read and this retry.
fresh.Status.Operational = pointer.Bool(true)
fresh.Status.Operational = ptr.To(true)
if fresh.Spec.MinReplicas != nil && availableReplicas < *fresh.Spec.MinReplicas {
fresh.Status.Operational = pointer.Bool(false)
fresh.Status.Operational = ptr.To(false)
}
// Only the DataVolume check writes Message and Reason, so the stored ones
// are the last DataVolume verdict: kept while no reader is installed yet, so a
@@ -1189,7 +1189,7 @@ func (r *WorkloadMonitorReconciler) Reconcile(ctx context.Context, req ctrl.Requ
}
}
if fresh.Status.Message != "" {
fresh.Status.Operational = pointer.Bool(false)
fresh.Status.Operational = ptr.To(false)
}
if equality.Semantic.DeepEqual(stored, &fresh.Status) {
return nil