Add/fix namespace scripts to handle docker pull secrets and linkerd
This commit is contained in:
29
scripts/inject-sa-pull-secrets.sh
Executable file
29
scripts/inject-sa-pull-secrets.sh
Executable 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
|
||||
|
||||
Reference in New Issue
Block a user