Skip to content

Commit

Permalink
add kubectl/k9s plugins blame and lineage
Browse files Browse the repository at this point in the history
  • Loading branch information
ogrand committed Sep 13, 2024
1 parent b13c9a2 commit a4a4d3c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ ENV ARGO_VERSION="3.5.10" \

#--- Packages list, ruby env and plugins
ENV INIT_PACKAGES="apt-transport-https ca-certificates curl openssh-server openssl sudo unzip wget" \
TOOLS_PACKAGES="apg bash-completion colordiff git-core gawk gnupg htop ldapscripts ldap-utils libldap-common less locales psmisc python3-tabulate python3-openstackclient s3cmd silversearcher-ag supervisor tinyproxy tmux yarnpkg vim whois" \
TOOLS_PACKAGES="apg bash-completion colordiff git-core gawk gnupg htop ldapscripts ldap-utils libldap-common less locales psmisc s3cmd silversearcher-ag supervisor tinyproxy tmux yarnpkg vim whois" \
NET_PACKAGES="dnsutils iproute2 iputils-ping iputils-tracepath traceroute tcptraceroute mtr-tiny netbase netcat net-tools tcpdump iperf3" \
DEV_PACKAGES="build-essential libc6-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev libpq-dev libsqlite3-dev libmysqlclient-dev zlib1g-dev libcurl4-openssl-dev" \
RUBY_PACKAGES="g++ gcc autoconf automake bison libtool libgdbm-dev libncurses5-dev libyaml-dev pkg-config sqlite3 libgmp-dev libreadline6-dev" \
PATH="/usr/local/rvm/gems/ruby-${RUBY_VERSION}/bin:/usr/local/rvm/gems/ruby-${RUBY_VERSION}@global/bin:/usr/local/rvm/rubies/ruby-${RUBY_VERSION}/bin:${PATH}" \
GEM_HOME="/usr/local/rvm/gems/ruby-${RUBY_VERSION}" \
GEM_PATH="/usr/local/rvm/gems/ruby-${RUBY_VERSION}:/usr/local/rvm/gems/ruby-${RUBY_VERSION}@global" \
CF_PLUGINS="CLI-Recorder,doctor,manifest-generator,Statistics,Targets,Usage Report" \
KUBECTL_PLUGINS="cnpg,ctx,foreach,gadget,get-all,ns,kuttl,who-can" \
KUBECTL_PLUGINS="blame,cnpg,ctx,foreach,gadget,get-all,lineage,ns,kuttl,who-can" \
OS_ARCH_AMD="amd64" \
OS_ARCH_X86_64="x86_64"

