From olm
Diagnoses and optionally fixes common OLM and operator issues including orphaned CRDs, stuck namespaces, failed installations, and catalog source problems.
How this command is triggered — by the user, by Claude, or both
Slash command
/olm:diagnose [operator-name] [namespace] [--fix] [--cluster]The summary Claude sees in its command listing — used to decide when to auto-load this command
## Name olm:diagnose ## Synopsis ## Description The `olm:diagnose` command diagnoses common OLM and operator issues, including orphaned CRDs, stuck namespaces, failed installations, and catalog source problems. It can optionally attempt to fix detected issues automatically. This command helps you: - Detect and clean up orphaned CRDs from deleted operators - Fix namespaces stuck in Terminating state - Identify and resolve failed operator installations - Detect conflicting OperatorGroups - Check catalog source health - Identify resources preventing clean uninstallation - Generate comprehe...
olm:diagnose
/olm:diagnose [operator-name] [namespace] [--fix] [--cluster]
The olm:diagnose command diagnoses common OLM and operator issues, including orphaned CRDs, stuck namespaces, failed installations, and catalog source problems. It can optionally attempt to fix detected issues automatically.
This command helps you:
The command performs the following steps:
Parse Arguments:
$1: Operator name (optional) - Specific operator to diagnose$2: Namespace (optional) - Specific namespace to check$3+: Flags (optional):
--fix: Automatically attempt to fix detected issues (requires confirmation)--cluster: Run cluster-wide diagnostics (catalog sources, global CRDs, etc.)Prerequisites Check:
oc CLI is installed: which ococ whoami--fix flag (dry-run mode)Determine Scope:
--cluster flag or no arguments, check entire clusterScan for Orphaned CRDs:
oc get crd -o json
# Find CRDs without active operators
# This is a simplified check - actual implementation should verify operator ownership
oc get crd -o json | jq -r '.items[] |
select(.metadata.annotations["operators.coreos.com/owner"] // "" | length == 0) |
.metadata.name'
oc get <crd-kind> --all-namespaces --ignore-not-found
⚠️ Orphaned CRDs Detected
The following CRDs have no active operator:
- certificates.cert-manager.io (3 CR instances in 2 namespaces)
- issuers.cert-manager.io (5 CR instances in 3 namespaces)
These CRDs may be leftovers from uninstalled operators.
[If --fix flag:]
Do you want to delete these CRDs and their CRs? (yes/no)
WARNING: This will delete all custom resources of these types!
Check for Stuck Namespaces:
oc get namespaces -o json | jq -r '.items[] | select(.status.phase=="Terminating") | .metadata.name'
oc api-resources --verbs=list --namespaced -o name | \
xargs -n 1 oc get --show-kind --ignore-not-found -n {namespace}
oc get namespace {namespace} -o jsonpath='{.metadata.finalizers}'
❌ Stuck Namespace Detected
Namespace: {namespace}
State: Terminating (stuck for {duration})
Blocking resources:
- CustomResourceDefinition: {crd-name} (finalizer: {finalizer})
- ServiceAccount: {sa-name} (token secret)
Finalizers on namespace:
- kubernetes
[If --fix flag:]
Attempted fixes:
1. Delete remaining resources
2. Remove finalizers from CRs
3. Patch namespace to remove finalizers (CAUTION)
WARNING: Force-deleting namespace can cause cluster instability.
Scan for Failed Operator Installations:
oc get csv --all-namespaces -o json | \
jq -r '.items[] | select(.status.phase != "Succeeded") | "\(.metadata.namespace)/\(.metadata.name): \(.status.phase)"'
.status.reason.status.message❌ Failed Operator Installation
Operator: {operator-name}
Namespace: {namespace}
CSV: {csv-name}
Phase: Failed
Reason: {reason}
Message: {message}
Related InstallPlan: {installplan-name} (Phase: {phase})
Recent Events:
- {timestamp} Warning: {event-message}
Troubleshooting suggestions:
- Check operator logs: oc logs -n {namespace} deployment/{deployment}
- Check image pull issues: oc describe pod -n {namespace}
- Verify catalog source health
- Check RBAC permissions
Check for Conflicting OperatorGroups:
oc get operatorgroup --all-namespaces -o json
oc get operatorgroup --all-namespaces -o json | \
jq -r '.items | group_by(.metadata.namespace) | .[] | select(length > 1) | .[0].metadata.namespace'
⚠️ Conflicting OperatorGroups Detected
Namespace: {namespace}
OperatorGroups: {count}
- {og-1} (targets: {target-namespaces-1})
- {og-2} (targets: {target-namespaces-2})
Multiple OperatorGroups in a namespace can cause conflicts.
Only one OperatorGroup should exist per namespace.
[If --fix flag:]
Keep which OperatorGroup? (1/2)
Verify Catalog Source Health (if --cluster flag):
oc get catalogsource -n openshift-marketplace -o json
.status.connectionState.lastObservedState🔍 Catalog Source Health Check
✓ redhat-operators: READY (last updated: 2h ago)
✓ certified-operators: READY (last updated: 3h ago)
✓ community-operators: READY (last updated: 1h ago)
❌ custom-catalog: CONNECTION_FAILED (pod: CrashLoopBackOff)
[If issues found:]
Unhealthy Catalog: custom-catalog
Pod: custom-catalog-abc123 (Status: CrashLoopBackOff)
To troubleshoot:
oc logs -n openshift-marketplace custom-catalog-abc123
oc describe catalogsource custom-catalog -n openshift-marketplace
Check for Subscription/CSV Mismatches:
oc get subscription --all-namespaces -o json
installedCSV with currentCSV⚠️ Subscription/CSV Mismatch
Operator: {operator-name}
Namespace: {namespace}
Installed CSV: {installed-csv}
Current CSV: {current-csv}
CSV {installed-csv} not found in namespace.
This may indicate a failed installation or upgrade.
Suggested fix:
oc delete subscription {operator-name} -n {namespace}
/olm:install {operator-name} {namespace}
Check for Pending Manual Approvals:
oc get installplan --all-namespaces -o json | \
jq -r '.items[] | select(.spec.approved==false)'
ℹ️ Pending Manual Approvals
The following operators have pending InstallPlans requiring approval:
- Operator: openshift-cert-manager-operator
Namespace: cert-manager-operator
InstallPlan: install-abc123
Target Version: v1.14.0
To approve: /olm:approve openshift-cert-manager-operator cert-manager-operator
- Operator: external-secrets-operator
Namespace: eso-operator
InstallPlan: install-def456
Target Version: v0.11.0
To approve: /olm:approve external-secrets-operator eso-operator
Generate Comprehensive Report:
═══════════════════════════════════════════════════════════
OLM HEALTH CHECK REPORT
═══════════════════════════════════════════════════════════
Scan Scope: [Operator-specific | Namespace | Cluster-wide]
Scan Time: {timestamp}
✓ HEALTHY CHECKS: {count}
- Catalog sources operational
- No conflicting OperatorGroups
- All CSVs in Succeeded phase
⚠️ WARNINGS: {count}
- {warning-count} orphaned CRDs detected
- {warning-count} pending manual approvals
❌ ERRORS: {count}
- {error-count} stuck namespaces
- {error-count} failed operator installations
- {error-count} unhealthy catalog sources
═══════════════════════════════════════════════════════════
DETAILED FINDINGS
═══════════════════════════════════════════════════════════
[Details for each finding...]
═══════════════════════════════════════════════════════════
RECOMMENDATIONS
═══════════════════════════════════════════════════════════
1. Clean up orphaned CRDs: /olm:diagnose --fix
2. Fix stuck namespace: /olm:diagnose {namespace} --fix
3. Approve pending upgrades: /olm:approve {operator-name}
For more details on troubleshooting, see:
https://docs.redhat.com/en/documentation/openshift_container_platform/4.20/html/operators/administrator-tasks#olm-troubleshooting-operator-issues
Auto-Fix Issues (if --fix flag):
--fix flag used)Check specific operator:
/olm:diagnose openshift-cert-manager-operator
Cluster-wide health check:
/olm:diagnose --cluster
Diagnose and fix issues:
/olm:diagnose openshift-cert-manager-operator cert-manager-operator --fix
Full cluster scan with auto-fix:
/olm:diagnose --cluster --fix
--cluster)--fix: Attempt to automatically fix detected issues
--cluster: Run cluster-wide diagnostics
Permission denied:
# Check required permissions
oc auth can-i get crd
oc auth can-i get csv --all-namespaces
oc auth can-i patch namespace
Unable to fix stuck namespace:
oc get apiservice
CRDs won't delete:
# Check for remaining CRs
oc get <crd-kind> --all-namespaces
# Check for finalizers
oc get crd <crd-name> -o jsonpath='{.metadata.finalizers}'
Catalog source issues persist:
# Restart catalog pod
oc delete pod -n openshift-marketplace <catalog-pod>
# Check catalog source definition
oc get catalogsource <catalog-name> -n openshift-marketplace -o yaml
/olm:status <operator-name> - Check specific operator status/olm:list - List all operators/olm:uninstall <operator-name> - Clean uninstall with orphan cleanup/olm:approve <operator-name> - Approve pending InstallPlansnpx claudepluginhub bradmwilliams/ai-helpers --plugin olm/k8s-healthRuns comprehensive Kubernetes cluster health diagnostics with dynamic operator discovery, producing scored reports in summary, detailed, or JSON format.
/checklistRuns quality and safety checklist for Kubernetes operators, evaluating CRDs, webhooks, RBAC, tests, dev loops, and troubleshooting. Reports PASS/FAIL/N/A per item with summary and action items.
/openshiftDiagnoses and resolves OpenShift cluster issues across SCC, Routes, GitOps, and upgrades. Also supports a debug mode for general troubleshooting.
/cluster-node-health-checkDiagnoses Kubernetes/OpenShift cluster node health by validating kubelet, CRI-O, system resources, and node conditions, producing a color-coded summary report with optional JSON output.
/diagnoseDiagnoses and resolves ADVPL/TLPP errors, including compilation, runtime, and performance issues. Also parses log files for error patterns.
/diagnoseTraces a failed or stalled pipeline run by reconstructing FORGE annotation chains, identifying the failure point, and suggesting specific remediation steps. Accepts an issue number and optional --repo prefix.