From cbd167e0835e70bd88d1cf550450b7eddb039bbe Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 18 Jul 2022 11:57:43 +0100 Subject: [PATCH] config/shell/server/stack: new users and kube subcommands --- .config/shell/server | 26 +++++++++++++------ .local/bin/{scripts => server}/stack-template | 7 ++++- 2 files changed, 24 insertions(+), 9 deletions(-) rename .local/bin/{scripts => server}/stack-template (93%) diff --git a/.config/shell/server b/.config/shell/server index a0b2d9e..3c80513 100644 --- a/.config/shell/server +++ b/.config/shell/server @@ -38,6 +38,13 @@ stack() { ;; (sso) builtin cd "$STACKSPIN" "$0" exec dashboard --container backend -- flask "$@";; + (users) + if test $# -gt 0 + then for arg + do "$0" user show $arg + done + else "$0" users $("$0" user list | sed 's|.*<\(.*\)>.*|\1|') + fi;; (user|app) if test "$1" = "init" then mail="$2" @@ -49,21 +56,24 @@ stack() { fi;; # app clis via kubectl (occ) "$0" exec nc-nextcloud -it -- su www-data -s /bin/bash -c "php $command $*";; - (exec) - if ! pod=$("$0" pod "$1-\(0\|[0-f]\+\)") - then echo "No pod found for $1" >&2 + (exec) "$0" kube exec "$@";; + (kube) + if ! pod=$("$0" pod "$2-\(0\|[0-f]\+\)") + then echo "No pod found for $2" >&2 return 1 fi - shift - kubectl exec -n $(echo $pod) "$@";; + local subcommand=$1 + shift 2 + kubectl "$subcommand" -n $(echo $pod) "$@";; (pod) local podname=$1 shift kubectl get pods --all-namespaces --field-selector="status.phase=Running" -o=custom-columns=S:.metadata.namespace,N:.metadata.name --no-headers "$@" | grep --color=never "$podname";; (push) - git commit -a - git push - flux reconcile source git -n flux-system "$(basename $(git rev-parse --show-toplevel))";; + git commit -a "$@" + git push && + flux reconcile source git -n flux-system "$(basename $(git rev-parse --show-toplevel))" + flux reconcile kustomization -n flux-system "$(basename $(git rev-parse --show-toplevel))";; # stackspin bare (*) if which "$0-$command" >/dev/null 2>&1 then "$0-$command" "$@" diff --git a/.local/bin/scripts/stack-template b/.local/bin/server/stack-template similarity index 93% rename from .local/bin/scripts/stack-template rename to .local/bin/server/stack-template index 335996e..5362b4a 100755 --- a/.local/bin/scripts/stack-template +++ b/.local/bin/server/stack-template @@ -61,7 +61,6 @@ spec: EOF cat <$app-values-configmap.yaml ---- apiVersion: v1 kind: ConfigMap metadata: @@ -71,6 +70,12 @@ data: values.yaml: | # TODO verify structure matches chart ingress: + enabled: true + # Bitnami style + hostname: "$subdomain.\${domain}" + tls: true + certManager: true + # Gitea style enabled: true annotations: kubernetes.io/tls-acme: "true"