From 2f59a038c86f08c1c0611f79a59e2a63166a7eb8 Mon Sep 17 00:00:00 2001 From: Olivier Grand Date: Mon, 4 Dec 2023 10:04:04 +0100 Subject: [PATCH] fix aliases --- tools/bash_aliases | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tools/bash_aliases b/tools/bash_aliases index 68ee8f0..6c74d3f 100644 --- a/tools/bash_aliases +++ b/tools/bash_aliases @@ -8,29 +8,19 @@ alias pull='git pull --rebase ; git fetch --prune' alias push='git pull --rebase ; git fetch --prune ; git push' alias status='git status' -#--- Cli aliases +#--- Bosh clis 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' -alias check-k8s='/usr/local/bin/check-k8s.sh' alias clean-prometheus-tasks='for var in $(bosh tasks | grep "prometheus" | grep -E "queued|processing" | sed -e "s+\t.*++g") ; do bosh cancel-task $var ; done' alias credhub-get='function __cg() { index=$2 ; log-credhub -i ; credhub get -n $1 --versions=$(($index + 1)) -j | jq -r .versions[$index].value; }; __cg' alias fly='fly -t concourse' -alias get-minio-token='kctx core-connectivity ; kubectl -n 60-minio-operator get secret $(kubectl -n 60-minio-operator get serviceaccount console-sa -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}" | base64 --decode' alias hm-bosh-tasks="bosh tasks -a -r=20000 --json | jq -r '.Tables[].Rows[]|select(.user == \"hm\")|.started_at + \" \" + .id + \" \" + .description + \" \" + .deployment + \" => \" + .result'" -alias k='/usr/local/bin/kubectl' -alias kctx='/usr/local/bin/kubectx' -alias kns='/usr/local/bin/kubens' -alias kube-tail='/usr/local/bin/kube-tail.sh' -alias kt='kube-tail' -alias k9s='if [ -f ${K9SCONFIG}/config.yml ] ; then sed -i "s+logoless:.*+logoless: true+" ${K9SCONFIG}/config.yml ; fi ; k9s' -alias k9s-screen='/usr/local/bin/k9s-screen.sh' alias log-bosh='. /usr/local/bin/log-bosh.sh' 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-k8s='. /usr/local/bin/log-k8s.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' @@ -38,6 +28,19 @@ alias os='openstack' alias prune-workers='fly prune-worker -a' alias recreate-workers='bosh -d concourse recreate worker --canaries=0 --max-in-flight=10' alias switch='. /usr/local/bin/switch.sh' + +#--- k8s aliases +alias check-k8s='/usr/local/bin/check-k8s.sh' +alias get-minio-token='kctx core-connectivity ; kubectl -n 60-minio-operator get secret $(kubectl -n 60-minio-operator get serviceaccount console-sa -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}" | base64 --decode' +alias k='/usr/local/bin/kubectl' +alias kctx='/usr/local/bin/kubectx' +alias kns='/usr/local/bin/kubens' +alias kube-editor='. /usr/local/bin/kube-editor.sh' +alias kube-tail='/usr/local/bin/kube-tail.sh' +alias kt='kube-tail' +alias k9s='if [ -f ${K9SCONFIG}/config.yml ] ; then sed -i "s+logoless:.*+logoless: true+" ${K9SCONFIG}/config.yml ; fi ; k9s' +alias k9s-screen='/usr/local/bin/k9s-screen.sh' +alias log-k8s='. /usr/local/bin/log-k8s.sh' alias testkube='function __tk() { cmd="$1" ; params="$@" ; if [ "${cmd}" = "get" ] || [ "${cmd}" = "g" ] ; then flag="--label kusto=$(kubectl ns -c)" ; else flag="" ; fi ; tk ${params} ${flag} ; }; __tk' alias tk='testkube' @@ -51,7 +54,6 @@ alias dsh='function __dsh() { docker exec -it $1 sh; }; __dsh' alias diff='colordiff' alias f='function __f() { printf "%100s\n"|tr " " "=";find . ! -regex ".*[/]\.git[/]?.*" ! -regex ".*last-deployment-failure\.yml" -type f,l -not -xtype l -not -xtype d -print0 | xargs -0 grep -I -i --color "$1";unset -f __f;printf "%100s\n"|tr " " "="; }; __f' alias generate-password='apg -MCLN -n 1 -m 30' -alias kube-editor='. /usr/local/bin/kube-editor.sh' alias ps1-clear='unset BOSH_TARGET ; unset K8S_CONTEXT' alias proxy='. /usr/local/bin/proxy.sh' alias show-cert='function __scrt() { openssl x509 -text -certopt no_header,no_version,no_signame,no_pubkey,no_sigdump -nocert -in $1; }; __scrt'