Skip to content

Commit

Permalink
fix(k9s): Add k9s config and skin manifest files
Browse files Browse the repository at this point in the history
Improve zsh config, along with starship (prompt), and tmux configuration
for kubernetes
  • Loading branch information
sydrawat01 committed Dec 27, 2023
1 parent 347667d commit c7c5d4c
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 11 deletions.
50 changes: 50 additions & 0 deletions configs/k9s/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
k9s:
refreshRate: 2
maxConnRetry: 5
enableMouse: false
headless: false
logoless: false
crumbsless: false
readOnly: false
noExitOnCtrlC: false
noIcons: false
skipLatestRevCheck: false
logger:
tail: 100
buffer: 5000
sinceSeconds: 300
fullScreenLogs: false
textWrap: false
showTime: false
currentContext: minikube
currentCluster: minikube
clusters:
minikube:
namespace:
active: all
lockFavorites: false
favorites:
- all
- default
view:
active: pods
featureGates:
nodeShell: false
shellPod:
image: busybox:1.35.0
command: []
args: []
namespace: default
limits:
cpu: 100m
memory: 100Mi
labels: {}
portForwardAddress: localhost
thresholds:
cpu:
critical: 90
warn: 70
memory:
critical: 90
warn: 70
screenDumpDir: /var/folders/k7/h5175bs53hb98z_s9k5wvbqw0000gn/T/k9s-screens-sid
114 changes: 114 additions & 0 deletions configs/k9s/skin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# -----------------------------------------------------------------------------
# OneDark Skin
# -----------------------------------------------------------------------------

# Styles...
foreground: &foreground "#abb2bf"
background: &background "#282c34"
black: &black "#080808"
blue: &blue "#61afef"
green: &green "#98c379"
grey: &grey "#abb2bf"
orange: &orange "#ffb86c"
purple: &purple "#c678dd"
red: &red "#e06370"
yellow: &yellow "#e5c07b"
yellow_bright: &yellow_bright "#d19a66"

# Skin...
k9s:
body:
fgColor: *foreground
bgColor: *background
logoColor: *green
prompt:
fgColor: *foreground
bgColor: *background
suggestColor: *orange
info:
fgColor: *grey
sectionColor: *green
help:
fgColor: *foreground
bgColor: *background
keyColor: *yellow
numKeyColor: *blue
sectionColor: *purple
dialog:
fgColor: *black
bgColor: *background
buttonFgColor: *foreground
buttonBgColor: *green
buttonFocusFgColor: *black
buttonFocusBgColor: *blue
labelFgColor: *orange
fieldFgColor: *blue
frame:
border:
fgColor: *green
focusColor: *green
menu:
fgColor: *grey
keyColor: *yellow
numKeyColor: *yellow
crumbs:
fgColor: *black
bgColor: *green
activeColor: *yellow
status:
newColor: *blue
modifyColor: *green
addColor: *grey
pendingColor: *orange
errorColor: *red
highlightColor: *yellow
killColor: *purple
completedColor: *grey
title:
fgColor: *blue
bgColor: *background
highlightColor: *purple
counterColor: *foreground
filterColor: *blue
views:
charts:
bgColor: *background
defaultDialColors:
- *green
- *red
defaultChartColors:
- *green
- *red
table:
fgColor: *yellow
bgColor: *background
cursorFgColor: *black
cursorBgColor: *blue
markColor: *yellow_bright
header:
fgColor: *grey
bgColor: *background
sorterColor: *orange
xray:
fgColor: *blue
bgColor: *background
cursorColor: *foreground
graphicColor: *yellow_bright
showIcons: false
yaml:
keyColor: *red
colonColor: *grey
valueColor: *grey
logs:
fgColor: *grey
bgColor: *background
indicator:
fgColor: *blue
bgColor: *background
toggleOnColor: *red
toggleOffColor: *grey
help:
fgColor: *grey
bgColor: *background
indicator:
fgColor: *blue
24 changes: 21 additions & 3 deletions configs/starship/starship.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# Timeout for commands executed by starship (ms)
command_timeout = 1000

# add_newline = false
# A minimal left prompt
# format = """$directory$character$git_branch$docker_context"""
# move the rest of the prompt to the right
right_format = """$gcloud"""

#[angular]
#symbol = "󰚲 "

[aws]
symbol = ""
style = 'bold blue'
format = 'on [$symbol($profile )(\($region\) )]($style)'


[azure]
symbol = ""
Expand Down Expand Up @@ -33,6 +45,7 @@ read_only = " 󰌾"

