Skip to content

feat(k9s): automatic danger skin for production clusters#128

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/add-danger-warning-for-prd-cluster
Draft

feat(k9s): automatic danger skin for production clusters#128
Copilot wants to merge 3 commits intomasterfrom
copilot/add-danger-warning-for-prd-cluster

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 11, 2026

k9s gives no visual indication when you're operating on a production cluster, making it easy to accidentally apply destructive changes.

Changes

  • .aliases — adds a k9s bash function that inspects the active kubectl context at launch time; if the context name contains prd (case-insensitive), it sets K9S_SKIN=prd for that invocation before calling the real binary via command k9s.

  • .config/k9s/skins/prd.yml — red-tinted danger skin derived from the existing Dracula theme. Uses a dark red background (#1c0000), red borders, logo, and accent colours to make the production context immediately unmistakable.

  • .gitignore — adds !.config/k9s/skins/ exception, consistent with the existing !.config/k9s/skin.yml rule, so the new skins directory is tracked.

# Non-prd context → normal Dracula skin
$ kubectl config use-context staging-eu && k9s

# Any context containing "prd" → danger red skin applied automatically
$ kubectl config use-context prod-eu-prd && k9s  # K9S_SKIN=prd

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: bdossantos <245284+bdossantos@users.noreply.github.com>
Copilot AI changed the title [WIP] Add awareness indicator for production clusters in k9s feat(k9s): automatic danger skin for production clusters Mar 11, 2026
@bdossantos
Copy link
Copy Markdown
Owner

@copilot is possible to achieve this via an alias or bash function ?

Co-authored-by: bdossantos <245284+bdossantos@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 11, 2026

@copilot is possible to achieve this via an alias or bash function ?

Done in 577c8e0. Replaced bin/k9s with a k9s bash function in .aliases:

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

command k9s bypasses the function to call the real binary. The ${context,,} lowercase expansion ensures contexts like PRD or Prd are caught too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants