kubecnf

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

README ΒΆ

kubecnf

This is fully vibe coded

CI Release Go Report Card Docker

Add and remove kubeconfigs from the main config file with support for piped input and comprehensive shell completions.

Usage

Info: With unspecified config file (-c / --config) default value is used (~/.kube/config)

Add a new cluster config

From a file:

kubecnf [-c /path/to/main/config] add /path/to/new/cluster/config

From piped input:

cat /path/to/new/cluster/config | kubecnf [-c /path/to/main/config] add
kubectl config view --raw | kubecnf [-c /path/to/main/config] add
echo "apiVersion: v1
kind: Config
clusters:
- cluster:
    server: https://cluster.example.com
  name: example-cluster
contexts:
- context:
    cluster: example-cluster
    user: example-user
  name: example-context
users:
- name: example-user
  user:
    token: your-token-here" | kubecnf add

Note: You cannot use both a file argument and piped input simultaneously.

Remove a cluster config
kubecnf [-c /path/to/main/config] remove cluster-name
List all cluster configs
kubecnf [-c /path/to/main/config] list
Rollback to the previous config
kubecnf [-c /path/to/main/config] rollback

Shell Completion

kubecnf supports completion for both bash and zsh shells.

Bash Completion

To enable bash completion, source the completion script:

source <(kubecnf completion bash)

To make it permanent, add the above line to your ~/.bashrc file.

Alternatively, install system-wide (requires sudo):

kubecnf completion bash | sudo tee /etc/bash_completion.d/kubecnf
Zsh Completion

To enable zsh completion, add the completion script to your fpath:

# Add to ~/.zshrc
kubecnf completion zsh > "${fpath[1]}/_kubecnf"

Or source it directly:

source <(kubecnf completion zsh)

For Oh My Zsh users, you can place the completion file in the completions directory:

mkdir -p ~/.oh-my-zsh/completions
kubecnf completion zsh > ~/.oh-my-zsh/completions/_kubecnf

Installation

  1. Clone the repository
  2. Build the binary:
    go build -o kubecnf
    
  3. Move the binary to a directory in your PATH, e.g.:
    sudo mv kubecnf /usr/local/bin/
    

Alternatively, you can download the pre-built binary directly from the GitHub release page rename it and move it to your PATH as shown above.

Using Docker
# Pull and run from GitHub Container Registry
docker pull ghcr.io/snakebiteef2000/kubecnf:latest
docker run --rm -v ~/.kube:/root/.kube ghcr.io/snakebiteef2000/kubecnf:latest --help
Using Makefile (for development)
# Install development tools and build
make dev-setup
make all

# Install locally
make install

πŸ—οΈ Development

For development instructions, testing, and contributing guidelines, see DEVELOPMENT.md.

πŸš€ Features

  • βœ… Add kubeconfigs from files or piped input
  • βœ… Remove cluster configurations by name
  • βœ… List all configured clusters
  • βœ… Rollback to previous configurations
  • βœ… Shell completions for bash and zsh
  • βœ… Comprehensive input validation
  • βœ… Automatic backups
  • βœ… Duplicate detection with warnings
  • βœ… Docker container support
  • βœ… Multi-platform releases (Linux, macOS, Windows, FreeBSD)

πŸ“Š Project Status

This project follows professional development practices:

  • πŸ”„ Continuous Integration: Automated testing, linting, and security scanning
  • πŸ“¦ Automated Releases: Multi-platform binaries and Docker images
  • πŸ”’ Security: Regular security scans and dependency updates
  • πŸ“ˆ Code Quality: Comprehensive linting and test coverage
  • πŸ€– Automation: Dependabot for dependency management

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL