Skip to content

Commit dbe49b0

Browse files
committed
Fix node-labels regression
Use gopkg.in/yaml.v2 marshaller instead of sigs.k8s.io/yaml which does not play nice with the yaml struct-tags. Fixes #318 Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
1 parent 474c3e9 commit dbe49b0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

controllers/machineselector_controller.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2022 SUSE LLC
2+
Copyright © 2023 SUSE LLC
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -26,9 +26,8 @@ import (
2626
"encoding/json"
2727

2828
"github.com/google/go-cmp/cmp"
29-
elementalv1 "github.com/rancher/elemental-operator/api/v1beta1"
30-
"github.com/rancher/elemental-operator/pkg/util"
3129
"github.com/rancher/system-agent/pkg/applyinator"
30+
"gopkg.in/yaml.v2"
3231
corev1 "k8s.io/api/core/v1"
3332
apierrors "k8s.io/apimachinery/pkg/api/errors"
3433
"k8s.io/apimachinery/pkg/api/meta"
@@ -46,7 +45,9 @@ import (
4645
"sigs.k8s.io/controller-runtime/pkg/predicate"
4746
"sigs.k8s.io/controller-runtime/pkg/reconcile"
4847
"sigs.k8s.io/controller-runtime/pkg/source"
49-
"sigs.k8s.io/yaml"
48+
49+
elementalv1 "github.com/rancher/elemental-operator/api/v1beta1"
50+
"github.com/rancher/elemental-operator/pkg/util"
5051
)
5152

5253
// MachineInventorySelectorReconciler reconciles a MachineInventorySelector object.
@@ -336,6 +337,8 @@ func (r *MachineInventorySelectorReconciler) newBootstrapPlan(ctx context.Contex
336337
}
337338

338339
type LabelsFromInventory struct {
340+
// NOTE: The '+' is not a typo and is needed when adding labels to k3s/rke
341+
// instead of replacing them.
339342
NodeLabels []string `yaml:"node-label+"`
340343
}
341344

0 commit comments

Comments
 (0)