Skip to content

Commit

Permalink
Add australiaeast azure region (kyma-project#664)
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmiskiewicz authored Apr 16, 2024
1 parent 0a33549 commit 420dbcb
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 19 deletions.
35 changes: 26 additions & 9 deletions internal/broker/plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,27 @@ func AzureRegions(euRestrictedAccess bool) []string {
"westeurope",
"japaneast",
"southeastasia",
"australiaeast",
}
}

func AzureRegionsDisplay() map[string]string {
return nil
func AzureRegionsDisplay(euRestrictedAccess bool) map[string]string {
if euRestrictedAccess {
return map[string]string{
"switzerlandnorth": "switzerlandnorth (Switzerland, Zurich)",
}
}
return map[string]string{
"eastus": "eastus (US East, VA)",
"centralus": "centralus (US Central, IA)",
"westus2": "westus2 (US West, WA)",
"uksouth": "uksouth (UK South, London)",
"northeurope": "northeurope (Europe, Ireland)",
"westeurope": "westeurope (Europe, Netherlands)",
"japaneast": "japaneast (Japan, Tokyo)",
"southeastasia": "southeastasia (Asia Pacific, Singapore)",
"australiaeast": "australiaeast (Australia, Sydney)",
}
}

func GcpRegions() []string {
Expand Down Expand Up @@ -339,7 +355,7 @@ func AzureLiteSchema(machineTypesDisplay, regionsDisplay map[string]string, mach
return createSchemaWithProperties(properties, additionalParams, update, requiredSchemaProperties())
}

func FreemiumSchema(provider internal.CloudProvider, additionalParams, update bool, euAccessRestricted bool) *map[string]interface{} {
func FreemiumSchema(provider internal.CloudProvider, regionsDisplay map[string]string, additionalParams, update bool, euAccessRestricted bool) *map[string]interface{} {
if update && !additionalParams {
return empty()
}
Expand All @@ -356,9 +372,10 @@ func FreemiumSchema(provider internal.CloudProvider, additionalParams, update bo
properties := ProvisioningProperties{
Name: NameProperty(),
Region: &Type{
Type: "string",
Enum: ToInterfaceSlice(regions),
MinLength: 1,
Type: "string",
Enum: ToInterfaceSlice(regions),
MinLength: 1,
EnumDisplayName: regionsDisplay,
},
}
if !update {
Expand Down Expand Up @@ -448,7 +465,7 @@ func Plans(plans PlansConfig, provider internal.CloudProvider, includeAdditional
awsRegionsDisplay := AWSRegionsDisplay()
azureMachinesNames := AzureMachinesNames()
azureMachinesDisplay := AzureMachinesDisplay()
azureRegionsDisplay := AzureRegionsDisplay()
azureRegionsDisplay := AzureRegionsDisplay(euAccessRestricted)
azureLiteMachinesNames := AzureLiteMachinesNames()
azureLiteMachinesDisplay := AzureLiteMachinesDisplay()
gcpMachinesNames := GcpMachinesNames()
Expand Down Expand Up @@ -487,7 +504,7 @@ func Plans(plans PlansConfig, provider internal.CloudProvider, includeAdditional
// awsHASchema := AWSHASchema(awsMachinesDisplay, awsMachines, includeAdditionalParamsInSchema, false)
azureSchema := AzureSchema(azureMachinesDisplay, azureRegionsDisplay, azureMachinesNames, includeAdditionalParamsInSchema, false, euAccessRestricted)
azureLiteSchema := AzureLiteSchema(azureLiteMachinesDisplay, azureRegionsDisplay, azureLiteMachinesNames, includeAdditionalParamsInSchema, false, euAccessRestricted)
freemiumSchema := FreemiumSchema(provider, includeAdditionalParamsInSchema, false, euAccessRestricted)
freemiumSchema := FreemiumSchema(provider, azureRegionsDisplay, includeAdditionalParamsInSchema, false, euAccessRestricted)
gcpSchema := GCPSchema(gcpMachinesDisplay, gcpRegionsDisplay, gcpMachinesNames, includeAdditionalParamsInSchema, false)
ownClusterSchema := OwnClusterSchema(false)
previewCatalogSchema := PreviewSchema(awsMachinesDisplay, awsRegionsDisplay, awsMachineNames, includeAdditionalParamsInSchema, false, euAccessRestricted)
Expand All @@ -500,7 +517,7 @@ func Plans(plans PlansConfig, provider internal.CloudProvider, includeAdditional
SapConvergedCloudPlanID: defaultServicePlan(SapConvergedCloudPlanID, SapConvergedCloudPlanName, plans, sapConvergedCloudSchema, SapConvergedCloudSchema(sapConvergedCloudMachinesDisplay, sapConvergedCloudRegionsDisplay, sapConvergedCloudMachinesNames, includeAdditionalParamsInSchema, true)),
AzurePlanID: defaultServicePlan(AzurePlanID, AzurePlanName, plans, azureSchema, AzureSchema(azureMachinesDisplay, azureRegionsDisplay, azureMachinesNames, includeAdditionalParamsInSchema, true, euAccessRestricted)),
AzureLitePlanID: defaultServicePlan(AzureLitePlanID, AzureLitePlanName, plans, azureLiteSchema, AzureLiteSchema(azureLiteMachinesDisplay, azureRegionsDisplay, azureLiteMachinesNames, includeAdditionalParamsInSchema, true, euAccessRestricted)),
FreemiumPlanID: defaultServicePlan(FreemiumPlanID, FreemiumPlanName, plans, freemiumSchema, FreemiumSchema(provider, includeAdditionalParamsInSchema, true, euAccessRestricted)),
FreemiumPlanID: defaultServicePlan(FreemiumPlanID, FreemiumPlanName, plans, freemiumSchema, FreemiumSchema(provider, azureRegionsDisplay, includeAdditionalParamsInSchema, true, euAccessRestricted)),
TrialPlanID: defaultServicePlan(TrialPlanID, TrialPlanName, plans, trialSchema, TrialSchema(includeAdditionalParamsInSchema, true)),
OwnClusterPlanID: defaultServicePlan(OwnClusterPlanID, OwnClusterPlanName, plans, ownClusterSchema, OwnClusterSchema(true)),
PreviewPlanID: defaultServicePlan(PreviewPlanID, PreviewPlanName, plans, previewCatalogSchema, AWSSchema(awsMachinesDisplay, awsRegionsDisplay, awsMachineNames, includeAdditionalParamsInSchema, true, euAccessRestricted)),
Expand Down
14 changes: 10 additions & 4 deletions internal/broker/plans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func TestSchemaGenerator(t *testing.T) {
},
machineTypes: AzureMachinesNames(),
machineTypesDisplay: AzureMachinesDisplay(),
regionDisplay: AzureRegionsDisplay(false),
path: "azure",
file: "azure-schema.json",
updateFile: "update-azure-schema.json",
Expand All @@ -92,6 +93,7 @@ func TestSchemaGenerator(t *testing.T) {
},
machineTypes: AzureMachinesNames(),
machineTypesDisplay: AzureMachinesDisplay(),
regionDisplay: AzureRegionsDisplay(true),
path: "azure",
file: "azure-schema-eu.json",
updateFile: "update-azure-schema.json",
Expand All @@ -105,6 +107,7 @@ func TestSchemaGenerator(t *testing.T) {
},
machineTypes: AzureLiteMachinesNames(),
machineTypesDisplay: AzureLiteMachinesDisplay(),
regionDisplay: AzureRegionsDisplay(false),
path: "azure",
file: "azure-lite-schema.json",
updateFile: "update-azure-lite-schema.json",
Expand All @@ -118,6 +121,7 @@ func TestSchemaGenerator(t *testing.T) {
},
machineTypes: AzureLiteMachinesNames(),
machineTypesDisplay: AzureLiteMachinesDisplay(),
regionDisplay: AzureRegionsDisplay(true),
path: "azure",
file: "azure-lite-schema-eu.json",
updateFile: "update-azure-lite-schema.json",
Expand All @@ -127,9 +131,10 @@ func TestSchemaGenerator(t *testing.T) {
{
name: "Freemium schema is correct",
generator: func(machinesDisplay, regionsDisplay map[string]string, machines []string, additionalParams, update bool) *map[string]interface{} {
return FreemiumSchema(internal.Azure, additionalParams, update, false)
return FreemiumSchema(internal.Azure, regionsDisplay, additionalParams, update, false)
},
machineTypes: []string{},
regionDisplay: AzureRegionsDisplay(false),
path: "azure",
file: "free-azure-schema.json",
updateFile: "update-free-azure-schema.json",
Expand All @@ -139,7 +144,7 @@ func TestSchemaGenerator(t *testing.T) {
{
name: " Freemium schema is correct",
generator: func(machinesDisplay, regionsDisplay map[string]string, machines []string, additionalParams, update bool) *map[string]interface{} {
return FreemiumSchema(internal.AWS, additionalParams, update, false)
return FreemiumSchema(internal.AWS, regionsDisplay, additionalParams, update, false)
},
machineTypes: []string{},
path: "aws",
Expand All @@ -151,9 +156,10 @@ func TestSchemaGenerator(t *testing.T) {
{
name: "Freemium schema with EU access restriction is correct",
generator: func(machinesDisplay, regionsDisplay map[string]string, machines []string, additionalParams, update bool) *map[string]interface{} {
return FreemiumSchema(internal.Azure, additionalParams, update, true)
return FreemiumSchema(internal.Azure, regionsDisplay, additionalParams, update, true)
},
machineTypes: []string{},
regionDisplay: AzureRegionsDisplay(true),
path: "azure",
file: "free-azure-schema-eu.json",
updateFile: "update-free-azure-schema.json",
Expand All @@ -163,7 +169,7 @@ func TestSchemaGenerator(t *testing.T) {
{
name: "Freemium schema with EU access restriction is correct",
generator: func(machinesDisplay, regionsDisplay map[string]string, machines []string, additionalParams, update bool) *map[string]interface{} {
return FreemiumSchema(internal.AWS, additionalParams, update, true)
return FreemiumSchema(internal.AWS, regionsDisplay, additionalParams, update, true)
},
machineTypes: []string{},
path: "aws",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"switzerlandnorth": "switzerlandnorth (Switzerland, Zurich)"
},
"enum": [
"switzerlandnorth"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"eastus": "eastus (US East, VA)",
"centralus": "centralus (US Central, IA)",
"westus2": "westus2 (US West, WA)",
"uksouth": "uksouth (UK South, London)",
"northeurope": "northeurope (Europe, Ireland)",
"westeurope": "westeurope (Europe, Netherlands)",
"japaneast": "japaneast (Japan, Tokyo)",
"southeastasia": "southeastasia (Asia Pacific, Singapore)",
"australiaeast": "australiaeast (Australia, Sydney)"
},
"enum": [
"eastus",
"centralus",
Expand All @@ -201,7 +212,8 @@
"northeurope",
"westeurope",
"japaneast",
"southeastasia"
"southeastasia",
"australiaeast"
],
"minLength": 1,
"type": "string"
Expand Down
3 changes: 3 additions & 0 deletions internal/broker/testdata/azure/azure-lite-schema-eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"switzerlandnorth": "switzerlandnorth (Switzerland, Zurich)"
},
"enum": [
"switzerlandnorth"
],
Expand Down
14 changes: 13 additions & 1 deletion internal/broker/testdata/azure/azure-lite-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"eastus": "eastus (US East, VA)",
"centralus": "centralus (US Central, IA)",
"westus2": "westus2 (US West, WA)",
"uksouth": "uksouth (UK South, London)",
"northeurope": "northeurope (Europe, Ireland)",
"westeurope": "westeurope (Europe, Netherlands)",
"japaneast": "japaneast (Japan, Tokyo)",
"southeastasia": "southeastasia (Asia Pacific, Singapore)",
"australiaeast": "australiaeast (Australia, Sydney)"
},
"enum": [
"eastus",
"centralus",
Expand All @@ -154,7 +165,8 @@
"northeurope",
"westeurope",
"japaneast",
"southeastasia"
"southeastasia",
"australiaeast"
],
"minLength": 1,
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"switzerlandnorth": "switzerlandnorth (Switzerland, Zurich)"
},
"enum": [
"switzerlandnorth"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,17 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"eastus": "eastus (US East, VA)",
"centralus": "centralus (US Central, IA)",
"westus2": "westus2 (US West, WA)",
"uksouth": "uksouth (UK South, London)",
"northeurope": "northeurope (Europe, Ireland)",
"westeurope": "westeurope (Europe, Netherlands)",
"japaneast": "japaneast (Japan, Tokyo)",
"southeastasia": "southeastasia (Asia Pacific, Singapore)",
"australiaeast": "australiaeast (Australia, Sydney)"
},
"enum": [
"eastus",
"centralus",
Expand All @@ -223,7 +234,8 @@
"northeurope",
"westeurope",
"japaneast",
"southeastasia"
"southeastasia",
"australiaeast"
],
"minLength": 1,
"type": "string"
Expand Down
3 changes: 3 additions & 0 deletions internal/broker/testdata/azure/azure-schema-eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"switzerlandnorth": "switzerlandnorth (Switzerland, Zurich)"
},
"enum": [
"switzerlandnorth"
],
Expand Down
14 changes: 13 additions & 1 deletion internal/broker/testdata/azure/azure-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"eastus": "eastus (US East, VA)",
"centralus": "centralus (US Central, IA)",
"westus2": "westus2 (US West, WA)",
"uksouth": "uksouth (UK South, London)",
"northeurope": "northeurope (Europe, Ireland)",
"westeurope": "westeurope (Europe, Netherlands)",
"japaneast": "japaneast (Japan, Tokyo)",
"southeastasia": "southeastasia (Asia Pacific, Singapore)",
"australiaeast": "australiaeast (Australia, Sydney)"
},
"enum": [
"eastus",
"centralus",
Expand All @@ -176,7 +187,8 @@
"northeurope",
"westeurope",
"japaneast",
"southeastasia"
"southeastasia",
"australiaeast"
],
"minLength": 1,
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"switzerlandnorth": "switzerlandnorth (Switzerland, Zurich)"
},
"enum": [
"switzerlandnorth"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"eastus": "eastus (US East, VA)",
"centralus": "centralus (US Central, IA)",
"westus2": "westus2 (US West, WA)",
"uksouth": "uksouth (UK South, London)",
"northeurope": "northeurope (Europe, Ireland)",
"westeurope": "westeurope (Europe, Netherlands)",
"japaneast": "japaneast (Japan, Tokyo)",
"southeastasia": "southeastasia (Asia Pacific, Singapore)",
"australiaeast": "australiaeast (Australia, Sydney)"
},
"enum": [
"eastus",
"centralus",
Expand All @@ -174,7 +185,8 @@
"northeurope",
"westeurope",
"japaneast",
"southeastasia"
"southeastasia",
"australiaeast"
],
"minLength": 1,
"type": "string"
Expand Down
3 changes: 3 additions & 0 deletions internal/broker/testdata/azure/free-azure-schema-eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"switzerlandnorth": "switzerlandnorth (Switzerland, Zurich)"
},
"enum": [
"switzerlandnorth"
],
Expand Down
14 changes: 13 additions & 1 deletion internal/broker/testdata/azure/free-azure-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@
"type": "object"
},
"region": {
"_enumDisplayName": {
"eastus": "eastus (US East, VA)",
"centralus": "centralus (US Central, IA)",
"westus2": "westus2 (US West, WA)",
"uksouth": "uksouth (UK South, London)",
"northeurope": "northeurope (Europe, Ireland)",
"westeurope": "westeurope (Europe, Netherlands)",
"japaneast": "japaneast (Japan, Tokyo)",
"southeastasia": "southeastasia (Asia Pacific, Singapore)",
"australiaeast": "australiaeast (Australia, Sydney)"
},
"enum": [
"eastus",
"centralus",
Expand All @@ -127,7 +138,8 @@
"northeurope",
"westeurope",
"japaneast",
"southeastasia"
"southeastasia",
"australiaeast"
],
"minLength": 1,
"type": "string"
Expand Down

0 comments on commit 420dbcb

Please sign in to comment.