Expand Down
38 changes: 20 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,24 +268,25 @@ To log into first container (replace docker.bosh.release.deployment with IP or d
|`<z>` | zorg | | |
<BR>

|Shortcut |Description |Scope | Plugin |
|---------------|---------------------|---------------------------------------|--------|
|`<ctrl-a>` | Aliases | | |
|`<ctrl-b>` | Page Up | | |
|`<ctrl-d>` | Delete | | |
|`<ctrl-e>` | Toggle Header | | |
|`<ctrl-f>` | Page Down | | |
|`<ctrl-g>` | Toggle Crumbs | | |
|`<ctrl-k>` | Kill | | |
|`<ctrl-l>` | Display logs | deployment, daemonset, pod, container | X |
|`<ctrl-q>` | Sort MEM/L | | |
|`<ctrl-r>` | Refresh/Reload | | |
|`<ctrl-s>` | Save | | |
|`<ctrl-u>` | Command Clear | | |
|`<ctrl-w>` | Toggle Wide | | |
|`<ctrl-x>` | Sort CPU/L | | |
|`<ctrl-\>` | Mark Clear | | |
|`<ctrl-space>` | Mark Range | | |
|Shortcut |Description |Scope | Plugin |
|---------------|----------------------|---------------------------------------|--------|
|`<ctrl-a>` | Aliases | | |
|`<ctrl-b>` | Page Up | | |
|`<ctrl-d>` | Delete | | |
|`<ctrl-e>` | Toggle Header | | |
|`<ctrl-f>` | Page Down | | |
|`<ctrl-g>` | Toggle Crumbs | | |
|`<ctrl-j>` | Display dependencies | | X |
|`<ctrl-k>` | Kill | | |
|`<ctrl-l>` | Display logs | deployment, daemonset, pod, container | X |
|`<ctrl-q>` | Sort MEM/L | | |
|`<ctrl-r>` | Refresh/Reload | | |
|`<ctrl-s>` | Save | | |
|`<ctrl-u>` | Command Clear | | |
|`<ctrl-w>` | Toggle Wide | | |
|`<ctrl-x>` | Sort CPU/L | | |
|`<ctrl-\>` | Mark Clear | | |
|`<ctrl-space>` | Mark Range | | |
<BR>

|Shortcut |Description |Scope | Plugin |
Expand All @@ -309,6 +310,7 @@ To log into first container (replace docker.bosh.release.deployment with IP or d
|`<shift-n>` | Sort Name | | |
|`<shift-o>` | Sort Node | | |
|`<shift-p>` | Sort Ready | | |
|`<shift-q>` | Blame | all | X |
|`<shift-r>` | Sort Ready | | |
|`<shift-s>` | Sort Status | all | |
| | List suspended | helmreleases, kustomizations | X |
Expand Down
26 changes: 26 additions & 0 deletions tools/k9s/plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,32 @@ plugins:
background: false
confirm: false
dangerous: false
#--- Display last modified fields from managedFields
display-blame:
shortCut: Ctrl-J
description: Display blame
scopes:
- all
command: bash
args:
- -c
- kubectl blame $RESOURCE_NAME $NAME --context=$CONTEXT --namespace=$NAMESPACE |& less -KR
background: false
confirm: false
dangerous: false
#--- Display resources dependencies
display-dependencies:
shortCut: Ctrl-N
description: Display dependencies
scopes:
- all
command: bash
args:
- -c
- kubectl lineage $RESOURCE_NAME $NAME --context=$CONTEXT --namespace=$NAMESPACE |& less -KR
background: false
confirm: false
dangerous: false
#--- Display logs in raw mode from selected resource
display-logs:
shortCut: Ctrl-L
Expand Down
4 changes: 1 addition & 3 deletions tools/profiles/bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ alias pull='git pull --rebase ; git fetch --prune'
alias push='git pull --rebase ; git fetch --prune ; git push'
alias status='git status'

#--- Bosh clis aliases
#--- Bosh aliases
alias bosh-depls-failed="bosh is --json | jq -r '.Tables[].Rows[]|select(.process_state == (\"failing\",\"unresponsive agent\"))|.deployment + \" (\" + .instance + \") : \" + .process_state'"
alias bosh-events="bosh events | grep \"hm \" | grep -E \"create|delete\""
alias bosh-task='function __bt() { bosh task $1 --debug | grep -vE " BEGIN| COMMIT| SELECT |INSERT INTO|DELETE FROM| UPDATE | WHERE |Renewing lock"; }; __bt'
Expand All @@ -21,10 +21,8 @@ alias log-cf='. /usr/local/bin/log-cf.sh'
alias log-credhub='. /usr/local/bin/log-credhub.sh'
alias log-fly='. /usr/local/bin/log-fly.sh'
alias log-govc='. /usr/local/bin/log-govc.sh'
alias log-openstack='. /usr/local/bin/log-openstack.sh'
alias log-shield='. /usr/local/bin/log-shield.sh'
alias log-uaac='. /usr/local/bin/log-uaac.sh'
alias os='openstack'
alias prune-workers='fly prune-worker -a'
alias recreate-concourse-workers='bosh -d concourse recreate worker --canaries=0 --max-in-flight=10'
alias switch='. /usr/local/bin/switch-bosh.sh'
Expand Down
3 changes: 2 additions & 1 deletion tools/profiles/bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ if [ -f ${HOME}/.kube/config ] ; then
fi

#--- kubectl plugins completion
source <(kubectl gadget completion bash)
source <(kubectl get-all completion bash | sed -e "s+ get-all$+ kubectl-get_all+g")
source <(kubectl cnpg completion bash)
source <(kubectl kuttl completion bash)
source <(kubectl cnpg completion bash)

0 comments on commit a4a4d3c

Please sign in to comment.