Skip to content

Commit 1deacfc

Browse files
committed
Add OLM Plugin for Day-2 Operator Management
Signed-off-by: chiragkyal <[email protected]>
1 parent f3d87dc commit 1deacfc

File tree

8 files changed

+1379
-1
lines changed

8 files changed

+1379
-1
lines changed

.claude-plugin/marketplace.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
"name": "must-gather",
6464
"source": "./plugins/must-gather",
6565
"description": "A plugin to analyze and report on must-gather data"
66+
},
67+
{
68+
"name": "olm",
69+
"source": "./plugins/olm",
70+
"description": "A plugin for managing day-2 operators using Operator Lifecycle Manager"
6671
}
6772
]
68-
}
73+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "olm",
3+
"description": "A plugin for managing day-2 operators using Operator Lifecycle Manager",
4+
"version": "0.0.1",
5+
"author": {
6+
"name": "chiragkyal"
7+
}
8+
}

plugins/olm/README.md

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# OLM Plugin
2+
3+
A plugin for managing day-2 operators in OpenShift clusters using Operator Lifecycle Manager (OLM).
4+
5+
## Features
6+
7+
- Search and discover operators across all catalog sources
8+
- Install operators and verification
9+
- List installed operators with health status
10+
- Check detailed operator health and troubleshoot issues
11+
- Safely uninstall operators with optional CRD and namespace cleanup
12+
- Automatic channel discovery and smart defaults
13+
- Context-aware troubleshooting recommendations
14+
15+
## Prerequisites
16+
17+
- Claude Code installed
18+
- OpenShift CLI (`oc`) installed and configured
19+
- Access to an OpenShift cluster with cluster-admin or sufficient RBAC permissions
20+
21+
22+
## Commands
23+
24+
### `/olm:search` - Search for Operators
25+
26+
Search for available operators in OperatorHub catalogs.
27+
28+
**Usage:**
29+
```bash
30+
/olm:search cert-manager # Search by keyword
31+
/olm:search # List all operators
32+
/olm:search prometheus --catalog community-operators # Search specific catalog
33+
/olm:search external-secrets-operator --exact # Exact name match
34+
```
35+
36+
**Arguments:**
37+
- `query` (optional): Search term for filtering operators
38+
- `--catalog <name>` (optional): Limit search to specific catalog
39+
- `--exact` (optional): Only show exact name matches
40+
41+
See [commands/search.md](commands/search.md) for full documentation.
42+
43+
---
44+
45+
### `/olm:install` - Install Operators
46+
47+
Install operators from OperatorHub.
48+
49+
**Usage:**
50+
```bash
51+
/olm:install openshift-cert-manager-operator # Basic install
52+
/olm:install openshift-cert-manager-operator my-namespace # Custom namespace
53+
/olm:install openshift-cert-manager-operator ns stable-v1 # Specific channel
54+
/olm:install prometheus community-operators stable community-operators # Different catalog
55+
```
56+
57+
**What it does:**
58+
- Creates namespace and OperatorGroup
59+
- Creates Subscription with auto-discovered or specified channel
60+
- Monitors installation progress and verifies CSV status
61+
- Reports deployment and pod status
62+
63+
**Arguments:**
64+
- `operator-name` (required): Name of the operator
65+
- `namespace` (optional): Target namespace (defaults to operator name)
66+
- `channel` (optional): Subscription channel (auto-discovered if not provided)
67+
- `source` (optional): CatalogSource name (defaults to "redhat-operators")
68+
69+
See [commands/install.md](commands/install.md) for full documentation.
70+
71+
---
72+
73+
### `/olm:list` - List Installed Operators
74+
75+
View all operators installed in the cluster.
76+
77+
**Usage:**
78+
```bash
79+
/olm:list # List all operators
80+
/olm:list cert-manager-operator # List in specific namespace
81+
/olm:list --all-namespaces # Explicit cluster-wide view
82+
```
83+
84+
**What it does:**
85+
- Shows operator status, versions, and channels
86+
- Identifies operators requiring attention (failed, installing, etc.)
87+
- Provides summary statistics
88+
- Suggests troubleshooting commands for problematic operators
89+
90+
**Arguments:**
91+
- `namespace` (optional): Target namespace
92+
- `--all-namespaces` or `-A` (optional): List cluster-wide
93+
94+
See [commands/list.md](commands/list.md) for full documentation.
95+
96+
---
97+
98+
### `/olm:status` - Check Operator Status
99+
100+
Get detailed health and status information for a specific operator.
101+
102+
**Usage:**
103+
```bash
104+
/olm:status openshift-cert-manager-operator # Auto-discover namespace
105+
/olm:status external-secrets-operator my-namespace # Specific namespace
106+
```
107+
108+
**What it does:**
109+
- Shows CSV, Subscription, and InstallPlan status
110+
- Lists deployments and pods with health information
111+
- Displays recent events and warnings
112+
- Provides context-aware troubleshooting recommendations
113+
- Checks for available updates
114+
115+
**Arguments:**
116+
- `operator-name` (required): Name of the operator
117+
- `namespace` (optional): Namespace (auto-discovered if not provided)
118+
119+
See [commands/status.md](commands/status.md) for full documentation.
120+
121+
---
122+
123+
### `/olm:uninstall` - Uninstall Operators
124+
125+
Safely uninstall operators with optional resource cleanup.
126+
127+
**Usage:**
128+
```bash
129+
/olm:uninstall openshift-cert-manager-operator # Basic uninstall
130+
/olm:uninstall operator-name my-namespace # Custom namespace
131+
/olm:uninstall operator-name namespace --remove-crds # Include CRDs
132+
/olm:uninstall operator-name namespace --remove-crds --remove-namespace # Full cleanup
133+
/olm:uninstall operator-name namespace --force # Skip confirmations
134+
```
135+
136+
**What it does:**
137+
- Removes Subscription and CSV
138+
- Removes operator deployments
139+
- Optionally removes CRDs (with confirmation - **cluster-wide impact**)
140+
- Optionally removes namespace (with confirmation)
141+
- Provides detailed uninstallation summary
142+
143+
**Arguments:**
144+
- `operator-name` (required): Name of the operator
145+
- `namespace` (optional): Target namespace (defaults to operator name)
146+
- `--remove-crds` (optional): Remove CRDs - **CAUTION: affects entire cluster**
147+
- `--remove-namespace` (optional): Remove namespace
148+
- `--force` (optional): Skip confirmation prompts
149+
150+
See [commands/uninstall.md](commands/uninstall.md) for full documentation.
151+
152+
---
153+
154+
## Example Workflows
155+
156+
**Discover and install:**
157+
```bash
158+
/olm:search cert-manager
159+
/olm:install openshift-cert-manager-operator
160+
/olm:status openshift-cert-manager-operator
161+
/olm:uninstall openshift-cert-manager-operator
162+
```
163+
164+
**Monitor operators:**
165+
```bash
166+
/olm:list
167+
/olm:status external-secrets-operator
168+
```
169+
170+
## Troubleshooting
171+
172+
### Operator not found
173+
```bash
174+
/olm:search <operator-name> # Search for operator
175+
oc get packagemanifests -n openshift-marketplace # List manually
176+
```
177+
178+
### Installation issues
179+
```bash
180+
/olm:status <operator-name> # Check detailed status
181+
oc get csv -n <namespace> # Check CSV manually
182+
oc describe csv <csv-name> -n <namespace> # Detailed CSV info
183+
```
184+
185+
### Uninstallation issues
186+
```bash
187+
# CSV won't delete
188+
oc get csv <csv-name> -n <namespace> -o yaml | grep finalizers
189+
190+
# Namespace stuck in Terminating
191+
oc api-resources --verbs=list --namespaced -o name | \
192+
xargs -n 1 oc get --show-kind --ignore-not-found -n <namespace>
193+
```

0 commit comments

Comments
 (0)