Skip to content

Commit

Permalink
Issue 1563: ipv4 cidr fixes (#1573)
Browse files Browse the repository at this point in the history
* Use only one provider for workspace creation

Only use one provider for Power VS workspace creation.
This avoid issues in Schematics.

* Release notes, remove commented out providers

* Fix deploy.sh Schematics related issues (#1566)

* Fix cross-platform handling of workspace multiplicity check on destroy
* Fix cross-platform sed input issue. Mac does not have GNU sed

* feat: power vs v2 enhancements

* fix: ipv4 blocks

* fix: issue-1570

* fix: issue-1570

* fix: import

* add tile for no ssh key

Signed-off-by: Lucas-Franke <Lucas.Franke@ibm.com>

* feat: tiles

* prettier

* merge

* fix: changelog

---------

Signed-off-by: Lucas-Franke <Lucas.Franke@ibm.com>
Co-authored-by: Samuel Matzek <smatzek@us.ibm.com>
Co-authored-by: Lucas-Franke <Lucas.Franke@ibm.com>
  • Loading branch information
3 people authored and GitHub Enterprise committed Feb 23, 2024
1 parent 60e9e9f commit 92acd40
Show file tree
Hide file tree
Showing 33 changed files with 307 additions and 680 deletions.
13 changes: 8 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ All notable changes to this project will be documented in this file.

### Upgrade Notes

- Updated deploy script to create the ICR namespace in the user provided region and resource group
- Updated deploy script to generate a unique ICR namespace value if the `-n` flag is not provided to avoid existing namespace conflicts within the selected region


### Features

- When attempting to create a resource that requires an SSH Key using the V2 pages, users will now be directed to first create an SSH key instead of viewing the form
- CRAIG deploy script now creates an ICR namespace in the user provided region and resource group
- CRAIG deploy script now generates a unique ICR namespace value if the `-n` flag is not provided to avoid existing namespace conflicts within the selected region

### Fixes

- Fixed an issue causing Schematics to fail provisioning Power VS Workspaces in every zone
- Fixed an issue causing Power VS Workspace deploy scripts to fail in schematics
- Fixed an issue causing CIDR blocks and IP addresses to be incorrectly marked as invalid
- Fixed an issue causing SSH Keys to incorrectly display as invalid on V2 pages when using the same public key for VPC, Power, or Classic
- Fixed an issue causing invalid VPC VSI images to persist after removing references when importing a project


## 1.11.1

Expand Down
8 changes: 4 additions & 4 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"icse-react-assets": "1.2.37",
"json-to-tf": "^0.3.1",
"jszip": "^3.10.1",
"lazy-z": "^1.11.16",
"lazy-z": "^1.11.17",
"react": "^18.0.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.0.0",
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/pages/about.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,7 @@ div .center {
#craig-about .cds--accordion__title {
font-size: 1.25rem;
}

.width580 {
width: 580px !important;
}
6 changes: 6 additions & 0 deletions client/src/components/pages/classic/Classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ class ClassicDiagram extends React.Component {
)}
{isNullOrEmptyString(this.state.modalService, true) ? (
<></>
) : this.state.modalService === "classic_gateways" &&
this.props.craig.store.json.classic_ssh_keys.length === 0 ? (
<CraigEmptyResourceTile
noClick
name="Classic SSH keys. To enable creation of this resource, create an SSH key"
/>
) : (
<DynamicForm
className="formInSubForm"
Expand Down
10 changes: 6 additions & 4 deletions client/src/components/pages/diagrams/DeploymentIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ function deploymentIconBoxClassName(props) {
boxClassName += " diagramIconBoxSelected";
}
if (
disableSave(props.itemName, props.item, {
craig: props.craig,
data: props.item,
})
typeof props.isInvalid === "boolean"
? props.isInvalid
: disableSave(props.itemName, props.item, {
craig: props.craig,
data: props.item,
})
) {
boxClassName += " diagramIconBoxInvalid";
} else if (props.itemName === "vpn_gateways") {
Expand Down
15 changes: 11 additions & 4 deletions client/src/components/pages/diagrams/SshKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ export const SshKeys = (props) => {
>
<DeploymentIcon
isSelected={props.isSelected}
isInvalid={disableSave("ssh_keys", sshKey, {
craig: craig,
data: sshKey,
})}
isInvalid={
props.classic
? craig.classic_ssh_keys.public_key.invalid(sshKey, {
data: sshKey,
craig: craig,
})
: disableSave("ssh_keys", sshKey, {
craig: craig,
data: sshKey,
})
}
craig={craig}
itemName="ssh_keys"
itemIndex={sshKeyIndex}
Expand Down
116 changes: 67 additions & 49 deletions client/src/components/pages/power/Power.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import { PowerMap } from "../diagrams/PowerMap";
import { PowerSshKeys } from "./PowerSshKeys";
import { PowerSubnets } from "./PowerSubnets";
import { PowerVolumes } from "./PowerVolumes";
import { NoPowerNetworkTile } from "../../forms/dynamic-form";
import {
CraigEmptyResourceTile,
NoPowerNetworkTile,
} from "../../forms/dynamic-form";
import { PowerVolumeTable } from "./PowerVolumeTable";
import { ScrollFormWrapper } from "../diagrams/ScrollFormWrapper";
import { powerInstanceTf, powerVsVolumeTf } from "../../../lib/json-to-iac";
Expand Down Expand Up @@ -286,6 +289,13 @@ class PowerDiagram extends React.Component {
{isNullOrEmptyString(this.state.modalService, true) ? (
// need to pass html element
<></>
) : craig.store.json.power[this.state.powerIndex]?.ssh_keys
?.length === 0 &&
contains(["vtl", "power_instances"], this.state.modalService) ? (
<CraigEmptyResourceTile
name="Power VS SSH keys. To enable creation of this resource, create an SSH key"
noClick
/>
) : (
<DynamicForm
className="formInSubForm"
Expand Down Expand Up @@ -452,62 +462,70 @@ class PowerDiagram extends React.Component {
</div>
<div className="displayFlex" style={{ width: "100%" }}>
<div id="left-power">
<PowerMap
craig={craig}
onClick={this.onPowerWorkspaceClick}
isSelected={(powerIndex) => {
return (
this.state.selectedItem === "power" &&
this.state.selectedIndex === powerIndex
);
}}
buttons={(powerIndex) => {
return (
<PrimaryButton
noDeleteButton
type="add"
name="Create a Deployment"
onClick={() =>
this.onWorkspaceButtonClick(powerIndex)
}
/>
);
}}
>
<PowerSshKeys
onClick={this.onPowerWorkspaceClick}
craig={craig}
{craig.store.json.power.length === 0 &&
craig.store.json._options.enable_power_vs ? (
<CraigEmptyResourceTile
name="Power VS Workspaces"
className="width580 marginTop1Rem"
/>
<PowerSubnets
) : (
<PowerMap
craig={craig}
onPowerWorkspaceClick={this.onPowerWorkspaceClick}
onPowerInstanceClick={this.onPowerInstanceClick}
onVolumeClick={this.onVolumeClick}
onVtlClick={this.onVtlClick}
isSelected={(props) => {
return (
this.state.selectedIndex === props.index &&
this.state.selectedItem === props.itemName
);
}}
volumeIsSelected={(volumeIndex) => {
onClick={this.onPowerWorkspaceClick}
isSelected={(powerIndex) => {
return (
this.state.selectedItem === "power_volumes" &&
volumeIndex === this.state.selectedIndex
this.state.selectedItem === "power" &&
this.state.selectedIndex === powerIndex
);
}}
/>
<PowerVolumes
craig={craig}
isSelected={(props) => {
buttons={(powerIndex) => {
return (
this.state.selectedIndex === props.index &&
this.state.selectedItem === props.itemName
<PrimaryButton
noDeleteButton
type="add"
name="Create a Deployment"
onClick={() =>
this.onWorkspaceButtonClick(powerIndex)
}
/>
);
}}
onVolumeClick={this.onVolumeClick}
/>
</PowerMap>
>
<PowerSshKeys
onClick={this.onPowerWorkspaceClick}
craig={craig}
/>
<PowerSubnets
craig={craig}
onPowerWorkspaceClick={this.onPowerWorkspaceClick}
onPowerInstanceClick={this.onPowerInstanceClick}
onVolumeClick={this.onVolumeClick}
onVtlClick={this.onVtlClick}
isSelected={(props) => {
return (
this.state.selectedIndex === props.index &&
this.state.selectedItem === props.itemName
);
}}
volumeIsSelected={(volumeIndex) => {
return (
this.state.selectedItem === "power_volumes" &&
volumeIndex === this.state.selectedIndex
);
}}
/>
<PowerVolumes
craig={craig}
isSelected={(props) => {
return (
this.state.selectedIndex === props.index &&
this.state.selectedItem === props.itemName
);
}}
onVolumeClick={this.onVolumeClick}
/>
</PowerMap>
)}
</div>
<div id="right-power">
{this.state.editing === true ? (
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/pages/power/PowerSshKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export const PowerSshKeys = (props) => {
icon={Password}
itemName="ssh_keys"
craig={props.craig}
isInvalid={props.craig.power.ssh_keys.public_key.invalid(sshKey, {
data: sshKey,
craig: props.craig,
})}
/>
))}
</div>
Expand Down
12 changes: 10 additions & 2 deletions client/src/components/pages/projects/Projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { Button } from "@carbon/react";
import { ProjectFormModal } from "./ProjectFormModal";
import { JSONModal } from "./JSONModal";
import { azsort, contains, eachKey, splatContains } from "lazy-z";
import { azsort, contains, eachKey, splat, splatContains } from "lazy-z";
import { Add, MagicWandFilled, Upload } from "@carbon/icons-react";
import { ProjectTile } from "./ProjectTile";
import { CraigHeader } from "../SplashPage";
Expand Down Expand Up @@ -202,7 +202,15 @@ class Projects extends React.Component {
this.props.craig.store.json[item].forEach((resource) => {
// if the resource name is contained in the list of invalid items
// set the reference to null
if (contains(this.state.invalidItems[item], resource.name)) {
if (
item === "vsi"
? splatContains(
this.state.invalidItems[item],
"vsi",
resource.name
)
: contains(this.state.invalidItems[item], resource.name)
) {
if (item === "vsi" && resource.image_name) {
resource.image_name = null;
resource.image = null;
Expand Down
11 changes: 10 additions & 1 deletion client/src/components/pages/vpc/VpcDeployments.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ import {
docTabs,
} from "../diagrams";
import { NoSecretsManagerTile } from "../../utils/NoSecretsManagerTile";
import { NoVpcVsiTile } from "../../forms/dynamic-form/tiles";
import {
CraigEmptyResourceTile,
NoVpcVsiTile,
} from "../../forms/dynamic-form/tiles";
import { RoutingTables } from "../diagrams/RoutingTables";
import { F5BigIp } from "../FormPages";
import f5 from "../../../images/f5.png";
Expand Down Expand Up @@ -352,6 +355,12 @@ class VpcDeploymentsDiagramPage extends React.Component {
) : this.state.selectedItem === "vpn_servers" &&
craig.store.json.secrets_manager.length === 0 ? (
<NoSecretsManagerTile />
) : contains(["fortigate_vnf", "vsi"], this.state.selectedItem) &&
craig.store.json.ssh_keys.length === 0 ? (
<CraigEmptyResourceTile
name="VPC SSH keys. To enable creation of this resource, create an SSH key"
noClick
/>
) : (
<DynamicForm
key={this.state.selectedItem}
Expand Down
18 changes: 11 additions & 7 deletions client/src/lib/docs/release-notes.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
[
{
"version": "1.11.2",
"features": [],
"features": [
"When attempting to create a resource that requires an SSH Key using the V2 pages, users will now be directed to first create an SSH key instead of viewing the form",
"CRAIG deploy script now creates an ICR namespace in the user provided region and resource group",
"CRAIG deploy script now generates a unique ICR namespace value if the `-n` flag is not provided to avoid existing namespace conflicts within the selected region"
],
"fixes": [
"Fixed an issue causing Schematics to fail provisioning Power VS Workspaces in every zone"
"Fixed an issue causing Power VS Workspace deploy scripts to fail in schematics",
"Fixed an issue causing CIDR blocks and IP addresses to be incorrectly marked as invalid",
"Fixed an issue causing SSH Keys to incorrectly display as invalid on V2 pages when using the same public key for VPC, Power, or Classic",
"Fixed an issue causing invalid VPC VSI images to persist after removing references when importing a project"
],
"upgrade_notes": [
"Updated deploy script to create the ICR namespace in the user provided region and resource group",
"Updated deploy script to generate a unique ICR namespace value if the `-n` flag is not provided to avoid existing namespace conflicts within the selected region"
]
},
"upgrade_notes": []
},
{
"version": "1.11.1",
"features": [
Expand Down
2 changes: 1 addition & 1 deletion client/src/lib/docs/templates/from-scratch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"enable_classic": false,
"dynamic_subnets": true,
"enable_power_vs": false,
"craig_version": "1.11.1",
"craig_version": "1.11.2",
"power_vs_zones": [],
"power_vs_high_availability": false
},
Expand Down
2 changes: 1 addition & 1 deletion client/src/lib/docs/templates/oracle-si.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dynamic_subnets": false,
"enable_power_vs": true,
"power_vs_zones": ["dal12", "dal10", "us-south"],
"craig_version": "1.11.1",
"craig_version": "1.11.2",
"power_vs_high_availability": false
},
"access_groups": [],
Expand Down
2 changes: 1 addition & 1 deletion client/src/lib/docs/templates/power-poc-quick-start.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"enable_power_vs": true,
"enable_classic": false,
"power_vs_zones": ["dal10"],
"craig_version": "1.11.1",
"craig_version": "1.11.2",
"power_vs_high_availability": false,
"template": "Power VS POC",
"fs_cloud": false
Expand Down
2 changes: 1 addition & 1 deletion client/src/lib/docs/templates/power-sap-hana.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dynamic_subnets": false,
"enable_power_vs": true,
"power_vs_zones": ["us-south"],
"craig_version": "1.11.1",
"craig_version": "1.11.2",
"power_vs_high_availability": false,
"template": "Power VS SAP Hana"
},
Expand Down
2 changes: 1 addition & 1 deletion client/src/lib/docs/templates/quick-start-power.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"enable_power_vs": true,
"enable_classic": false,
"power_vs_zones": ["dal12"],
"craig_version": "1.11.1",
"craig_version": "1.11.2",
"power_vs_high_availability": false,
"fs_cloud": false
},
Expand Down
Loading

0 comments on commit 92acd40

Please sign in to comment.