6.4 KiB
6.4 KiB
description: List installed operators in the cluster
argument-hint: [namespace] [--all-namespaces]
Name
olm:list
Synopsis
/olm:list [namespace] [--all-namespaces]
Description
The olm:list command lists all installed operators in an OpenShift cluster, showing their status, version, and namespace. This command provides a quick overview of the operator landscape in your cluster.
This command helps you:
- Discover what operators are currently installed
- Check operator versions and status at a glance
- Identify operators that may need attention (failed, upgrading, etc.)
- Get a comprehensive view across namespaces
The command presents information in an easy-to-read table format with key details about each operator's ClusterServiceVersion (CSV) and Subscription.
Implementation
The command performs the following steps:
-
Parse Arguments:
$1: Namespace (optional) - Target namespace to list operators from$2: Flag (optional):--all-namespacesor-A: List operators across all namespaces (default behavior if no namespace specified)
-
Prerequisites Check:
- Verify
ocCLI is installed:which oc - Verify cluster access:
oc whoami - If not installed or not authenticated, provide clear instructions
- Verify
-
Determine Scope:
- If namespace is specified: List operators only in that namespace
- If
--all-namespacesflag or no arguments: List operators cluster-wide - Default behavior: Show all operators across all namespaces
-
Fetch Operator Data:
- Get all ClusterServiceVersions (CSVs):
# For specific namespace oc get csv -n {namespace} -o json # For all namespaces oc get csv --all-namespaces -o json - Get all Subscriptions:
# For specific namespace oc get subscription -n {namespace} -o json # For all namespaces oc get subscription --all-namespaces -o json
- Get all ClusterServiceVersions (CSVs):
-
Parse and Correlate Data:
- For each CSV, extract:
- Name:
.metadata.name - Namespace:
.metadata.namespace - Display Name:
.spec.displayName - Version:
.spec.version - Phase/Status:
.status.phase(e.g., "Succeeded", "Installing", "Failed") - Install Time:
.metadata.creationTimestamp
- Name:
- For each Subscription, extract:
- Operator Name:
.spec.name - Channel:
.spec.channel - Source:
.spec.source - Installed CSV:
.status.installedCSV - Current CSV:
.status.currentCSV
- Operator Name:
- Correlate Subscriptions with CSVs to show complete operator information
- For each CSV, extract:
-
Format Output as Table: Create a formatted table with columns:
NAMESPACE OPERATOR NAME VERSION STATUS CHANNEL SOURCE cert-manager-operator cert-manager-operator v1.13.1 Succeeded stable-v1 redhat-operators external-secrets-operator external-secrets-operator v0.10.5 Succeeded stable-v0.10 redhat-operators openshift-pipelines openshift-pipelines-operator-rh v1.14.4 Succeeded latest redhat-operators -
Add Summary Statistics:
- Total operators installed: X
- By status:
- Succeeded: X
- Installing: X
- Upgrading: X
- Failed: X
- By catalog source:
- redhat-operators: X
- certified-operators: X
- community-operators: X
- custom catalogs: X
-
Highlight Issues (if any):
- List operators with status other than "Succeeded":
⚠️ Operators requiring attention: - namespace/operator-name: Failed (reason: ...) - namespace/operator-name: Installing (waiting for...)
- List operators with status other than "Succeeded":
-
Provide Actionable Suggestions:
- If operators are in "Failed" state, suggest:
/olm:status {operator-name} {namespace}for details - If no operators found, suggest:
/olm:search {operator-name}to find available operators - If upgrades available, suggest:
/olm:status {operator-name}to check upgrade options
- If operators are in "Failed" state, suggest:
Return Value
- Success: Formatted table of installed operators with summary statistics
- Empty: No operators found message with suggestion to install operators
- Error: Connection or permission error with troubleshooting guidance
- Format:
- Table with columns: NAMESPACE, OPERATOR NAME, VERSION, STATUS, CHANNEL, SOURCE
- Summary statistics
- Warnings for operators requiring attention
Examples
-
List all operators cluster-wide:
/olm:list -
List operators in a specific namespace:
/olm:list cert-manager-operator ``
Arguments
- $1 (namespace): Target namespace to list operators from (optional)
- If not provided, lists operators from all namespaces
- Example: "cert-manager-operator"
- $2 (flag): Optional flag (optional)
--all-namespacesor-A: Explicitly list all operators cluster-wide- Default behavior if no namespace is provided
Notes
- Performance: For large clusters with many operators, the command may take a few seconds to collect all data
- Status Values: Common CSV status values include:
Succeeded: Operator is healthy and runningInstalling: Operator is being installedUpgrading: Operator is being upgradedFailed: Operator installation or operation failedReplacing: Old version being replacedDeleting: Operator is being removed
- Correlation: The command correlates Subscriptions with CSVs to provide complete operator information
- Sorting: Results are sorted by namespace, then by operator name
Troubleshooting
- Permission denied: Ensure you have permissions to list CSVs and Subscriptions:
oc auth can-i list csv --all-namespaces oc auth can-i list subscription --all-namespaces - Slow response: For large clusters, use namespace-specific queries to speed up results
- Missing operators: Some operators may not have Subscriptions if installed manually; these will still appear based on CSV presence
- Version mismatch: If Subscription's
installedCSVdiffers fromcurrentCSV, an upgrade may be in progress
Related Commands
/olm:status <operator-name> [namespace]- Get detailed status of a specific operator/olm:install <operator-name>- Install a new operator/olm:search <query>- Search for available operators in catalogs