Skip to content

Commit 6ac0b31

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 cc69412 commit 6ac0b31

File tree

6 files changed

+661
-0
lines changed

6 files changed

+661
-0
lines changed

PLUGINS.md

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

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

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

0 commit comments

Comments
 (0)