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
5 changes: 3 additions & 2 deletions pkg/asset/installconfig/aws/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,9 @@ func includesAssumeRole(installConfig *types.InstallConfig) bool {
}

func includesWavelengthZones(installConfig *types.InstallConfig) bool {
// Examples of WL zones: us-east-1-wl1-atl-wlz-1, eu-west-2-wl1-lon-wlz-1, eu-west-2-wl2-man-wlz1 ...
isWLZoneRegex := regexp.MustCompile(`wl\d\-.*$`)
// Examples of WL zones: us-east-1-wl1-atl-wlz-1, eu-west-2-wl1-lon-wlz-1, eu-west-2-wl2-man-wlz-1, etc
// https://docs.aws.amazon.com/wavelength/latest/developerguide/available-wavelength-zones.html
isWLZoneRegex := regexp.MustCompile(`-wlz.*$`)

for _, mpool := range installConfig.Compute {
if mpool.Name != types.MachinePoolEdgeRoleName || mpool.Platform.AWS == nil {
Expand Down
34 changes: 25 additions & 9 deletions pkg/asset/installconfig/aws/permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,17 +878,33 @@ func TestIncludesAssumeRole(t *testing.T) {

func TestIncludesWavelengthZones(t *testing.T) {
t.Run("Should be true when edge compute specified with WL zones", func(t *testing.T) {
ic := validBYOSubnetsInstallConfig()
ic.Compute = append(ic.Compute, types.MachinePool{
Name: "edge",
Platform: types.MachinePoolPlatform{
AWS: &aws.MachinePool{
Zones: []string{"us-west-2-pdx-1a", "us-west-2-wl1-sea-wlz-1"},
t.Run("with common wavelength zone format", func(t *testing.T) {
ic := validBYOSubnetsInstallConfig()
ic.Compute = append(ic.Compute, types.MachinePool{
Name: "edge",
Platform: types.MachinePoolPlatform{
AWS: &aws.MachinePool{
Zones: []string{"us-west-2-pdx-1a", "us-west-2-wl1-sea-wlz-1"},
},
},
},
})
requiredPerms := RequiredPermissionGroups(ic)
assert.Contains(t, requiredPerms, PermissionCarrierGateway)
})
// OCPBUGS-77355: for example, us-east-1-foe-wlz-1a
t.Run("with irregular wavelength zone format", func(t *testing.T) {
ic := validBYOSubnetsInstallConfig()
ic.Compute = append(ic.Compute, types.MachinePool{
Name: "edge",
Platform: types.MachinePoolPlatform{
AWS: &aws.MachinePool{
Zones: []string{"us-west-2-pdx-1a", "us-east-1-foe-wlz-1a", "eu-west-3-cmn-wlz-1a"},
},
},
})
requiredPerms := RequiredPermissionGroups(ic)
assert.Contains(t, requiredPerms, PermissionCarrierGateway)
})
requiredPerms := RequiredPermissionGroups(ic)
assert.Contains(t, requiredPerms, PermissionCarrierGateway)
})
t.Run("Should be false when", func(t *testing.T) {
t.Run("edge compute specified without WL zones", func(t *testing.T) {
Expand Down