Skip to content

Commit b47a2de

Browse files
vr4mantarvanderp3
authored andcommitted
Enhanced static-ip for CPMS.
1 parent 5941108 commit b47a2de

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pkg/asset/machines/vsphere/machines.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ func Machines(clusterID string, config *types.InstallConfig, pool *types.Machine
101101
return nil, nil, errors.Wrap(err, "failed to create provider")
102102
}
103103

104-
vsphereMachineProvider = provider.DeepCopy()
105-
106104
// Apply static IP if configured
107105
applyNetworkConfig(host, provider)
108106

@@ -124,15 +122,27 @@ func Machines(clusterID string, config *types.InstallConfig, pool *types.Machine
124122
},
125123
}
126124
machines = append(machines, machine)
125+
126+
vsphereMachineProvider = provider.DeepCopy()
127127
}
128128

129129
// when multiple zones are defined, network and workspace are derived from the topology
130+
origProv := vsphereMachineProvider.DeepCopy()
130131
if len(failureDomains) > 1 {
131132
vsphereMachineProvider.Network = machineapi.NetworkSpec{}
132133
vsphereMachineProvider.Workspace = &machineapi.Workspace{}
133134
vsphereMachineProvider.Template = ""
134135
}
135136

137+
if len(hosts) > 0 {
138+
vsphereMachineProvider.Network.Devices = []machineapi.NetworkDeviceSpec{
139+
{
140+
AddressesFromPools: origProv.Network.Devices[0].AddressesFromPools,
141+
Nameservers: origProv.Network.Devices[0].Nameservers,
142+
},
143+
}
144+
}
145+
136146
controlPlaneMachineSet := &machinev1.ControlPlaneMachineSet{
137147
TypeMeta: metav1.TypeMeta{
138148
APIVersion: "machine.openshift.io/v1",

0 commit comments

Comments
 (0)