Copy VMFlavor labels to BMH objects from vino CR

Whenever vBMH is created, it will have labels from VINO CR flavor
defintion.

Change-Id: Iabb1b5c575814422c2a7fa0fe79ecc2f3ccff186
This commit is contained in:
Kostiantyn Kalynovskyi 2021-03-03 15:15:08 +00:00
parent f466683254
commit 3c070e66b1
3 changed files with 6 additions and 6 deletions

View File

@ -95,7 +95,7 @@ type NodeSet struct {
//Parameter for Node master or worker-standard
Name string `json:"name,omitempty"`
Count int `json:"count,omitempty"`
NodeLabel *VMNodeFlavor `json:"labels,omitempty"`
NodeLabel VMNodeFlavor `json:"labels,omitempty"`
LibvirtTemplate NamespacedName `json:"libvirtTemplate,omitempty"`
NetworkInterface *NetworkInterface `json:"networkInterfaces,omitempty"`
DiskDrives *DiskDrivesTemplate `json:"diskDrives,omitempty"`

View File

@ -292,11 +292,7 @@ func (in *NodeSelector) DeepCopy() *NodeSelector {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeSet) DeepCopyInto(out *NodeSet) {
*out = *in
if in.NodeLabel != nil {
in, out := &in.NodeLabel, &out.NodeLabel
*out = new(VMNodeFlavor)
(*in).DeepCopyInto(*out)
}
in.NodeLabel.DeepCopyInto(&out.NodeLabel)
out.LibvirtTemplate = in.LibvirtTemplate
if in.NetworkInterface != nil {
in, out := &in.NetworkInterface, &out.NetworkInterface

View File

@ -120,6 +120,7 @@ func (r *VinoReconciler) createBMHperPod(ctx context.Context, vino *vinov1.Vino,
return err
}
// TODO extend this function to return server/rack labels as well
bmcAddr, err := r.getBMCAddress(ctx, pod, roleSuffix)
if err != nil {
return err
@ -129,6 +130,9 @@ func (r *VinoReconciler) createBMHperPod(ctx context.Context, vino *vinov1.Vino,
ObjectMeta: metav1.ObjectMeta{
Name: bmhName,
Namespace: getRuntimeNamespace(),
// TODO add rack and server labels, when we crearly define mechanism
// which labels we are copying
Labels: node.NodeLabel.VMFlavor,
},
Spec: metal3.BareMetalHostSpec{
NetworkData: &corev1.SecretReference{