Skip to content

Commit b4f14a7

Browse files
fwieselnotandy
authored andcommitted
NodeEvictionLabel: Set hypervisor as parent of eviction
Let's get the node as much as possible out of the way.
1 parent 8d2175a commit b4f14a7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/controller/node_eviction_label_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (r *NodeEvictionLabelReconciler) Reconcile(ctx context.Context, req ctrl.Re
9999
value = "true"
100100
} else {
101101
// check for existing eviction, else create it
102-
value, err = r.reconcileEviction(ctx, eviction, node, hostname, maintenanceValue)
102+
value, err = r.reconcileEviction(ctx, eviction, hv, hostname, maintenanceValue)
103103
if err != nil {
104104
return ctrl.Result{}, err
105105
}
@@ -125,13 +125,13 @@ func (r *NodeEvictionLabelReconciler) Reconcile(ctx context.Context, req ctrl.Re
125125
return ctrl.Result{}, k8sclient.IgnoreNotFound(err)
126126
}
127127

128-
func (r *NodeEvictionLabelReconciler) reconcileEviction(ctx context.Context, eviction *kvmv1.Eviction, node *corev1.Node, hostname, maintenanceValue string) (string, error) {
128+
func (r *NodeEvictionLabelReconciler) reconcileEviction(ctx context.Context, eviction *kvmv1.Eviction, hypervisor *kvmv1.Hypervisor, hostname, maintenanceValue string) (string, error) {
129129
log := logger.FromContext(ctx)
130130
if err := r.Get(ctx, k8sclient.ObjectKeyFromObject(eviction), eviction); err != nil {
131131
if !k8serrors.IsNotFound(err) {
132132
return "", err
133133
}
134-
if err := controllerutil.SetOwnerReference(node, eviction, r.Scheme); err != nil {
134+
if err := controllerutil.SetOwnerReference(hypervisor, eviction, r.Scheme); err != nil {
135135
return "", err
136136
}
137137
log.Info("Creating new eviction", "name", eviction.Name)

0 commit comments

Comments
 (0)