Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ The prompt is [Starship](https://starship.rs) (`dot_config/starship.toml` — th
|--------|--------|---------|
| git | built-in | Git aliases (`gst`, `gco`, `gp`, …) |
| kubectl | built-in | `k*` aliases + completion (`kgp`, `kgaa`, `kdp`, …) |
| kubectl fleet | `dot_zshrc.tmpl` | Joins a generated `~/.kube/tv-fleet.yaml` onto `KUBECONFIG` when it exists, personal config first, and prints a once-a-day notice when the fleet has moved. The check runs detached, so the prompt shows the previous run's answer rather than waiting for a git remote; it never edits contexts by itself |
| helm | built-in | Helm completion |
| terraform | built-in | `tf*` aliases + completion + workspace |
| aws | built-in | `asp`/`acp` profile switch + completion |
Expand Down
27 changes: 27 additions & 0 deletions dot_zshrc.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,33 @@ if [ -d "$HOME/.krew/bin" ]; then
export PATH="$HOME/.krew/bin:$PATH"
fi

# The managed fleet is a generated file, joined here rather than merged into ~/.kube/config.
# Personal config first: on a duplicate key the earlier file wins, so hand-made entries keep
# their behaviour and the fleet only adds what they do not already define.
if [ -f "$HOME/.kube/tv-fleet.yaml" ]; then
export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/config}:$HOME/.kube/tv-fleet.yaml"
fi

# Tell me when the cluster fleet has moved, without ever making me wait for it. The check talks
# to a git remote, so it runs detached and what the shell prints is the *previous* run's answer;
# a slow or unreachable registry costs a stale notice, never a delayed prompt. It reports only —
# adding or removing a context silently would change where the next command lands.
_tv_fleet_notice() {
local dir="${XDG_CACHE_HOME:-$HOME/.cache}/tv"
local stamp="$dir/fleet-check.stamp" msg="$dir/fleet-check.msg"
[ -s "$msg" ] && cat "$msg"
command -v kubectl-tv >/dev/null 2>&1 || return 0
mkdir -p "$dir" 2>/dev/null || return 0
# Re-check once a day. -mtime +0 is "last modified more than 24h ago"; a missing stamp is the
# first run and checks immediately.
if [ ! -e "$stamp" ] || [ -n "$(find "$stamp" -mtime +0 -print 2>/dev/null)" ]; then
( kubectl-tv clusters check --quiet >"$msg.new" 2>/dev/null \
&& mv -f "$msg.new" "$msg" || rm -f "$msg.new"
: >"$stamp" ) &!
fi
}
_tv_fleet_notice

{{ if .bitwarden.agent -}}
# --- SSH agent: Bitwarden ---
# Route SSH auth + git commit signing through the Bitwarden desktop app's SSH agent, whose
Expand Down