[docker_context]
symbol = ""
# disabled = true

[elixir]
symbol = ""
Expand All @@ -48,12 +61,14 @@ symbol = " "

[golang]
symbol = ""
style = 'bold cyan'
# format = '[$symbol ]($style)'

[gcloud]
# symbol = "󰊭 "
symbol = ""
symbol = "󰊭"
# symbol = " "
format = '[$symbol $account(\($project\))]($style) '
style = "bold yellow"
style = "bold green"

[guix_shell]
symbol = ""
Expand Down Expand Up @@ -81,6 +96,9 @@ symbol = " "

[kubernetes]
symbol = ""
disabled = true
detect_files = ['Dockerfile']
format = '[$context(\[$namespace\])]($style) '

[lua]
symbol = ""
Expand Down
2 changes: 2 additions & 0 deletions configs/tmux/.tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ set -g @dracula-show-left-icon session
set -g @dracula-show-fahrenheit false
set -g @dracula-fixed-location 'Cambridge,Massachusetts'
set -g @dracula-plugins 'battery kubernetes-context terraform weather network time'
set -g @dracula-kubernetes-eks-hide-arn true
set -g @dracula-kubernetes-hide-user true
set -g @dracula-kubernetes-context-label ""
set -g @dracula-military-time true
set -g @dracula-time-format " %R"
set -g @dracula-kubernetes-context-colors 'deep_blue light_gray'
Expand Down
24 changes: 23 additions & 1 deletion configs/tmux/plugins/tmux/scripts/kubernetes_context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# setting the locale, some users have issues with different locales, this forces the correct one
export LC_ALL=en_US.UTF-8

label=$1
hide_arn_from_cluster=$1
extract_account=$2
hide_user=$3
label=$4

current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $current_dir/utils.sh
Expand All @@ -12,11 +15,30 @@ current_user=$(kubectl config view --minify --output 'jsonpath={.contexts[?(@.na
current_cluster=$(kubectl config view --minify --output 'jsonpath={.contexts[?(@.name=="'$current_context'")].context.cluster}'; echo)
current_namespace=$(kubectl config view --minify --output 'jsonpath={.contexts[?(@.name=="'$current_context'")].context.namespace}'; echo)

current_account_id=""
if [[ "$current_cluster" =~ ^arn:aws:eks:[a-z0-9\-]*:[0-9]*:cluster/[a-z0-9\-]*$ ]]; then
if [ "$extract_account" = "true" ]; then
current_account_id=$(echo "$current_cluster" | cut -d':' -f5)
fi
if [ "$hide_arn_from_cluster" = "true" ]; then
current_cluster=${current_cluster##*/}
fi
fi

if [ "$hide_user" = "true" ]; then
current_user=""
fi

main()
{
# storing the refresh rate in the variable RATE, default is 5
RATE=$(get_tmux_option "@dracula-refresh-rate" 5)
OUTPUT_STRING=""
if [ ! -z "$current_account_id" ]
then
OUTPUT_STRING="${current_account_id}/"
fi

if [ ! -z "$current_user" ]
then
OUTPUT_STRING="${current_user}@"
Expand Down
4 changes: 2 additions & 2 deletions runcom/.zsh_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ alias oldvi="/usr/bin/vi"
alias python="/usr/bin/python3"

# Command aliases
alias ll="ls -la"
alias ll="ls -larth"

# ansible
alias a="ansible"
Expand All @@ -26,7 +26,7 @@ alias tf="terraform"
alias tfp="tf plan"
alias tfa="tf apply"
alias tfd="tf destroy"
#

# kubernetes
alias k="kubectl"
alias kns="kubens"
Expand Down
17 changes: 12 additions & 5 deletions runcom/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
plugins=(git \
zsh-autosuggestions \
zsh-syntax-highlighting \
docker\
docker-compose\
golang \
kubectl \
ansible \
Expand All @@ -96,11 +98,11 @@ source $ZSH/oh-my-zsh.sh
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='mvim'
fi
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='nvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"
Expand All @@ -127,5 +129,10 @@ export KUBE_EDITOR=nvim
export GOPATH=$HOME/go
export GOROOT="$(brew --prefix golang)/libexec"

export ES_JAVA_HOME="$(/usr/libexec/java_home)"

export PATH="/opt/homebrew/opt/postgresql@15/bin:$PATH:${GOPATH}/bin:${GOROOT}/bin"

# WORKAROUND: Autoload compinit for autocomplete plugins to work
# autoload -U compinit && compinit

0 comments on commit c7c5d4c

Please sign in to comment.