refactor: modular .bashrc.d/ structure
- Rewrite .bashrc as minimal loader (34 lines → loads .bashrc.d/*.sh)
- Clean .bash_profile: single source, Apple Silicon/Intel brew path
- Add .bashrc.d/ with 7 topic modules:
00_env.sh PS1, OSTYPE, colors, pyenv
10_aliases.sh universal aliases
20_functions.sh proxy, dbash, git helpers
30_work.sh work-host detection, LDAP, AWX, Juniper tools
(+ unified-hub-login with env-var creds)
40_k8s.sh kubectl completion + aliases
50_ai_env.sh WORKSPACE/DATA_ROOT/MODEL_ROOT paths
60_dotfiles.sh dotfiles manager aliases, zet shortcuts
- Secrets (SN_PASSWORD, LDAP bind PWs, Unified Hub token) moved
to ~/.bashrc.local (gitignored, written by setup script)
- Update .dotfiles_manifest to track .bashrc.d directory
This commit is contained in:
33
.bashrc.d/40_k8s.sh
Normal file
33
.bashrc.d/40_k8s.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# 40_k8s.sh — Kubernetes / kubectl aliases and completion
|
||||
#
|
||||
# Loaded on all machines but only meaningful on work hosts.
|
||||
# kubectl must be installed for completion to activate.
|
||||
# ============================================================================
|
||||
|
||||
command -v kubectl >/dev/null 2>&1 || return 0 # skip silently if not installed
|
||||
|
||||
# Bash completion
|
||||
source <(kubectl completion bash)
|
||||
alias k=kubectl
|
||||
complete -o default -F __start_kubectl k
|
||||
|
||||
# Config inspection
|
||||
alias kc='kubectl config view'
|
||||
alias kuc='kubectl config use-context'
|
||||
|
||||
# Resource shortcuts
|
||||
alias kd='kubectl describe'
|
||||
alias ke='kubectl explain'
|
||||
alias kg='kubectl get'
|
||||
alias kl='kubectl logs -f'
|
||||
alias kp='kubectl get pods -o wide'
|
||||
alias kq='kubectl describe quota'
|
||||
alias ks='kubectl get services'
|
||||
alias kpl='kubectl get pods --show-labels'
|
||||
alias kdp='kubectl describe pod'
|
||||
alias kgs='kubectl get secrets'
|
||||
|
||||
# Context / namespace switchers
|
||||
alias kx='f() { [ "$1" ] && kubectl config use-context "$1" || kubectl config current-context; }; f'
|
||||
alias kn='f() { [ "$1" ] && kubectl config set-context --current --namespace "$1" || kubectl config view --minify | grep namespace | cut -d" " -f6; }; f'
|
||||
Reference in New Issue
Block a user