config/shell/server/stack: add maria command

This commit is contained in:
xeruf 2022-11-21 11:36:20 +00:00
parent 268f533e9a
commit 3817c2ab7d
1 changed files with 5 additions and 1 deletions

View File

@ -78,6 +78,8 @@ stack() {
(*) echo "Unknown Subcommand";;
esac
;;
(maria) app=$1
"$0" exec $app-mariadb -it -- env "MYSQL_PWD=$(kubectl get secret -n flux-system stackspin-$app-variables --template '{{.data.mariadb_password}}' | base64 -d)" mysql -u $app "$@";;
# high-level
(shell)
container=$1
@ -96,7 +98,9 @@ stack() {
kubectl cp "$2" -n $("$0" pod "$1$pod_suffix"):$2 "${@:3}"
"$0" ls "$1" "${@:3}";;
(exec) "$0" kube exec "$@";;
(logs) "$0" kube logs "$@" | $(command which lnav || { which bat >/dev/null && echo "bat --number -l toml" } || echo 'less -RF');;
(logs) podname=$1
shift
"$0" kube logs "$podname" | $(command which lnav || { which bat >/dev/null && echo "bat --number -l toml" } || echo 'less -RF') "$@";;
# low-level
(kube)
test $# -gt 1 || { echo "Please provide a command and pod name" >&2 && return 1; }