Open Cluster Management plugin for Backstage
The Open Cluster Management plugin for Backstage
Abstract
Chapter 1. Open Cluster Management plugin for Backstage Copy linkLink copied to clipboard!
The Open Cluster Management (OCM) plugin integrates your Backstage instance with the MultiClusterHub
and MultiCluster
engines of OCM.
1.1. Capabilities Copy linkLink copied to clipboard!
The OCM plugin has the following capabilities:
All clusters represented as
ManagedCluster
inMultiClusterHub
or MCE are discovered and imported into the Backstage catalog, such as:-
Entity is defined as
kind: Resource
withspec.type
set tokubernetes-cluster
. -
Links to the OpenShift Container Platform (OCP) console, OCM console, and OpenShift Cluster Manager are provided in
metadata.links
.
-
Entity is defined as
Shows real-time data from OCM on the Resource entity page, including:
- Cluster current status (up or down)
- Cluster nodes status (up or down)
- Cluster details (console link, OCP, and Kubernetes version)
- Details about available compute resources on the cluster
1.2. For administrators Copy linkLink copied to clipboard!
1.2.1. Installation Copy linkLink copied to clipboard!
The OCM plugin is composed of two packages, including:
-
@redhat/backstage-plugin-ocm-backend
package connects the Backstage server to OCM. For setup process, see Section 1.2.1.2, “Setting up the OCM backend package” section. -
The
@redhat/backstage-plugin-ocm
package, which contains frontend components requires the\*-backend
package to be present and properly set up. For detailed instructions on setting up the backend, refer to the Section 1.2.1.3, “Setting up the OCM frontend package” section.
If you are interested in Resource discovery and do not want any of the front-end components, then you can install and configure the @redhat/backstage-plugin-ocm-backend
package only.
1.2.1.1. Prerequisites Copy linkLink copied to clipboard!
- OCM is deployed and configured on a Kubernetes cluster.
- Kubernetes plugin for Backstage is installed.
A
ClusterRole
is granted toServiceAccount
accessing the hub cluster as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.2.1.2. Setting up the OCM backend package Copy linkLink copied to clipboard!
Install the OCM backend plugin using the following command:
yarn workspace backend add @redhat/backstage-plugin-ocm-backend
yarn workspace backend add @redhat/backstage-plugin-ocm-backend
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the OCM backend plugin using one of the following configurations:
The OCM configuration provides the information about your hub. To use the OCM configuration, add the following code to your
app-config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the Backstage Kubernetes plugin is installed and configured to connect to the hub cluster, then you can bind the both hub and Kubernetes configuration by providing the name of the hub in the
app-config.yaml
as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure that the Backstage uses a
ServiceAccount
token and the required permissions are granted as mentioned previously.This is useful when you already use a Kubernetes plugin in your Backstage instance. Also, the hub cluster must be connected using the
ServiceAccount
.For more information about the configuration, see Backstage Kubernetes plugin documentation.
Create a new plugin instance in
packages/backend/src/plugins/ocm.ts
file as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Import and plug the new instance into
packages/backend/src/index.ts
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Import the cluster
Resource
entity provider into thecatalog
plugin in thepackages/backend/src/plugins/catalog.ts
file. The scheduler also needs to be configured. Two configurations are possible here:Configure the scheduler inside the
app-config.yaml
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow and then use the configured scheduler
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add a schedule directly inside the
packages/backend/src/plugins/catalog.ts
fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Optional: Configure the default owner for the cluster entities in the catalog for a specific environment. For example, use the following code to set
foo
as the owner for clusters fromenv
in theapp-config.yaml
catalog section:Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information about the default owner configuration, see upstream string references documentation.
1.2.1.3. Setting up the OCM frontend package Copy linkLink copied to clipboard!
Install the OCM frontend plugin using the following command:
yarn workspace app add @redhat/backstage-plugin-ocm
yarn workspace app add @redhat/backstage-plugin-ocm
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Select the components that you want to use, such as:
OcmPage
: This is a standalone page or dashboard displaying all clusters as tiles. You can addOcmPage
topackages/app/src/App.tsx
file as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can also update navigation in
packages/app/src/components/Root/Root.tsx
as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow ClusterContextProvider
: This component is a React context provided for OCM data, which is related to the current entity. TheClusterContextProvider
component is used to display any data on the React components mentioned inpackages/app/src/components/catalog/EntityPage.tsx
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the previous codeblock, you can place the context provider into your
Resource
entity renderer, which is usually available inpackages/app/src/components/catalog/EntityPage.tsx
or in an imported component.-
<ClusterInfoCard />
: This is an entity component displaying details of a cluster in a table: -
<ClusterAvailableResourceCard />
: This is an entity component displaying the available resources on a cluster. For example, see.status.capacity
of theManagedCluster
resource.
-
1.3. For users Copy linkLink copied to clipboard!
1.3.1. Using the OCM plugin in Backstage Copy linkLink copied to clipboard!
The OCM plugin integrates your Backstage instance with multi-cluster engines and displays real-time data from OCM.
1.3.1.1. Prerequisites Copy linkLink copied to clipboard!
- Your Backstage application is installed and running.
- You have installed the OCM plugin. For the installation process, see Section 1.2.1, “Installation”.
1.3.1.2. Procedure Copy linkLink copied to clipboard!
- Open your Backstage application.
Click the Clusters tab from the left-side panel to view the Managed Clusters page.
The Managed Clusters page displays the list of clusters with additional information, such as status, infrastructure provider, associated OpenShift version, and available nodes.
You can also upgrade the OpenShift version for a cluster using the Upgrade available option in the VERSION column.
Select a cluster from the Managed Clusters to view the related cluster information.
You are redirected to the cluster-specific page, which consists of:
- Cluster Information, such as name, status, accessed Kubernetes version, associated OpenShift ID and version, and accessed platform.
- Available cluster capacity, including CPU cores, memory size, and number of pods.
- Related Links, which enable you to access different consoles directly, such as OpenShift Console, OCM Console, and OpenShift Cluster Manager Console.
- Relations card, which displays the visual representation of the cluster and associated dependencies.
Chapter 2. Open Cluster Management plugin for Backstage Copy linkLink copied to clipboard!
The Open Cluster Management (OCM) plugin integrates your Backstage instance with OCM.
For more information about OCM plugin, see the Open Cluster Management plugin documentation on GitHub.
Chapter 3. Open Cluster Management plugin for Backstage Copy linkLink copied to clipboard!
The Open Cluster Management (OCM) plugin integrates your Backstage instance with OCM.
For more information about OCM plugin, see the Open Cluster Management plugin documentation on GitHub.