Skip to content

Commit

Permalink
don't check network inventory path if upi
Browse files Browse the repository at this point in the history
  • Loading branch information
jcpowermac committed Jan 15, 2025
1 parent 4004ed9 commit c0a3eed
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/asset/machines/vsphere/capimachines.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ func GenerateMachines(ctx context.Context, clusterID string, config *types.Insta
result := make([]*asset.RuntimeFile, 0, len(machines))
staticIP := false

isUPI := false
if len(config.VSphere.APIVIPs) == 0 || len(config.VSphere.IngressVIPs) == 0 {
isUPI = true
}

for mIndex, machine := range machines {
providerSpec, ok := machine.Spec.ProviderSpec.Value.Object.(*machinev1.VSphereMachineProviderSpec)
if !ok {
Expand All @@ -99,9 +104,12 @@ func GenerateMachines(ctx context.Context, clusterID string, config *types.Insta

capvNetworkDevices := []capv.NetworkDeviceSpec{}
for _, networkDevice := range providerSpec.Network.Devices {
networkName, err := getNetworkInventoryPath(vcenterContext, networkDevice.NetworkName, providerSpec)
if err != nil {
return nil, fmt.Errorf("unable to get network inventory path: %w", err)
networkName := ""
if !isUPI {
networkName, err = getNetworkInventoryPath(vcenterContext, networkDevice.NetworkName, providerSpec)
if err != nil {
return nil, fmt.Errorf("unable to get network inventory path: %w", err)
}
}
deviceSpec := capv.NetworkDeviceSpec{
NetworkName: networkName,
Expand Down

0 comments on commit c0a3eed

Please sign in to comment.