Skip to content

Commit

Permalink
Adding more addresses to the machine spec
Browse files Browse the repository at this point in the history
  • Loading branch information
mkumatag committed Feb 16, 2022
1 parent 3e35b89 commit 9f028a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions cloud/scope/powervs_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,18 @@ func (m *PowerVSMachineScope) SetHealth(health *models.PVMInstanceHealth) {
}
}

func (m *PowerVSMachineScope) SetAddresses(networks []*models.PVMInstanceNetwork) {
func (m *PowerVSMachineScope) SetAddresses(instance *models.PVMInstance) {
var addresses []corev1.NodeAddress
for _, network := range networks {
// Setting the name of the vm to the InternalDNS and Hostname as the vm uses that as hostname
addresses = append(addresses, corev1.NodeAddress{
Type: corev1.NodeInternalDNS,
Address: *instance.ServerName,
})
addresses = append(addresses, corev1.NodeAddress{
Type: corev1.NodeHostName,
Address: *instance.ServerName,
})
for _, network := range instance.Networks {
addresses = append(addresses, corev1.NodeAddress{
Type: corev1.NodeInternalIP,
Address: network.IPAddress,
Expand Down
2 changes: 1 addition & 1 deletion controllers/ibmpowervsmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(ctx context.Context, machi
return ctrl.Result{}, err
}
machineScope.SetInstanceID(instance.PvmInstanceID)
machineScope.SetAddresses(instance.Networks)
machineScope.SetAddresses(instance)
machineScope.SetHealth(instance.Health)
machineScope.SetInstanceState(instance.Status)
switch machineScope.GetInstanceState() {
Expand Down

0 comments on commit 9f028a7

Please sign in to comment.