Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions pkg/asset/installconfig/powervs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,6 @@ func (c *Client) GetDatacenterCapabilities(ctx context.Context, region string) (
return getOk.Payload.Capabilities, nil
}

// GetDatacenterSupportedSystems retrieves the capabilities of the specified datacenter.
func (c *Client) GetDatacenterSupportedSystems(ctx context.Context, region string) ([]string, error) {
var err error
if c.BXCli.PISession == nil {
Expand All @@ -1122,12 +1121,15 @@ func (c *Client) GetDatacenterSupportedSystems(ctx context.Context, region strin
return nil, fmt.Errorf("failed to initialize PISession in GetDatacenterSupportedSystems: %w", err)
}
}
params := datacenters.NewV1DatacentersGetParamsWithContext(ctx).WithDatacenterRegion(region)
getOk, err := c.BXCli.PISession.Power.Datacenters.V1DatacentersGet(params)

// Use the global datacenter endpoint for accurate, non-cached data (other code uses a bulk endpoint)
datacenterClient := instance.NewIBMPIDatacenterClient(ctx, c.BXCli.PISession, "")
datacenter, err := datacenterClient.Get(region)
if err != nil {
return nil, fmt.Errorf("failed to get datacenter supported systems: %w", err)
}
return getOk.Payload.CapabilitiesDetails.SupportedSystems.General, nil

return datacenter.CapabilitiesDetails.SupportedSystems.General, nil
}

// TransitGatewayNameToID checks to see if the name is an existing transit gateway name.
Expand Down
49 changes: 39 additions & 10 deletions pkg/asset/machines/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,30 @@ func defaultPowerVSMachinePoolPlatform(ic *types.InstallConfig) powervstypes.Mac
fallback = true
logrus.Warnf("For given zone %v, GetDatacenterSupportedSystems returns %v", ic.PowerVS.Zone, err)
} else {
// Is the hardcoded default of s922 in the list?
found := false
for _, st := range sysTypes {
if st == sysType {
found = true
break
if ic.PowerVS.Zone == "dal14" {
// Prefer s1022 over s1222 for better support in dal14 region (s922 not supported anymore)
for _, st := range sysTypes {
if st == "s1022" {
sysType = "s1022"
break
}
}
// If s1022 not found, fall back to using the first available system type (in case of dal14 this is s1222)
if sysType != "s1022" {
sysType = sysTypes[0]
}
} else {
// For other zones, check if the hardcoded default of s922 is in the list, this is the prior case code
found := false
for _, st := range sysTypes {
if st == sysType {
found = true
break
}
}
if !found {
sysType = sysTypes[0]
}
}
if !found {
sysType = sysTypes[0]
}
}
}
Expand All @@ -234,7 +248,22 @@ func defaultPowerVSMachinePoolPlatform(ic *types.InstallConfig) powervstypes.Mac
// Fallback to hardcoded list
sysTypes, err = powervstypes.AvailableSysTypes(ic.PowerVS.Region, ic.PowerVS.Zone)
if err == nil {
sysType = sysTypes[0]
// For dal14, prefer s1022 if available
if ic.PowerVS.Zone == "dal14" {
for _, st := range sysTypes {
if st == "s1022" {
sysType = "s1022"
break
}
}
// If s1022 not found, use first in list
if sysType != "s1022" {
sysType = sysTypes[0]
}
} else {
// this is prior case behavior
sysType = sysTypes[0]
}
} else {
logrus.Warnf("For given zone %v, AvailableSysTypes returns %v", ic.PowerVS.Zone, err)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/types/powervs/powervs_regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ var Regions = map[string]Region{
"dal12": {
SysTypes: []string{"s922", "e980"},
},
"dal14": {
SysTypes: []string{"s1022", "e1080"},
},
},
VPCZones: []string{"us-south-1", "us-south-2", "us-south-3"},
},
Expand Down