config/shell/server/stack: new users and kube subcommands

This commit is contained in:
xeruf 2022-07-18 11:57:43 +01:00
parent e86bd6e2b6
commit cbd167e083
2 changed files with 24 additions and 9 deletions

View File

@ -38,6 +38,13 @@ stack() {
;; ;;
(sso) builtin cd "$STACKSPIN" (sso) builtin cd "$STACKSPIN"
"$0" exec dashboard --container backend -- flask "$@";; "$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) (user|app)
if test "$1" = "init" if test "$1" = "init"
then mail="$2" then mail="$2"
@ -49,21 +56,24 @@ stack() {
fi;; fi;;
# app clis via kubectl # app clis via kubectl
(occ) "$0" exec nc-nextcloud -it -- su www-data -s /bin/bash -c "php $command $*";; (occ) "$0" exec nc-nextcloud -it -- su www-data -s /bin/bash -c "php $command $*";;
(exec) (exec) "$0" kube exec "$@";;
if ! pod=$("$0" pod "$1-\(0\|[0-f]\+\)") (kube)
then echo "No pod found for $1" >&2 if ! pod=$("$0" pod "$2-\(0\|[0-f]\+\)")
then echo "No pod found for $2" >&2
return 1 return 1
fi fi
shift local subcommand=$1
kubectl exec -n $(echo $pod) "$@";; shift 2
kubectl "$subcommand" -n $(echo $pod) "$@";;
(pod) (pod)
local podname=$1 local podname=$1
shift 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";; 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) (push)
git commit -a git commit -a "$@"
git push git push &&
flux reconcile source git -n flux-system "$(basename $(git rev-parse --show-toplevel))";; 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 # stackspin bare
(*) if which "$0-$command" >/dev/null 2>&1 (*) if which "$0-$command" >/dev/null 2>&1
then "$0-$command" "$@" then "$0-$command" "$@"

View File

@ -61,7 +61,6 @@ spec:
EOF EOF
cat <<EOF >$app-values-configmap.yaml cat <<EOF >$app-values-configmap.yaml
---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
@ -71,6 +70,12 @@ data:
values.yaml: | values.yaml: |
# TODO verify structure matches chart # TODO verify structure matches chart
ingress: ingress:
enabled: true
# Bitnami style
hostname: "$subdomain.\${domain}"
tls: true
certManager: true
# Gitea style
enabled: true enabled: true
annotations: annotations:
kubernetes.io/tls-acme: "true" kubernetes.io/tls-acme: "true"