From 2211bf991a0dd94198c91b115f551b6de5c51e07 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 10:54:25 +0000 Subject: [PATCH 1/3] Initial plan From 07f22e4c136b40cdd1abafd55568e39d22ba466f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 11:00:23 +0000 Subject: [PATCH 2/3] feat(k9s): add danger skin for production clusters Co-authored-by: bdossantos <245284+bdossantos@users.noreply.github.com> --- .config/k9s/skins/prd.yml | 107 ++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + bin/k9s | 37 +++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 .config/k9s/skins/prd.yml create mode 100755 bin/k9s diff --git a/.config/k9s/skins/prd.yml b/.config/k9s/skins/prd.yml new file mode 100644 index 0000000..3a5c319 --- /dev/null +++ b/.config/k9s/skins/prd.yml @@ -0,0 +1,107 @@ +# Production cluster skin - danger/red theme to visually warn when +# operating on a production cluster (context name contains "prd"). +# Based on the Dracula skin with red-tinted backgrounds and accents. +foreground: &foreground "#f8f8f2" +background: &background "#1c0000" +current_line: ¤t_line "#3d0000" +comment: &comment "#6272a4" +bright_red: &bright_red "#ff8888" +orange: &orange "#ffb86c" +red: &red "#ff5555" +yellow: &yellow "#f1fa8c" + +# Skin... +k9s: + # General K9s styles + body: + fgColor: *foreground + bgColor: *background + logoColor: *red + # Command prompt styles + prompt: + fgColor: *foreground + bgColor: *background + suggestColor: *red + # ClusterInfoView styles. + info: + fgColor: *red + sectionColor: *foreground + # Dialog styles. + dialog: + fgColor: *foreground + bgColor: *background + buttonFgColor: *foreground + buttonBgColor: *red + buttonFocusFgColor: *background + buttonFocusBgColor: *bright_red + labelFgColor: *orange + fieldFgColor: *foreground + frame: + # Borders styles. + border: + fgColor: *red + focusColor: *current_line + menu: + fgColor: *foreground + keyColor: *red + # Used for favorite namespaces + numKeyColor: *red + # CrumbView attributes for history navigation. + crumbs: + fgColor: *foreground + bgColor: *current_line + activeColor: *current_line + # Resource status and update styles + status: + newColor: *bright_red + modifyColor: *red + addColor: *orange + errorColor: *red + highlightColor: *orange + killColor: *comment + completedColor: *comment + # Border title styles. + title: + fgColor: *foreground + bgColor: *current_line + highlightColor: *orange + counterColor: *red + filterColor: *red + views: + # Charts skins... + charts: + bgColor: default + defaultDialColors: + - *red + - *bright_red + defaultChartColors: + - *red + - *bright_red + # TableView attributes. + table: + fgColor: *foreground + bgColor: *background + # Header row styles. + header: + fgColor: *foreground + bgColor: *background + sorterColor: *orange + # Xray view attributes. + xray: + fgColor: *foreground + bgColor: *background + cursorColor: *current_line + graphicColor: *red + showIcons: false + # YAML info styles. + yaml: + keyColor: *red + colonColor: *bright_red + valueColor: *foreground + # Logs styles. + logs: + fgColor: *foreground + bgColor: *background + indicator: + fgColor: *foreground + bgColor: *red diff --git a/.gitignore b/.gitignore index 5278fd7..4220acb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ !.config/k9s/skin.yml +!.config/k9s/skins/ !.config/starship.toml !.config/zellij/config.yaml !.config/nvim/ diff --git a/bin/k9s b/bin/k9s new file mode 100755 index 0000000..58f87a1 --- /dev/null +++ b/bin/k9s @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Wrapper around k9s that automatically applies a red danger skin when the +# current kubectl context contains "prd", to visually warn the operator that +# they are working on a production cluster. + +set -o errexit +set -o pipefail +set -o nounset + +DEBUG=${DEBUG:=0} +[[ $DEBUG -eq 1 ]] && set -o xtrace + +# Find the real k9s binary, skipping this wrapper script itself. +_self="$(readlink -f "${BASH_SOURCE[0]}")" +_k9s='' + +while IFS= read -rd ':' _dir; do + _candidate="${_dir}/k9s" + if [[ -x "$_candidate" && "$(readlink -f "$_candidate")" != "$_self" ]]; then + _k9s="$_candidate" + break + fi +done <<< "${PATH}:" + +if [[ -z "$_k9s" ]]; then + echo "k9s: command not found" >&2 + exit 127 +fi + +# Use the danger skin when the current context name contains "prd". +_context="$(kubectl config current-context 2>/dev/null || true)" + +if [[ -n "$_context" && "$_context" == *prd* ]]; then + export K9S_SKIN="${K9S_SKIN:-prd}" +fi + +exec "$_k9s" "$@" From 577c8e0cd10042e4509d8b366eb2985ca1a403b8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 12:35:27 +0000 Subject: [PATCH 3/3] refactor(k9s): replace bin wrapper with bash function in .aliases Co-authored-by: bdossantos <245284+bdossantos@users.noreply.github.com> --- .aliases | 13 +++++++++++++ bin/k9s | 37 ------------------------------------- 2 files changed, 13 insertions(+), 37 deletions(-) delete mode 100755 bin/k9s diff --git a/.aliases b/.aliases index fc13f7e..70a1a5f 100644 --- a/.aliases +++ b/.aliases @@ -202,6 +202,19 @@ if command -v kubectl &>/dev/null; then alias netshoot='kubectl run netshoot-$(date +%s) --rm -i --tty --image nicolaka/netshoot -- /bin/bash' fi +# k9s - apply danger skin when current context contains "prd" +if command -v k9s &>/dev/null; then + function k9s() { + local context + context="$(kubectl config current-context 2>/dev/null || true)" + if [[ -n "$context" && "${context,,}" == *prd* ]]; then + K9S_SKIN="${K9S_SKIN:-prd}" command k9s "$@" + else + command k9s "$@" + fi + } +fi + # akamai alias akamai='docker run -it -v ${HOME}/.config/akamai/.edgerc:/root/.edgerc:ro akamai/shell:latest akamai' diff --git a/bin/k9s b/bin/k9s deleted file mode 100755 index 58f87a1..0000000 --- a/bin/k9s +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -# Wrapper around k9s that automatically applies a red danger skin when the -# current kubectl context contains "prd", to visually warn the operator that -# they are working on a production cluster. - -set -o errexit -set -o pipefail -set -o nounset - -DEBUG=${DEBUG:=0} -[[ $DEBUG -eq 1 ]] && set -o xtrace - -# Find the real k9s binary, skipping this wrapper script itself. -_self="$(readlink -f "${BASH_SOURCE[0]}")" -_k9s='' - -while IFS= read -rd ':' _dir; do - _candidate="${_dir}/k9s" - if [[ -x "$_candidate" && "$(readlink -f "$_candidate")" != "$_self" ]]; then - _k9s="$_candidate" - break - fi -done <<< "${PATH}:" - -if [[ -z "$_k9s" ]]; then - echo "k9s: command not found" >&2 - exit 127 -fi - -# Use the danger skin when the current context name contains "prd". -_context="$(kubectl config current-context 2>/dev/null || true)" - -if [[ -n "$_context" && "$_context" == *prd* ]]; then - export K9S_SKIN="${K9S_SKIN:-prd}" -fi - -exec "$_k9s" "$@"