Skip to content

Commit

Permalink
Merge remote-tracking branch 'internal/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
jvallexm committed May 10, 2024
2 parents 4e70a39 + 7228e5e commit af33fab
Show file tree
Hide file tree
Showing 36 changed files with 812 additions and 624 deletions.
45 changes: 1 addition & 44 deletions .docs/craig-code-engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,47 +34,4 @@ The Code Engine image build and application settings can be used to manage the C

## Bring your own Power VS workspace

### Background
You can bring your own existing Power VS workspace into CRAIG which allows you to choose custom images for Power VSIs.

The IBM Code Engine deployment script will automatically create Power VS workspaces in every Power VS zone worldwide for CRAIG's use when using the `-z` parameter.

If you do not want Power VS workspaces created in every zone, you can create the Power VS Workspaces in your chosen zone(s) using the Clould console, CLI, or other means. The [generate-env.sh](../generate-env.sh) script can generate an environment file that can be used with the `deploy.sh` script to configure CRAIG to use the workspaces.

#### generate-env.sh prerequisites
- [jq](https://jqlang.github.io/jq/) v1.7 or higher
- ibmcloud CLI

#### Downloading generate-env.sh in IBM Cloud Shell
From within IBM Cloud Shell run the following two commands to download the script and make it executable:
```bash
wget https://raw.githubusercontent.com/IBM/CRAIG/main/generate-env.sh
chmod 755 generate-env.sh
```

To generate an env containing all of the workspaces in your account, you can run the following command:

```
./generate-env.sh env
```

The `env` file should then be modified to remove or comment out any workspaces that CRAIG should not use, and to ensure it contains only one workspace per zone.

The `env` file can then be used on the `deploy.sh` script:

```
./deploy.sh -e env
```

### Modifying the configmap
If you want to bring your own workspace after CRAIG deployment in Code Engine you can update the configmap with the GUID of your workspace.

To find the GUIDs and locations of your workspaces, the following IBM Cloud CLI command can be run in a terminal window or an IBM Cloud Shell:

```
ibmcloud resource service-instances --service-name power-iaas --output json | jq -r '.[]? | "\(.guid), \(.name), \(.region_id)"'
```

To modify the configmap to add your workspace GUID, click on `Secrets and configmaps` on left navigation pane of the Code Engine project. Click on the `craig-env` Configmap. Find the key that matches your workspace's zone and set your workspace's GUID as the value for the key. Click the `Save` button. The CRAIG instance can then be [redeployed](#redeploying-the-craig-instance) to pick up the configmap change.

If CRAIG was deployed without specifying `-z` or `-e`, a configmap can be manually created and set with the correct key-value for the zone. See the [.env.example](../.env.example) for the possible keys and the [IBM Code Engine documentation](https://cloud.ibm.com/docs/codeengine?topic=codeengine-configmap) for how to create the configmap and add the reference to the `craig` application.
For more information on how to bring your own Power VS workspaces to CRAIG, refer to our [power-vs-workspace-deployment.md](./power-vs-workspace-deployment.md) documentation.
87 changes: 72 additions & 15 deletions .docs/power-vs-workspace-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
To dynamically fetch Power VS images and storage pools within CRAIG, the IBM Power VS APIs require a workspace to be created. CRAIG provides Terraform scripts to automatically provision these workspaces and an environment file that can be used for both IBM Code Engine deployments and local deployments.

>* _**Note:** this only needs to be done once per IBM Cloud Account, not per user of CRAIG._
>* _The deploy.sh script used to deploy CRAIG in IBM Code Engine can also automatically deploy the workspaces using its `-z` parameter._
>* _The `deploy.sh` script used to deploy CRAIG in IBM Code Engine can also automatically deploy the workspaces using its `-z` parameter. See our [README](../README.md#deploying-to-ibm-code-engine) for further instructions on how to run the deploy script._
## Prerequisites
- [Create an IBM Cloud API Key](https://cloud.ibm.com/docs/account?topic=account-userapikey&interface=ui#create_user_key)
- [jq](https://jqlang.github.io/jq/) v1.7 or higher


<br /> _Note: If you plan on [deploying CRAIG To IBM Code Engine](../README.md#deploying-to-ibm-code-engine), ensure you are using the same account you intend to use for CRAIG deployment in Code Engine when creating the API key and doing the PowerVS Workspace Deployment setup below._

_If runnning outside of IBM Cloud Shell:_
- [jq](https://jqlang.github.io/jq/) v1.7 or higher
- ibmcloud cli

## Automated Deployment
## Automated Power VS Workspace Deployment for Local CRAIG Installations

The `terraform.sh` script found in the `/deploy` folder of the CRAIG root directory provisions a Power VS Workspace in each zone worldwide and sets the needed environment variables with the format of `POWER_WORKSPACE_<zone>=<workspace-guid>`.

Expand All @@ -22,21 +21,79 @@ Use the following command to run the script:
sh deploy/terraform.sh -a "<Your IBM Cloud Platform API key>"
```

This will produce a file named `.env` that can be passed to the `deploy.sh` script when deploying CRAIG in Code Engine.
This will produce a file named `.env` in your local environment.

#### Bring Your Own Workspace
The `API_KEY` key and value should also be added to the `.env` file, see [.env.example](../.env.example) for more information.

If you do not want Power VS workspaces created in every zone or if you want to use custom images you can bring your own Power VS Workspace into CRAIG. The [generate-env.sh](../generate-env.sh) script can generate a `.env` environment file containing all of the workspaces in your account.

#### generate-env.sh prerequisites
- [jq](https://jqlang.github.io/jq/) v1.7 or higher
- [IBM Cloud CLI](https://cloud.ibm.com/docs/cli?topic=cli-getting-started)
## Bring your own Power VS workspace

To generate a `.env` file containing all of the workspaces in your account, you can run the following command:
### Background
You can bring your own existing Power VS workspace into CRAIG which allows you to choose custom images for Power VSIs.

The IBM Code Engine deployment script will automatically create Power VS workspaces in every Power VS zone worldwide for CRAIG's use when using the `-z` parameter.

If you do not want Power VS workspaces created in every zone, you can create the Power VS Workspaces in your chosen zone(s) using the Clould console, CLI, or other means. The [generate-env.sh](../generate-env.sh) script can generate an environment file that can be used with the `deploy.sh` script to configure CRAIG to use the workspaces.

### Bring Your Own Workspace for CRAIG Code Engine Deployment Script

#### 1. Download the generate-env.sh script within the IBM Cloud Shell
From within IBM Cloud Shell run the following two commands to download the script and make it executable:
```bash
wget https://raw.githubusercontent.com/IBM/CRAIG/main/generate-env.sh
chmod 755 generate-env.sh
```
./generate-env.sh .env
#### 2. Run generate-env.sh to generate `env` file
To generate an `env` file containing all of the workspaces in your account, you can run the following command:

```
./generate-env.sh env
```

The `env` file should then be modified to remove or comment out any workspaces that CRAIG should not use, and to ensure it contains only one workspace per zone.

#### 3. Run deploy.sh using generated `env` file
The `env` file can then be used on the `deploy.sh` script:

```
./deploy.sh -e env
```

See our [README](../README.md#deploying-to-ibm-code-engine) for further instructions on how to run the deploy script.

### Modifying the CRAIG Code Engine configmap Post-Deployment
If you want to bring your own workspace after CRAIG deployment in Code Engine you can update the configmap with the GUID of your workspace.

The `.env` file should then be modified to remove or comment out any workspaces that CRAIG should not use, and to ensure it contains only one workspace per zone. The `API_KEY` key and value should also be added to the file, see [.env.example](../.env.example) for more information.
To find the GUIDs and locations of your workspaces, the following IBM Cloud CLI command can be run in a terminal window or an IBM Cloud Shell:

```
ibmcloud resource service-instances --service-name power-iaas --output json | jq -r '.[]? | "\(.guid), \(.name), \(.region_id)"'
```

To modify the configmap to add your workspace GUID, click on `Secrets and configmaps` on left navigation pane of the Code Engine project. Click on the `craig-env` Configmap. Find the key that matches your workspace's zone and set your workspace's GUID as the value for the key. Click the `Save` button. The CRAIG instance can then be [redeployed](#redeploying-the-craig-instance) to pick up the configmap change.

If CRAIG was deployed without specifying `-z` or `-e`, a configmap can be manually created and set with the correct key-value for the zone. See the [.env.example](../.env.example) for the possible keys and the [IBM Code Engine documentation](https://cloud.ibm.com/docs/codeengine?topic=codeengine-configmap) for how to create the configmap and add the reference to the `craig` application.


### Bring Your Own Workspace for local CRAIG installations


#### Prerequisites for running generate-env.sh locally
- [jq](https://jqlang.github.io/jq/) v1.7 or higher
- ibmcloud CLI

#### 1. Navigate to your CRAIG root directory and make generate-env.sh executable

```bash
chmod 755 generate-env.sh
```
#### 2. Run generate-env.sh to generate `env` file
To generate an `env` file containing all of the workspaces in your account, you can run the following command:

```
./generate-env.sh env
```
#### 3. Modify `env` file
The `env` file should then be modified to remove or comment out any workspaces that CRAIG should not use, and to ensure it contains only one workspace per zone. The `API_KEY` key and value should also be added to the file, see [.env.example](../.env.example) for more information.

If you're using your CRAIG directory in source control, ensure you also rename the `env` file to `.env` to make it hidden and recognized by `.gitignore` to avoid uploading sensitive data to Github.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file.

## 1.15.4

### Upgrade Notes

- Updated footer for CRAIG v2 UI
- A LogDNA ingestion key is now created and output when LogDNA is enabled instead of a resource key

### Fixes

- Fixed an issue causing Power VS images from data to reference the invalid value `image_id` instead of the correct `id`
- Fixed an issue preventing Terraform from creating multiple VPEs in the same VPC

## 1.15.3

### Upgrade Notes
Expand All @@ -11,6 +23,7 @@ All notable changes to this project will be documented in this file.
### Features

- Users can integrate Security and Compliance Center with Cloud Object storage from the `/forms/sccV2` page
- Power Edge Router is now supported for `tor01` and `us-south`

### Fixes

Expand Down
4 changes: 2 additions & 2 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
@@ -1,6 +1,6 @@
{
"name": "craig",
"version": "1.15.3",
"version": "1.15.4",
"private": true,
"license": "Apache-2.0",
"scripts": {
Expand Down
77 changes: 77 additions & 0 deletions client/src/components/page-template/BottomAbout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { NewTab } from "@carbon/icons-react";
import { Link } from "@carbon/react";
import React from "react";
import "../../index.scss";
import craigNoBackground from "../../images/craigNoBackground.png";
import { CraigFormGroup } from "../forms";
import { contains } from "lazy-z";

const InternalLink = (props) => {
return (
<Link href={props.url} size="lg" style={props.style}>
{props.urlText}
</Link>
);
};

const ExternalLink = (props) => {
return (
<Link
href={props.url}
renderIcon={() => <NewTab data-modal-primary-focus />}
target="_blank"
size="lg"
style={props.style}
>
{props.urlText}
</Link>
);
};

const BottomAbout = () => {
let isV2Page =
contains(window.location.pathname, "/v2") ||
contains(window.location.search, "v2");
return (
<div className="newFooter pointerEventsAuto">
<div className="newFooterFlexRow marginBottomSmall">
<div className="newFooterFlexColumn">
<h1 className="marginBottomSmall">CRAIG</h1>
<InternalLink
url={`/docs/about${isV2Page ? "?v2" : ""}`}
urlText="About"
/>
<InternalLink
url={`/docs/releaseNotes${isV2Page ? "?v2" : ""}`}
urlText="Release Notes"
/>
<InternalLink
url={`/docs/json${isV2Page ? "?v2" : ""}`}
urlText="JSON Documentation"
/>
<InternalLink url="/docs/tutorial" urlText="Tutorial" />
</div>
<div className="newFooterFlexColumn marginTopSkipRow">
<ExternalLink url="https://github.com/IBM/CRAIG" urlText="Github" />
<ExternalLink
url="https://github.com/IBM/CRAIG/blob/main/README.md"
urlText="README"
/>
<ExternalLink
url="https://github.com/IBM/CRAIG/tree/main/.docs"
urlText="Documentation"
/>
</div>
<div className="newFooterLogoColumn">
<img src={craigNoBackground} width="190" height="190" />
</div>
</div>
<hr width="99%"></hr>
<p className="newFooterBottomText italic">
Created by the IBM Cloud Platinum Team
</p>
</div>
);
};

export default BottomAbout;
86 changes: 44 additions & 42 deletions client/src/components/page-template/LeftNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,49 +213,51 @@ class LeftNav extends React.Component {
{this.props.expanded && (
<>
{this.props.expanded && !isV2Page && (
<LeftNavItem
key="V2"
item={{
path: "/v2/projects",
icon: DrillThrough,
title: "[New] Use Craig V2",
}}
expanded={this.props.expanded}
new
/>
<>
<LeftNavItem
key="V2"
item={{
path: "/v2/projects",
icon: DrillThrough,
title: "[New] Use Craig V2",
}}
expanded={this.props.expanded}
new
/>
<LeftNavItem
item={{ path: "/docs/about", icon: Help, title: "About" }}
key="About"
expanded={this.props.expanded}
/>
<LeftNavItem
item={{
path: "/docs/releaseNotes",
icon: Bullhorn,
title: "Release Notes",
}}
key="ReleaseNotes"
expanded={this.props.expanded}
/>
<LeftNavItem
item={{
path: "/docs/json",
icon: JsonReference,
title: "JSON Documentation",
}}
key="json-docs"
expanded={this.props.expanded}
/>
<LeftNavItem
item={{
path: "/docs/tutorial",
icon: Compass,
title: "Tutorial",
}}
key="tutorial"
expanded={this.props.expanded}
/>
</>
)}
<LeftNavItem
item={{ path: "/docs/about", icon: Help, title: "About" }}
key="About"
expanded={this.props.expanded}
/>
<LeftNavItem
item={{
path: "/docs/releaseNotes",
icon: Bullhorn,
title: "Release Notes",
}}
key="ReleaseNotes"
expanded={this.props.expanded}
/>
<LeftNavItem
item={{
path: "/docs/json",
icon: JsonReference,
title: "JSON Documentation",
}}
key="json-docs"
expanded={this.props.expanded}
/>
<LeftNavItem
item={{
path: "/docs/tutorial",
icon: Compass,
title: "Tutorial",
}}
key="tutorial"
expanded={this.props.expanded}
/>
{this.props.expanded && isV2Page && (
<LeftNavItem
key="V2"
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/page-template/PageTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import {
getObjectFromArray,
isBoolean,
} from "lazy-z";
import { CraigCodeMirror, Navigation, Footer } from ".";
import { CraigCodeMirror, Navigation, Footer, BottomAbout } from ".";
import PropTypes from "prop-types";
import "./page-template.css";
import { codeMirrorGetDisplay } from "../../lib";
Expand Down Expand Up @@ -327,6 +327,7 @@ const PageTemplate = (props) => {
jsonInCodeMirror={props.jsonInCodeMirror}
/>
</div>
<BottomAbout />
{isResetState !== true && !contains(window.location.pathname, "/v2") && (
<Footer
toggleFooter={() => {
Expand Down
Loading

0 comments on commit af33fab

Please sign in to comment.