Skip to content

Commit

Permalink
aws/zones: skip dead zones on us-east-1 when discoverying AZs
Browse files Browse the repository at this point in the history
  • Loading branch information
mtulio committed Dec 19, 2024
1 parent ec72ce6 commit 6ac50ff
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/asset/installconfig/aws/availabilityzones.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"

typesaws "github.com/openshift/installer/pkg/types/aws"
awsdefaults "github.com/openshift/installer/pkg/types/aws/defaults"
)

// Zones stores the map of Zone attributes indexed by Zone Name.
Expand Down Expand Up @@ -95,7 +96,7 @@ func availabilityZones(ctx context.Context, session *session.Session, region str
if len(zones) == 0 {
return nil, fmt.Errorf("no zones with type availability-zone in %s", region)
}
return zones, nil
return awsdefaults.SkippedZones(region, zones), nil
}

// edgeZones retrieves a list of zones type 'local-zone' and 'wavelength-zone' in the region.
Expand Down
17 changes: 17 additions & 0 deletions pkg/types/aws/defaults/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
configv1 "github.com/openshift/api/config/v1"
"github.com/openshift/installer/pkg/types"
"github.com/openshift/installer/pkg/types/aws"
"k8s.io/apimachinery/pkg/util/sets"
)

const (
Expand All @@ -24,6 +25,11 @@ var (
// "us-east-1": {"m6g.xlarge", "m6gd.xlarge"},
},
}
// us-east-1e is a well-known limited zone. Create base infra (networking),
// is useless as it does not offer supported instance types.
skippedZonesByRegion = map[string][]string{
"us-east-1": {"us-east-1e"},
}
)

// SetPlatformDefaults sets the defaults for the platform.
Expand Down Expand Up @@ -72,3 +78,14 @@ func InstanceTypes(region string, arch types.Architecture, topology configv1.Top
}
}
}

// SkippedZones returns the list of supported zones.
func SkippedZones(region string, zones []string) []string {
skipZones, ok := skippedZonesByRegion[region]
if (!ok) || (len(skipZones) == 0) {
return zones
}
zoneSet := sets.New[string](zones...)
skipSet := sets.New[string](skipZones...)
return sets.List(zoneSet.Difference(skipSet.Insert(skipZones...)))
}

0 comments on commit 6ac50ff

Please sign in to comment.