Installing the {cli-manager}
You can simplify the installation and management of CLI plugins in connected and disconnected environments with the CLI Manager Operator. The CLI Manager Operator makes Krew compatible with the oc CLI, allowing cluster administrators to manage custom CLI plugin resources.
Important
Using the CLI Manager Operator to install and manage plugins for the OpenShift CLI is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
Installing the CLI Manager Operator
You can install the CLI Manager Operator to facilitate adding CLI plugins in both connected and disconnected environments.
Note
Krew always works with OpenShift CLI (oc) without the CLI Manager Operator installed. You can use the same commands outlined in this documentation to use Krew with oc. For more information, see Krew documentation.
-
You are logged in to OpenShift Container Platform as a user with the
cluster-adminrole. -
You have access to the OpenShift Container Platform web console.
-
Log in to the OpenShift Container Platform web console.
-
Create the required namespace for the CLI Manager Operator:
-
Navigate to Administration → Namespaces and click Create Namespace.
-
In the Name field, enter
openshift-cli-manager-operatorand click Create.
-
-
Install the CLI Manager Operator:
-
Navigate to Ecosystem → Software Catalog.
-
In the filter box, enter CLI Manager Operator.
-
Select the CLI Manager Operator and click Install.
-
On the Install Operator page, complete the following steps:
-
Ensure that the Update channel is set to tech preview, which installs the latest Technology Preview release of the CLI Manager Operator.
-
From the drop-down menu, select A specific namespace on the cluster and select openshift-cli-manager-operator.
-
Click Install.
-
-
-
Create the
CliManagerresource by completing the following steps:-
Navigate to Installed Operators.
-
Select CLI Manager Operator.
-
Select the CLI Manager tab.
-
Click Create CliManager.
-
Use the default Name.
-
Click Create.
-
The new
CliManagerresource is listed in the CLI Manager tab.
-
-
-
Navigate to Ecosystem → Installed Operators.
-
Verify that CLI Manager Operator is listed with a Status of Succeeded.
Adding the CLI Manager Operator custom index to Krew
You can use the terminal to add the CLI Manager Operator custom index to Krew so that the CLI Manager Operator will work in disconnected environments. This procedure is required for the CLI Manager Operator to function correctly and needs to be done only once.
Note
If you use self-signed certificates, mark the certificate as trusted on your local operating system to use Krew.
-
The CLI Manager Operator is installed.
-
To establish the
ROUTEvariable, enter the following command:$ ROUTE=$(oc get route/openshift-cli-manager -n openshift-cli-manager-operator -o=jsonpath='{.spec.host}') -
To add the custom index to Krew, enter the following command:
$ oc krew index add <custom_index_name> https://$ROUTE/cli-manager -
To update Krew, enter the following command and check for any errors:
$ oc krew updateExample outputUpdated the local copy of plugin index. Updated the local copy of plugin index <custom_index_name>. New plugins available: * ocp/<plugin_name>
Adding a plugin to the CLI Manager Operator
You can add a CLI plugin to the CLI Manager Operator by creating a new plugin resource in the OpenShift Container Platform web console’s YAML view.
-
You are logged in to OpenShift Container Platform as a user with the
cluster-adminrole. -
The CLI Manager Operator is installed.
-
Log in to the OpenShift Container Platform web console.
-
Navigate to Ecosystem → Installed Operators.
-
From the list, select CLI Manager Operator.
-
Select the CLI Plugin tab.
-
Click Create Plugin.
-
In the text box, enter the information for the plugin you are installing. See the following example YAML file.
Example YAML file to add a pluginapiVersion: config.openshift.io/v1alpha1 kind: Plugin metadata: name: <plugin_name> spec: description: <description_of_plugin> homepage: <plugin_homepage> platforms: - bin: files: - from: <plugin_file_path> to: . image: <plugin_image> imagePullSecret: platform: <platform> shortDescription: <short_description_of_plugin> version: <version>where:
<plugin_name>-
Specifies the name of the plugin you plan to use in commands.
bin-
Specifies the path to the plugin executable.
imagePullSecret-
Optional field if the registry is not public to add a pull secret to access your plugin image.
<platform>-
Add the architecture for your system; for example,
linux/amd64,darwin/arm64,windows/amd64, or another architecture. <version>-
The version must be in v0.0.0 format.
-
Click Save.
-
Enter the following command to see if the plugin is listed and has been added successfully:
$ oc get plugin/<plugin_name> -o yaml
-
Example output:
<plugin_name> ready to be served.