Skip to content

Commit

Permalink
feat: pin policy (#1690)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvallexm authored and GitHub Enterprise committed Mar 15, 2024
1 parent c2d298d commit c3b6c33
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ All notable changes to this project will be documented in this file.
- Users can now upload JSON directly to CRAIG from the local file explorer from the Projects page by clicking the new `Upload JSON` button
- Users can now create Classic Bare Metal Servers from the form page `/form/classicBareMetal`
- Power VS Instance Primary IP addresses are now included as outputs in the `outputs.tf` file of any CRAIG Terraform template
- When downloading a `.zip` file of an environment from the CRAIG GUI, an image of the current environment is now included in
- When downloading a `.zip` file of an environment from the CRAIG GUI, an image of the current environment is now included in the archive
- CRAIG now supports adding a Pin Policy to Power VS instances

### Fixes

Expand Down
1 change: 1 addition & 0 deletions client/src/components/pages/CraigForms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,7 @@ function craigForms(craig) {
{
network: craig.power_instances.network,
primary_subnet: craig.power_instances.primary_subnet,
pi_pin_policy: craig.power_instances.pi_pin_policy,
},
{
image: craig.power_instances.image,
Expand Down
3 changes: 2 additions & 1 deletion client/src/lib/docs/release-notes.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"Users can now upload JSON directly to CRAIG from the local file explorer from the Projects page by clicking the new `Upload JSON` button",
"Users can now create Classic Bare Metal Servers from the form page `/form/classicBareMetal`",
"Power VS Instance Primary IP addresses are now included as outputs in the `outputs.tf` file of any CRAIG Terraform template",
"When downloading a `.zip` file of an environment from the CRAIG GUI, an image of the current environment is now included in "
"When downloading a `.zip` file of an environment from the CRAIG GUI, an image of the current environment is now included in the archive",
"CRAIG now supports adding a Pin Policy to Power VS instances"
],
"fixes": [
"Fixed an issue with button hoverText alignment causing overflow in forms",
Expand Down
13 changes: 13 additions & 0 deletions client/src/lib/state/power-vs-instances/power-instances-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,19 @@ function powerVsInstanceSchema(vtl) {
labelText: "User Data",
placeholder: "Cloud init data",
},
pi_pin_policy: {
labelText: "Pin Policy",
type: "select",
size: "small",
groups: ["Soft", "Hard", "None"],
default: "none",
onRender: titleCaseRender("pi_pin_policy"),
onInputChange: kebabCaseInput("pi_pin_policy"),
tooltip: {
content:
"When you soft pin an instance for high availability, the instance automatically migrates back to the original host once the host is back to its operating state. If the instance has a licensing restriction with the host, the hard pin option restricts the movement of the instance during remote restart, automated remote restart, DRO, and live partition migration. The default pinning policy is none",
},
},
};
}

Expand Down
47 changes: 47 additions & 0 deletions unit-tests/json-to-iac/power-vs-instances.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,53 @@ resource "ibm_pi_instance" "example_workspace_instance_test" {
network_id = ibm_pi_network.power_network_example_dev_nw.network_id
}
}
`;
assert.deepEqual(
actualData,
expectedData,
"it should return correct instance data"
);
});
it("should correctly return power vs instance data with pin policy", () => {
let actualData = formatPowerVsInstance({
zone: "dal12",
workspace: "example",
name: "test",
image: "SLES15-SP3-SAP",
ssh_key: "keyname",
network: [
{
name: "dev-nw",
},
],
primary_subnet: "dev-nw",
pi_memory: "4",
pi_processors: "2",
pi_proc_type: "shared",
pi_sys_type: "s922",
pi_health_status: "WARNING",
pi_storage_type: "tier1",
pi_user_data: "",
pi_pin_policy: "soft",
});
let expectedData = `
resource "ibm_pi_instance" "example_workspace_instance_test" {
provider = ibm.power_vs_dal12
pi_image_id = ibm_pi_image.power_image_example_sles15_sp3_sap.image_id
pi_key_pair_name = ibm_pi_key.power_vs_ssh_key_keyname.pi_key_name
pi_cloud_instance_id = ibm_resource_instance.power_vs_workspace_example.guid
pi_instance_name = "\${var.prefix}-test"
pi_memory = "4"
pi_processors = "2"
pi_proc_type = "shared"
pi_sys_type = "s922"
pi_health_status = "WARNING"
pi_storage_type = "tier1"
pi_pin_policy = "soft"
pi_network {
network_id = ibm_pi_network.power_network_example_dev_nw.network_id
}
}
`;
assert.deepEqual(
actualData,
Expand Down

0 comments on commit c3b6c33

Please sign in to comment.