Skip to content

Commit

Permalink
fix log-k8s, add completion for tfctl and refine credhub-get alias wi…
Browse files Browse the repository at this point in the history
…th version selection
  • Loading branch information
ogrand committed Feb 20, 2023
1 parent bf7e15a commit 630ebb3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bosh-cli/bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ alias bosh-depls-failed="bosh is --json | jq -r '.Tables[].Rows[]|select(.proces
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 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() { log-credhub -i ; credhub get -n $1 -j | jq .value -r; }; __cg'
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 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'
Expand Down
5 changes: 4 additions & 1 deletion bosh-cli/bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ echo -en "\033]0;${MY_BOSH_USER}@${SITE_NAME}\007"
export GREP_COLORS="fn=1;34:se=1;34:mt=1;33"

#--- bosh cli completion
eval "$(/home/bosh/bosh-complete-linux bash-source)"
source <(/home/bosh/bosh-complete-linux bash-source)

#--- tfctl cli completion
source <(tfctl completion bash)

#--- kubectl plugin completion
source <(kubectl get-all completion bash | sed -e "s+ get-all$+ kubectl-get_all+g")
Expand Down
4 changes: 2 additions & 2 deletions bosh-cli/log-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ if [ ${flagError} = 0 ] ; then
fi
fi

export KUBECONFIG="${HOME}/.kube/config"
if [ ${flagError} = 0 ] ; then
#--- Connect to cluster
if [ "${K8S_TYPE_CLUSTER}" = "openshift" ] ; then
Expand Down Expand Up @@ -197,8 +198,7 @@ if [ ${flagError} = 0 ] ; then
fi

if [ ${flagError} = 0 ] ; then
printf "\n\n%bCluster \"${K8S_CONTEXT}\" available.%b\n" "${YELLOW}${REVERSE}" "${STD}"
export KUBECONFIG="${HOME}/.kube/config"
printf "\n%bCluster \"${K8S_CONTEXT}\" available.%b\n" "${YELLOW}${REVERSE}" "${STD}"
fi
fi
fi

0 comments on commit 630ebb3

Please sign in to comment.