Add/fix namespace scripts to handle docker pull secrets and linkerd

This commit is contained in:
Jonas Juselius
2020-11-26 12:43:55 +01:00
parent 0cfa46d725
commit f77ddbbb70
4 changed files with 105 additions and 49 deletions

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
TOP="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
if [ $# != 2 ]; then
echo "usage: inject-sa-pull-secrets.sh {namespace} {all|serviceaccount}"
exit 1
fi
namespace=$1
sa=$2
inject () {
kubectl patch serviceaccount $1 \
-n $namespace \
-p "{\"imagePullSecrets\": [ \
{\"name\": \"docker-pull-secret\"}, \
{\"name\": \"gitlab-pull-secret\"} \
]}"
}
if [ $sa = all ]; then
for i in $(kubectl get sa -n $namespace | sed '1d;s/\([^ ]\+\).*/\1/'); do
inject $i
done
else
inject $sa
fi