Skip to content

Commit d526639

Browse files
fwieselnotandy
authored andcommitted
NodeLabelEviction: Transport labels to eviction
So we can split up the controller by label, we need this here too.
1 parent 4d63a22 commit d526639

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

internal/controller/hypervisor_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ func transportAggregatesAndTraits(node *metav1.ObjectMeta, hypervisor *kvmv1.Hyp
224224

225225
// transportLabels transports relevant labels from the source to the destination metadata
226226
func transportLabels(source, destination *metav1.ObjectMeta) {
227+
// If destination is created "manually" (not gotten from the api), this might be nil
228+
if destination.Labels == nil {
229+
destination.Labels = make(map[string]string)
230+
}
227231
// transfer labels
228232
for _, transferLabel := range transferLabels {
229233
if label, ok := source.Labels[transferLabel]; ok {

internal/controller/node_eviction_label_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ func (r *NodeEvictionLabelReconciler) reconcileEviction(ctx context.Context, evi
140140
Reason: fmt.Sprintf("openstack-hypervisor-operator: label %v=%v", labelEvictionRequired, maintenanceValue),
141141
}
142142

143+
transportLabels(&hypervisor.ObjectMeta, &eviction.ObjectMeta)
143144
if err = r.Create(ctx, eviction); err != nil {
144145
return "", fmt.Errorf("failed to create eviction due to %w", err)
145146
}

0 commit comments

Comments
 (0)