How polds/kubectl-forwarder works
kubectl-forwarder is an interactive terminal app for creating and supervising Kubernetes service port-forwards. The user chooses a namespace, service, remote port, and local port; the app launches kubectl, monitors the tunnel, retries failures with backoff, and displays status, logs, and errors. The main internal layers are the Bubble Tea model and renderer, Kubernetes metadata lookup, and per-forward supervision. Excerpts establish these calls; unsampled details are omitted.
Main entry points: model.go Wizard and dashboard state · supervisor.go Forward supervisor · kubectl.go Namespace and service lookup · main.go Application entry
Components 9
Terminal interaction
- Application entry
main.go - Wizard and dashboard state
model.go - Terminal renderer
view.go
Cluster discovery
- Namespace and service lookup
kubectl.go
Tunnel supervision
- Forward supervisor
supervisor.go - Forward status and logs
supervisor.go
Other components
- User
- Kubernetes cluster
- kubectl process
Connections 14
- User → Application entry: launches
- Application entry → Wizard and dashboard state: initializes
- User → Wizard and dashboard state: operates
- Wizard and dashboard state → Namespace and service lookup: schedules lookups
- Namespace and service lookup → kubectl process: queries metadata
- kubectl process → Kubernetes cluster: reads services
- Namespace and service lookup → Wizard and dashboard state: returns results
- Wizard and dashboard state → Forward supervisor: starts or cancels
- Forward supervisor → kubectl process: runs port-forward
- kubectl process → Kubernetes cluster: forwards traffic
- Forward supervisor → Forward status and logs: updates
- Wizard and dashboard state → Forward status and logs: reads snapshots
- Forward supervisor → Wizard and dashboard state: notifies changes
- Wizard and dashboard state → Terminal renderer: renders screens