Skip to content

Commit

Permalink
Add support for osa21 for power-vs, fixing crash on options page (#…
Browse files Browse the repository at this point in the history
…1778)

* add support for osa21 zone in jp-osa region

Signed-off-by: Lucas-Franke <[email protected]>

* changelog

Signed-off-by: Lucas-Franke <[email protected]>

* provider edit

Signed-off-by: Lucas-Franke <[email protected]>

* changelog 2.0

Signed-off-by: Lucas-Franke <[email protected]>

---------

Signed-off-by: Lucas-Franke <[email protected]>
  • Loading branch information
Pseusco authored and GitHub Enterprise committed Mar 29, 2024
1 parent 36a6db2 commit 9898df4
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
- When creating a VSI Deployment, users can select a new toggle `Include Name Variables`. When this value is set to true, VSI names will be populated as variables in Terrafrom. This allows for users to have full control over VSI names without needing to directly modify Terraform scripts
- Power VS Virtual Server and FalconStor VTL system types are now retrieved dynamically using the Power VS API based on the zone
- Power Edge Router is now supported for `syd05`
- CRAIG now supports the Power VS region `osa21`
- When updating a VPC's Public Gateways, invalid gateways will automatically be removed from subnets where they are enabled

### Fixes
Expand Down
3 changes: 3 additions & 0 deletions client/src/components/pages/projects/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ class Wizard extends React.Component {
"jp-tok": ["tok04"],
"br-sao": ["sao01", "sao04"],
"ca-tor": ["tor01"],
"jp-osa": ["osa21"],
}[this.state.region]
}
itemToString={(item) => (item ? item : "")}
Expand All @@ -431,6 +432,7 @@ class Wizard extends React.Component {
"br-sao",
"jp-tok",
"ca-tor",
"jp-osa",
],
this.state.region
) || isEmpty(this.state.power_vs_zones)
Expand All @@ -447,6 +449,7 @@ class Wizard extends React.Component {
"br-sao",
"jp-tok",
"ca-tor",
"jp-osa",
],
this.state.region
)
Expand Down
2 changes: 2 additions & 0 deletions client/src/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,7 @@ module.exports = {
],
tor01: ["Tier3-Flash-2", "Tier3-Flash-1", "Tier1-Flash-2", "Tier1-Flash-1"],
wdc07: ["Tier3-Flash-2", "Tier3-Flash-1", "Tier1-Flash-2", "Tier1-Flash-1"],
osa21: [],
},
replicationEnabledStoragePoolMap: {
"us-east": ["Tier1-Flash-8", "General-Flash-185", "General-Flash-182"],
Expand Down Expand Up @@ -1121,5 +1122,6 @@ module.exports = {
"sao01",
"tor01",
"wdc07",
"osa21",
].sort(azsort),
};
1 change: 1 addition & 0 deletions client/src/lib/docs/release-notes.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"When creating a VSI Deployment, users can select a new toggle `Include Name Variables`. When this value is set to true, VSI names will be populated as variables in Terrafrom. This allows for users to have full control over VSI names without needing to directly modify Terraform scripts",
"Power VS Virtual Server and FalconStor VTL system types are now retrieved dynamically using the Power VS API based on the zone",
"Power Edge Router is now supported for `syd05`",
"CRAIG now supports the Power VS region `osa21`",
"When updating a VPC's Public Gateways, invalid gateways will automatically be removed from subnets where they are enabled"
],
"fixes": [
Expand Down
2 changes: 1 addition & 1 deletion client/src/lib/json-to-iac/power-vs-volumes.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function formatPowerVsVolume(volume, config) {
)}.volume_id}`;
}
} else {
data.pi_storage_pool = volume.pi_volume_pool?.replace(
data.pi_volume_pool = volume.pi_volume_pool?.replace(
" (Replication Enabled)",
""
);
Expand Down
13 changes: 10 additions & 3 deletions client/src/lib/json-to-iac/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,16 @@ function ibmCloudProvider(config) {
region: zone.match(
new RegexButWithWords()
.group((exp) => {
exp.literal("lon").or().literal("syd").or().literal("tok");
exp
.literal("lon")
.or()
.literal("syd")
.or()
.literal("tok")
.or()
.literal("osa")
.or()
.literal("sao");
})
.digit()
.oneOrMore()
Expand All @@ -53,8 +62,6 @@ function ibmCloudProvider(config) {
? "us-south"
: contains(["mad02", "mad04"], zone)
? "mad"
: contains(["sao01", "sao04"], zone)
? "sao"
: "${var.region}",
zone: zone,
ibmcloud_timeout: 60,
Expand Down
2 changes: 2 additions & 0 deletions client/src/lib/state/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const powerVsZones = [
"br-sao",
"jp-tok",
"ca-tor",
"jp-osa",
];

const powerHaMap = {
Expand Down Expand Up @@ -385,6 +386,7 @@ function initOptions(store) {
"jp-tok": ["tok04"],
"br-sao": ["sao01", "sao04"],
"ca-tor": ["tor01"],
"jp-osa": ["osa21"],
}[stateData.region];
},
},
Expand Down
1 change: 1 addition & 0 deletions express-controllers/power-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function getRegionFromZone(zone) {
["tor", ["tor01"]],
["syd", ["syd04", "syd05"]],
["tok", ["tok04"]],
["osa", ["osa21"]],
["sao", ["sao01", "sao04"]],
]);

Expand Down
1 change: 1 addition & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const defaultZones = [
"syd05",
"tok04",
"sao01",
"osa21",
// "sao04",
];

Expand Down
2 changes: 1 addition & 1 deletion unit-tests/json-to-iac/power-vs-volumes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ resource "ibm_pi_volume" "oracle_template_volume_oracle_1_db_1" {
pi_volume_name = "\${var.prefix}-oracle-template-oracle-1-db-1"
pi_volume_shareable = true
pi_replication_enabled = false
pi_storage_pool = "Tier1-Flash-4"
pi_volume_pool = "Tier1-Flash-4"
pi_volume_type = null
}
`;
Expand Down
10 changes: 9 additions & 1 deletion unit-tests/json-to-iac/provider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ provider "ibm" {
dynamic_subnets: true,
enable_power_vs: true,
craig_version: "1.6.0",
power_vs_zones: ["sao01"],
power_vs_zones: ["sao01", "sao04"],
power_vs_high_availability: true,
},
});
Expand Down Expand Up @@ -259,6 +259,14 @@ provider "ibm" {
ibmcloud_timeout = 60
}
provider "ibm" {
alias = "power_vs_sao04"
ibmcloud_api_key = var.ibmcloud_api_key
region = "sao"
zone = "sao04"
ibmcloud_timeout = 60
}
##############################################################################
`;
assert.deepEqual(actualData, expectedData, "it should return correct data");
Expand Down
4 changes: 4 additions & 0 deletions unit-tests/state/schema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ describe("automate schema generation", () => {
"eu-de-2",
"lon04",
"lon06",
"osa21",
"sao01",
"syd04",
"syd05",
Expand Down Expand Up @@ -634,6 +635,7 @@ describe("automate schema generation", () => {
"eu-de-2",
"lon04",
"lon06",
"osa21",
"sao01",
"syd04",
"syd05",
Expand Down Expand Up @@ -737,6 +739,7 @@ describe("automate schema generation", () => {
"eu-de-2",
"lon04",
"lon06",
"osa21",
"sao01",
"syd04",
"syd05",
Expand Down Expand Up @@ -769,6 +772,7 @@ describe("automate schema generation", () => {
"eu-de-2",
"lon04",
"lon06",
"osa21",
"sao01",
"syd04",
"syd05",
Expand Down

0 comments on commit 9898df4

Please sign in to comment.