Skip to content

Commit dcfd27e

Browse files
committed
Add skill to launch CAMGI for must-gather
split the camgi part out of #133 to make it easier to review and more readable
1 parent 46d8bcc commit dcfd27e

File tree

6 files changed

+691
-0
lines changed

6 files changed

+691
-0
lines changed

PLUGINS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ A plugin to analyze and report on must-gather data
155155

156156
**Commands:**
157157
- **`/must-gather:analyze` `[must-gather-path] [component]`** - Quick analysis of must-gather data - runs all analysis scripts and provides comprehensive cluster diagnostics
158+
- **`/must-gather:camgi` `[must-gather-path|stop]`** - Launch CAMGI (Cluster Autoscaler Must-Gather Inspector) web interface to analyze cluster infrastructure and autoscaler behavior
158159
- **`/must-gather:ovn-dbs` `[must-gather-path]`** - Analyze OVN databases from a must-gather using ovsdb-tool
159160

160161
See [plugins/must-gather/README.md](plugins/must-gather/README.md) for detailed documentation.

docs/data.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,12 @@
685685
"name": "analyze",
686686
"synopsis": "/must-gather:analyze [must-gather-path] [component]"
687687
},
688+
{
689+
"argument_hint": "[must-gather-path|stop]",
690+
"description": "Launch CAMGI (Cluster Autoscaler Must-Gather Inspector) web interface to analyze cluster infrastructure and autoscaler behavior",
691+
"name": "camgi",
692+
"synopsis": "/must-gather:camgi [must-gather-path]"
693+
},
688694
{
689695
"argument_hint": "[must-gather-path]",
690696
"description": "Analyze OVN databases from a must-gather using ovsdb-tool",
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# OKD-CAMGI Integration
2+
3+
Integration of [okd-camgi](https://github.com/elmiko/okd-camgi) (Cluster Autoscaler Must-Gather Inspector) for analyzing must-gather data.
4+
5+
## What is CAMGI?
6+
7+
CAMGI is a web-based tool for examining must-gather records to investigate cluster infrastructure and autoscaler behavior in OKD/OpenShift environments.
8+
9+
**CAMGI analyzes:**
10+
- Cluster autoscaler configuration and behavior
11+
- Autoscaler scaling decisions and events
12+
- Cluster operators status and health
13+
- Machines, MachineSets, and Nodes configuration
14+
- Control Plane MachineSets
15+
- Machine API operator status
16+
- Machine Config operator status
17+
- Cloud Controller Manager details
18+
- Node group status and autoscaler-related issues
19+
20+
## Quick Start
21+
22+
```bash
23+
./run-camgi.sh /path/to/must-gather
24+
```
25+
26+
Or use the slash command from anywhere:
27+
```
28+
/must-gather:camgi /path/to/must-gather
29+
```
30+
31+
The script will automatically:
32+
1. Detect must-gather subdirectory structure
33+
2. **Check and fix file permissions** (with your confirmation)
34+
3. Start camgi (containerized or local install)
35+
4. Open web interface at http://127.0.0.1:8080
36+
37+
## Commands
38+
39+
### Start CAMGI
40+
```bash
41+
./run-camgi.sh <must-gather-path>
42+
# Or
43+
/must-gather:camgi <must-gather-path>
44+
```
45+
46+
### Stop CAMGI
47+
```bash
48+
./run-camgi.sh stop
49+
# Or
50+
/must-gather:camgi stop
51+
```
52+
53+
## Key Features
54+
55+
### ✅ Automatic Permission Fixing
56+
- Detects restrictive file permissions
57+
- Prompts: "Fix permissions now? (Y/n)"
58+
- Runs `chmod -R a+r` with user confirmation
59+
- No manual chmod needed!
60+
61+
### ✅ SELinux Compatible
62+
- Uses `:Z` volume mount flag for proper SELinux labeling
63+
- Works with SELinux in enforcing mode
64+
- No security-opt disabling required
65+
66+
### ✅ Automatic Browser Opening
67+
- Opens http://127.0.0.1:8080 automatically
68+
- Uses IPv4 address (avoids IPv6 issues)
69+
70+
### ✅ Smart Container Management
71+
- Auto-detects podman/docker
72+
- Falls back to containerized version if camgi not installed locally
73+
- Simple stop command cleans up all containers
74+
75+
### ✅ User-Friendly
76+
- Clear colored output
77+
- Helpful error messages
78+
- Ctrl+C works properly
79+
80+
## Installation Methods
81+
82+
### Method 1: Containerized (Default)
83+
No installation needed! The script automatically uses the container image.
84+
85+
**Prerequisites:**
86+
- Podman or Docker
87+
88+
### Method 2: Local Install (Optional)
89+
```bash
90+
pip3 install okd-camgi --user
91+
```
92+
93+
**Benefits:**
94+
- Faster startup
95+
- Uses `--webbrowser` flag
96+
- No container overhead
97+
98+
## Technical Details
99+
100+
### Container Command
101+
```bash
102+
podman run --rm -it -p 8080:8080 \
103+
-v /path/to/must-gather:/must-gather:Z \
104+
quay.io/elmiko/okd-camgi
105+
```
106+
107+
### Flags Explained
108+
- `--rm` - Auto-remove container when stopped
109+
- `-it` - Interactive terminal (Ctrl+C works)
110+
- `-p 8080:8080` - Port mapping
111+
- `-v path:/must-gather:Z` - Volume mount + SELinux relabeling
112+
- **No** `--security-opt label=disable` - SELinux stays enabled!
113+
114+
### File Permissions
115+
The script checks for restrictive permissions and offers to fix them.
116+
117+
**Manual fix (if needed):**
118+
```bash
119+
chmod -R a+r /path/to/must-gather
120+
```
121+
122+
This is safe - must-gather data should not contain secrets.
123+
124+
## Troubleshooting
125+
126+
### Permission Errors
127+
**Symptom:** `PermissionError: [Errno 13] Permission denied`
128+
129+
**Solution:** The script will prompt you to fix this. Press Y to allow automatic fixing.
130+
131+
**Manual fix:**
132+
```bash
133+
chmod -R a+r /path/to/must-gather
134+
```
135+
136+
### Cannot Connect to Browser
137+
**Symptom:** Browser can't access localhost:8080
138+
139+
**Solution:** Use http://127.0.0.1:8080 instead of localhost
140+
141+
This is due to IPv6 compatibility with rootless podman.
142+
143+
### Port Already in Use
144+
**Symptom:** Port 8080 is occupied
145+
146+
**Solution:** Stop other containers or run manually with different port:
147+
```bash
148+
podman run --rm -it -p 9090:8080 \
149+
-v /path/to/must-gather:/must-gather:Z \
150+
quay.io/elmiko/okd-camgi
151+
```
152+
153+
Then access at http://127.0.0.1:9090
154+
155+
### SELinux Denials
156+
**Check status:**
157+
```bash
158+
getenforce
159+
```
160+
161+
**View denials:**
162+
```bash
163+
sudo ausearch -m AVC -ts recent
164+
```
165+
166+
The `:Z` flag should handle all SELinux labeling automatically.
167+
168+
## Files Included
169+
170+
1. **run-camgi.sh** - Main executable script
171+
2. **README-CAMGI.md** - This documentation
172+
173+
## References
174+
175+
- CAMGI GitHub: https://github.com/elmiko/okd-camgi
176+
- CAMGI on PyPI: https://pypi.org/project/okd-camgi/
177+
- Must-Gather Documentation: https://docs.openshift.com/container-platform/latest/support/gathering-cluster-data.html
178+
179+
## Future Enhancements
180+
181+
- `--port` flag for custom port selection
182+
- Support for tar.gz must-gather files
183+
- `--no-browser` flag to skip automatic opening
184+
- Custom container registry support

0 commit comments

Comments
 (0)