diff --git a/ui/apps/platform/src/Containers/Clusters/ClusterRegistrationSecrets/SecureClusterUsingOperator.tsx b/ui/apps/platform/src/Containers/Clusters/ClusterRegistrationSecrets/SecureClusterUsingOperator.tsx index a3be07cb0747e..92751a694f589 100644 --- a/ui/apps/platform/src/Containers/Clusters/ClusterRegistrationSecrets/SecureClusterUsingOperator.tsx +++ b/ui/apps/platform/src/Containers/Clusters/ClusterRegistrationSecrets/SecureClusterUsingOperator.tsx @@ -5,6 +5,9 @@ export type SecureClusterUsingOperatorProps = { headingLevel: 'h2' | 'h3'; }; +const ocApplyCommand = 'oc create -f .yaml -n stackrox'; +const kubectlApplyCommand = 'kubectl create -f .yaml -n stackrox'; + function SecureClusterUsingOperator({ headingLevel, }: SecureClusterUsingOperatorProps): ReactElement { @@ -13,7 +16,7 @@ function SecureClusterUsingOperator({ return (

- You can install secured cluster services on your clusters by using the{' '} + You can install secured cluster services on your clusters using the{' '} SecuredCluster custom resource.

Prerequisites @@ -21,31 +24,36 @@ function SecureClusterUsingOperator({

In the RHACS web portal, you have created a cluster registration secret and - downloaded the YAML file for the cluster registration secret. + downloaded its YAML file.

+

You have installed the RHACS Operator on the cluster you are securing.

- In the Red Hat OpenShift Container Platform web console on the cluster that - you are securing, you have installed the RHACS Operator. -

-

- For Operator installation, create a new Red Hat OpenShift Container Platform - project. rhacs-operator is a good name choice. + For Operator installation, create a new project or namespace.{' '} + rhacs-operator is a good name choice.

+

To install the RHACS Operator:

+ + + On Red Hat OpenShift Container Platform, use{' '} + Operators > OperatorHub in the web console. + + + On other platforms, apply an image pull secret and use the{' '} + rhacs-operator Helm chart. + +
-

Apply the cluster registration secret on the secured cluster.

-

- Perform one of the following tasks to apply the cluster registration - secrets: -

+

Apply the cluster registration secret on the secured cluster.

+

Apply it using one of the following methods:

- In the OpenShift Container Platform web console on the cluster that - you are securing, in the top menu, click + to open - the Import YAML page. + On an OpenShift cluster, in the OpenShift Container Platform web + console, in the top menu, click + to open the{' '} + Import YAML page.

You can drag the cluster registration secret file or copy and paste @@ -55,20 +63,22 @@ function SecureClusterUsingOperator({

- On the cluster that you are securing, using the Red Hat OpenShift - CLI, run a command similar to the following: + On an OpenShift cluster: using the oc CLI, run a + command similar to the following: +

+ {ocApplyCommand} +
+ +

+ On other clusters: using the kubectl CLI, run a + command similar to the following:

- - oc create -f cluster-registration-secret.yaml -n stackrox - + {kubectlApplyCommand}
-

- On the cluster that you are securing, install secured cluster services using - the RHACS Operator. -

+

Install secured cluster services on the cluster using the RHACS Operator.

diff --git a/ui/apps/platform/src/Containers/Clusters/InitBundles/InitBundleForm.tsx b/ui/apps/platform/src/Containers/Clusters/InitBundles/InitBundleForm.tsx index 1dbc8d771c71b..0e043b832d3b7 100644 --- a/ui/apps/platform/src/Containers/Clusters/InitBundles/InitBundleForm.tsx +++ b/ui/apps/platform/src/Containers/Clusters/InitBundles/InitBundleForm.tsx @@ -54,8 +54,16 @@ const validationSchema: yup.ObjectSchema = yup.object().sh 'Name can have only the following characters: letters, digits, period, underscore, hyphen (but no spaces)' ) .required('Bundle name is required'), - installation: yup.string().trim().required(), // Select - platform: yup.string().trim().required(), // Radio + installation: yup + .string() + .trim() + .oneOf(Object.keys(installationOptions) as InstallationKey[]) + .required(), + platform: yup + .string() + .trim() + .oneOf(Object.keys(platformOptions) as PlatformKey[]) + .required(), }); function InitBundleForm(): ReactElement { @@ -68,7 +76,6 @@ function InitBundleForm(): ReactElement { isSubmitting, isValid, setFieldValue, - setValues, submitForm, touched, values, @@ -103,12 +110,8 @@ function InitBundleForm(): ReactElement { return setFieldValue(event.target.id, value); } - function onChangePlatform(value) { - return setValues({ - installation: value === 'OpenShift' ? 'Operator' : 'Helm', - name: values.name, // redundant but function requires all values - platform: value, - }); + function onChangePlatform(value: string) { + return setFieldValue('platform', value); } function onSelectInstallation(_id: string, value: string) { @@ -171,21 +174,16 @@ function InitBundleForm(): ReactElement { id="installation" value={values.installation} handleSelect={onSelectInstallation} - isDisabled={values.platform !== 'OpenShift'} toggleAriaLabel="Installation method menu toggle" aria-label="Select an installation method" > - {Object.entries(installationOptions) - .filter( - ([installationKey]) => - values.platform === 'OpenShift' || - installationKey !== 'Operator' - ) - .map(([installationKey, installationLabel]) => ( + {Object.entries(installationOptions).map( + ([installationKey, installationLabel]) => ( {installationLabel} - ))} + ) + )} diff --git a/ui/apps/platform/src/Containers/Clusters/InitBundles/InitBundleForm.utils.ts b/ui/apps/platform/src/Containers/Clusters/InitBundles/InitBundleForm.utils.ts index d26ded813edd8..a9f9a316d3cdb 100644 --- a/ui/apps/platform/src/Containers/Clusters/InitBundles/InitBundleForm.utils.ts +++ b/ui/apps/platform/src/Containers/Clusters/InitBundles/InitBundleForm.utils.ts @@ -2,14 +2,14 @@ import FileSaver from 'file-saver'; import type { GenerateClusterInitBundleResponse } from 'services/ClustersService'; -export const installationOptions: Record = { +export const installationOptions = { Operator: 'Operator (recommended)', Helm: 'Helm chart', } as const; export type InstallationKey = keyof typeof installationOptions; -export const platformOptions: Record = { +export const platformOptions = { OpenShift: 'OpenShift', EKS: 'EKS', AKS: 'AKS', diff --git a/ui/apps/platform/src/Containers/Clusters/InitBundles/SecureClusterUsingOperator.tsx b/ui/apps/platform/src/Containers/Clusters/InitBundles/SecureClusterUsingOperator.tsx index 5af37f464c6dc..57188c3e1c450 100644 --- a/ui/apps/platform/src/Containers/Clusters/InitBundles/SecureClusterUsingOperator.tsx +++ b/ui/apps/platform/src/Containers/Clusters/InitBundles/SecureClusterUsingOperator.tsx @@ -9,6 +9,9 @@ export type SecureClusterUsingOperatorProps = { headingLevel: 'h2' | 'h3'; }; +const ocApplyCommand = 'oc create -f .yaml -n stackrox'; +const kubectlApplyCommand = 'kubectl create -f .yaml -n stackrox'; + function SecureClusterUsingOperator({ headingLevel, }: SecureClusterUsingOperatorProps): ReactElement { @@ -18,7 +21,7 @@ function SecureClusterUsingOperator({ return ( - Secure a cluster using Operator installation method + Secure a cluster using the Operator installation method {version && ( <> @@ -32,6 +35,7 @@ function SecureClusterUsingOperator({ rel="noopener noreferrer" > Generating and applying an init bundle for RHACS on Red Hat OpenShift + (OpenShift) @@ -43,42 +47,51 @@ function SecureClusterUsingOperator({ target="_blank" rel="noopener noreferrer" > - Installing RHACS on secured clusters by using the Operator + Installing RHACS on secured clusters by using the Operator (OpenShift) + {/* TODO ROX-33550: Add non-OpenShift operator documentation links when available */} )}

- You can install secured cluster services on your clusters by using the{' '} + You can install secured cluster services on your clusters using the{' '} SecuredCluster custom resource.

Prerequisites

- In the RHACS web portal, you have created an init bundle and downloaded the - YAML file for the init bundle. + In the RHACS web portal, you have created an init bundle and downloaded its + YAML file.

+

You have installed the RHACS Operator on the cluster you are securing.

- In the Red Hat OpenShift Container Platform web console on the cluster that - you are securing, you have installed the RHACS Operator. -

-

- For Operator installation, create a new Red Hat OpenShift Container Platform - project. rhacs-operator is a good name choice. + For Operator installation, create a new project or namespace.{' '} + rhacs-operator is a good name choice.

+

To install the RHACS Operator:

+ + + On Red Hat OpenShift Container Platform, use{' '} + Operators > OperatorHub in the web console. + + + On other platforms, apply an image pull secret and use the{' '} + rhacs-operator Helm chart. + +
Repeat for each secured cluster -

Apply the init bundle on the secured cluster.

+

Apply the init bundle on the secured cluster.

Applying the init bundle creates the secrets and resources that the secured - cluster needs to communicate with RHACS. Perform one of the following tasks - to apply the init bundle: + cluster needs to communicate with RHACS. Apply it using one of the following + methods:

{version && ( @@ -97,9 +110,9 @@ function SecureClusterUsingOperator({

- In the OpenShift Container Platform web console on the cluster that - you are securing, in the top menu, click + to open - the Import YAML page. + On an OpenShift cluster, in the OpenShift Container Platform web + console, in the top menu, click + to open the{' '} + Import YAML page.

You can drag the init bundle file or copy and paste its contents @@ -108,21 +121,22 @@ function SecureClusterUsingOperator({

- On the cluster that you are securing, using the Red Hat OpenShift - CLI, run a command similar to the following: + On an OpenShift cluster: using the oc CLI, run a + command similar to the following:

- - oc create -f name-Operator-secrets-cluster-init-bundle.yaml -n - stackrox - + {ocApplyCommand} +
+ +

+ On other clusters: using the kubectl CLI, run a + command similar to the following: +

+ {kubectlApplyCommand}
-

- On the cluster that you are securing, install secured cluster services using - the RHACS Operator. -

+

Install secured cluster services on the cluster using the RHACS Operator.