Skip to content

Commit f324063

Browse files
authored
Adding more addresses to the machine spec (#562)
1 parent 1573880 commit f324063

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

cloud/scope/powervs_machine.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,18 @@ func (m *PowerVSMachineScope) SetHealth(health *models.PVMInstanceHealth) {
360360
}
361361
}
362362

363-
func (m *PowerVSMachineScope) SetAddresses(networks []*models.PVMInstanceNetwork) {
363+
func (m *PowerVSMachineScope) SetAddresses(instance *models.PVMInstance) {
364364
var addresses []corev1.NodeAddress
365-
for _, network := range networks {
365+
// Setting the name of the vm to the InternalDNS and Hostname as the vm uses that as hostname
366+
addresses = append(addresses, corev1.NodeAddress{
367+
Type: corev1.NodeInternalDNS,
368+
Address: *instance.ServerName,
369+
})
370+
addresses = append(addresses, corev1.NodeAddress{
371+
Type: corev1.NodeHostName,
372+
Address: *instance.ServerName,
373+
})
374+
for _, network := range instance.Networks {
366375
addresses = append(addresses, corev1.NodeAddress{
367376
Type: corev1.NodeInternalIP,
368377
Address: network.IPAddress,

controllers/ibmpowervsmachine_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(ctx context.Context, machi
206206
return ctrl.Result{}, err
207207
}
208208
machineScope.SetInstanceID(instance.PvmInstanceID)
209-
machineScope.SetAddresses(instance.Networks)
209+
machineScope.SetAddresses(instance)
210210
machineScope.SetHealth(instance.Health)
211211
machineScope.SetInstanceState(instance.Status)
212212
switch machineScope.GetInstanceState() {

0 commit comments

Comments
 (0)