feat(kube-ps1): add kube-ps1 plugin#736
Conversation
Review Summary by QodoAdd kube-ps1 plugin for Kubernetes prompt integration
WalkthroughsDescription• Adds new kube-ps1 plugin displaying Kubernetes context and namespace • Implements kubeon/kubeoff commands for interactive toggling • Includes efficient kubeconfig file watching to minimize prompt overhead • Supports persistent global state via ~/.kube/kube-ps1/disabled marker Diagramflowchart LR
A["kube-ps1 Plugin"] --> B["kube_ps1 Function"]
A --> C["kubeon/kubeoff Commands"]
A --> D["PROMPT_COMMAND Hook"]
B --> E["Display Context & Namespace"]
C --> F["Toggle On/Off"]
D --> G["Watch kubeconfig Files"]
G --> H["Update Prompt Segment"]
F --> I["Persist State Globally"]
File Changes1. plugins/kube-ps1/kube-ps1.plugin.sh
|
Code Review by Qodo
1.
|
|
@rafacouto Thank you for this. I was just considering how I would do this myself. A few things:
|
…space for newline endings
…improve reliability
Closes #719
Description
Adds a new
kube-ps1plugin that displays the current Kubernetes context andnamespace in the shell prompt, with
kubeon/kubeoffcommands to toggle itinteractively.
Changes
plugins/kube-ps1/kube-ps1.plugin.sh— main pluginplugins/kube-ps1/README.md— documentation and configuration referenceplugins/kube-ps1/LICENSE— Apache 2.0 license from the upstream project (required by its license terms)plugins/README.md— addedkube-ps1entry to the plugin tableImplementation details
_omb_plugin_kube_ps1_*naming convention._omb_util_add_prompt_command()and_omb_util_command_exists()from the OMB API.kube_ps1segment is injected intoPS1via a lazy-registered post-theme hook, so it works correctly regardless of which theme is active — no theme modifications required.kubeon -g/kubeoff -gpersist the state across sessions via~/.kube/kube-ps1/disabled.Usage
# ~/.bashrc plugins=(... kube-ps1)