improvements nov2025 (#10)

* Add benchmark and httplog modules, update UI for modals artefacts
This commit is contained in:
2025-11-25 19:00:44 +00:00
committed by GitHub
parent 035b1cdd01
commit 3f5c1d3a5f
19 changed files with 2976 additions and 186 deletions
+72 -4
View File
@@ -28,6 +28,9 @@ kportal manages multiple Kubernetes port-forwards with an interactive terminal i
- **Label selectors** - Dynamic pod targeting using label selectors
- **Port conflict detection** - Validates port availability with PID information
- **mDNS hostnames** - Access forwards via `.local` hostnames
- **HTTP traffic logging** - Real-time HTTP request/response logging for debugging
- **Connection benchmarking** - Built-in HTTP benchmarking with latency statistics
- **Headless mode** - Background operation for scripting and automation
## 📦 Installation
@@ -71,10 +74,12 @@ contexts:
localPort: 5432
alias: prod-db
- resource: service/redis
- resource: service/api
protocol: tcp
port: 6379
localPort: 6379
port: 8080
localPort: 8080
alias: api
httpLog: true # Enable HTTP traffic logging
```
Run:
@@ -89,9 +94,11 @@ kportal
|-----|--------|
| `↑↓` / `j/k` | Navigate |
| `Space` / `Enter` | Toggle forward |
| `a` | Add forward |
| `n` | Add new forward |
| `e` | Edit forward |
| `d` | Delete forward |
| `b` | Benchmark connection |
| `l` | View HTTP logs |
| `q` | Quit |
## 📖 Configuration
@@ -110,6 +117,7 @@ contexts:
localPort: <local-port>
alias: <display-name> # optional
selector: <label-selector> # optional
httpLog: true # optional - enable HTTP logging
```
### Forward Options
@@ -122,6 +130,7 @@ contexts:
| `localPort` | Yes | Local port |
| `alias` | No | Display name and mDNS hostname |
| `selector` | No | Label selector for pod resolution |
| `httpLog` | No | Enable HTTP traffic logging (`true`/`false`) |
### Resource Formats
@@ -198,6 +207,20 @@ kportal
kportal -v
```
### Headless Mode
Run without TUI for scripting and automation:
```bash
kportal -headless
```
Combines well with verbose mode for background operation:
```bash
kportal -headless -v &
```
### Validate Configuration
```bash
@@ -222,6 +245,51 @@ kportal -c /path/to/config.yaml
## Advanced Features
### HTTP Traffic Logging
Press `l` in the TUI to view real-time HTTP traffic for a selected forward. The log viewer shows:
| Column | Description |
|--------|-------------|
| TIME | Request timestamp |
| METHOD | HTTP method (GET, POST, etc.) |
| STATUS | Response status code |
| LATENCY | Request duration |
| PATH | Request path |
**Keyboard shortcuts:**
| Key | Action |
|-----|--------|
| `↑/↓` | Navigate entries |
| `g/G` | Jump to top/bottom |
| `a` | Toggle auto-scroll |
| `f` | Cycle filter mode (All → Non-2xx → Errors) |
| `/` | Search by path or method |
| `c` | Clear all filters |
| `q` | Close log viewer |
**Filter modes:**
- **All** - Show all entries
- **Non-2xx** - Hide successful (2xx) responses
- **Errors** - Show only 4xx and 5xx responses
### Connection Benchmarking
Press `b` in the TUI to benchmark a selected forward. Configure:
- **URL Path** - Target endpoint (default: `/`)
- **Method** - HTTP method (GET, POST, etc.)
- **Concurrency** - Number of parallel workers
- **Requests** - Total number of requests
Results include:
- Success/failure counts
- Min/Max/Avg latency
- P50/P95/P99 percentiles
- Throughput (requests/sec)
- Status code distribution
### Hot-Reload
Configuration changes are applied automatically. Manual reload: