diff --git a/config/crd/bases/airship.airshipit.org_vinoes.yaml b/config/crd/bases/airship.airshipit.org_vinoes.yaml index 1b5b764..4465c28 100644 --- a/config/crd/bases/airship.airshipit.org_vinoes.yaml +++ b/config/crd/bases/airship.airshipit.org_vinoes.yaml @@ -147,6 +147,11 @@ spec: that will be created These labels will override keys from k8s node, that are specified in vino.NodeLabelKeysToCopy type: object + bootInterfaceName: + description: BootInterfaceName references the interface name in + the list of NetworkInterfaces Vino will take this interface + find its mac address and use it as bootMACAddress for BMH + type: string count: type: integer diskDrives: diff --git a/config/samples/vino_cr.yaml b/config/samples/vino_cr.yaml index e49a43f..b74d774 100644 --- a/config/samples/vino_cr.yaml +++ b/config/samples/vino_cr.yaml @@ -13,9 +13,6 @@ spec: beta.kubernetes.io/os: linux configuration: cpuExclude: 0-1 - redfishCredentialSecret: - name: redfishSecret - namespace: airship-system networks: - name: management subnet: 192.168.2.0/20 @@ -50,24 +47,12 @@ spec: # libvirtTemplate: # name: libvirt-template-master # namespace: vino-system + bootInterfaceName: management networkInterfaces: - name: management type: bridge network: management mtu: 1500 - options: - bridgeName: vminfra-bridge - - name: external - type: sriov-bond - network: external - mtu: 9100 - options: - # this is an 'open-ended' set of k/v pairs, validation is perfomed by vino rather than crd schema. - pf: "[enp29s0f0,enp219s1f1]" - vlan: "100" - bond_mode: 802.3ad - bond_xmit_hash_policy: layer3+4 - bond_miimon: "100" diskDrives: - name: root type: qcow2 @@ -87,6 +72,7 @@ spec: # libvirtTemplate: # name: libvirt-template-worker # namespace: vino-system + bootInterfaceName: management networkInterfaces: - name: management type: bridge @@ -94,17 +80,6 @@ spec: mtu: 1500 options: bridgeName: vminfra-bridge - - name: external - type: sriov-bond - network: external - mtu: 9100 - options: - # this is an 'open-ended' set of k/v pairs, validation is perfomed by vino rather than crd schema. - pf: "[enp29s0f0,enp219s1f1]" - vlan: "100" - bond_mode: 802.3ad - bond_xmit_hash_policy: layer3+4 - bond_miimon: "100" diskDrives: - name: root type: qcow2 diff --git a/docs/api/vino.md b/docs/api/vino.md index 2bc875f..6a16be4 100644 --- a/docs/api/vino.md +++ b/docs/api/vino.md @@ -1012,6 +1012,18 @@ NamespacedName

NetworkDataTemplate must have a template key

+ + +bootInterfaceName
+ +string + + + +

BootInterfaceName references the interface name in the list of NetworkInterfaces +Vino will take this interface find its mac address and use it as bootMACAddress for BMH

+ + diff --git a/pkg/api/v1/vino_types.go b/pkg/api/v1/vino_types.go index ca5bab9..9a99591 100644 --- a/pkg/api/v1/vino_types.go +++ b/pkg/api/v1/vino_types.go @@ -127,6 +127,9 @@ type NodeSet struct { DiskDrives []DiskDrivesTemplate `json:"diskDrives,omitempty"` // NetworkDataTemplate must have a template key NetworkDataTemplate NamespacedName `json:"networkDataTemplate,omitempty"` + // BootInterfaceName references the interface name in the list of NetworkInterfaces + // Vino will take this interface find its mac address and use it as bootMACAddress for BMH + BootInterfaceName string `json:"bootInterfaceName,omitempty"` } // NamespacedName to be used to spawn VMs diff --git a/pkg/controllers/bmh.go b/pkg/controllers/bmh.go index baba06c..01e660c 100644 --- a/pkg/controllers/bmh.go +++ b/pkg/controllers/bmh.go @@ -50,8 +50,9 @@ type networkTemplateValues struct { } type generatedValues struct { - IPAddresses map[string]string - MACAddresses map[string]string + IPAddresses map[string]string + MACAddresses map[string]string + BootMACAdress string } func (r *VinoReconciler) ensureBMHs(ctx context.Context, vino *vinov1.Vino) error { @@ -210,6 +211,7 @@ func (r *VinoReconciler) createBMHperPod(ctx context.Context, vino *vinov1.Vino, CredentialsName: creds, DisableCertificateVerification: true, }, + BootMACAddress: domainNetValues.Generated.BootMACAdress, }, } objKey := client.ObjectKeyFromObject(bmh) @@ -255,6 +257,7 @@ func (r *VinoReconciler) domainSpecificNetValues( // Allocate an IP for each of this BMH's network interfaces ipAddresses := map[string]string{} macAddresses := map[string]string{} + var bootMAC string for _, iface := range node.NetworkInterfaces { networkName := iface.NetworkName subnet := "" @@ -281,16 +284,20 @@ func (r *VinoReconciler) domainSpecificNetValues( } ipAddresses[networkName] = ipAddress macAddresses[iface.Name] = macAddress + if iface.Name == node.BootInterfaceName { + bootMAC = macAddress + } logr.FromContext(ctx).Info("Got MAC and IP for the network and node", - "MAC", macAddress, "IP", ipAddress, "bmh name", bmhName) + "MAC", macAddress, "IP", ipAddress, "bmh name", bmhName, "bootMAC", bootMAC) } return networkTemplateValues{ Node: node, BMHName: bmhName, Networks: networks, Generated: generatedValues{ - IPAddresses: ipAddresses, - MACAddresses: macAddresses, + IPAddresses: ipAddresses, + MACAddresses: macAddresses, + BootMACAdress: bootMAC, }, }, nil }