comms(mas): debug admin secret ensure job
This commit is contained in:
parent
9d979a69fe
commit
ae335fcff2
@ -33,14 +33,14 @@ subjects:
|
|||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: Job
|
kind: Job
|
||||||
metadata:
|
metadata:
|
||||||
name: mas-admin-client-secret-ensure-4
|
name: mas-admin-client-secret-ensure-5
|
||||||
namespace: comms
|
namespace: comms
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: 2
|
backoffLimit: 0
|
||||||
template:
|
template:
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: mas-admin-client-secret-writer
|
serviceAccountName: mas-admin-client-secret-writer
|
||||||
restartPolicy: OnFailure
|
restartPolicy: Never
|
||||||
volumes:
|
volumes:
|
||||||
- name: work
|
- name: work
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
@ -50,7 +50,7 @@ spec:
|
|||||||
command: ["/bin/sh", "-c"]
|
command: ["/bin/sh", "-c"]
|
||||||
args:
|
args:
|
||||||
- |
|
- |
|
||||||
set -eu
|
set -euo pipefail
|
||||||
umask 077
|
umask 077
|
||||||
dd if=/dev/urandom bs=32 count=1 2>/dev/null | od -An -tx1 | tr -d ' \n' > /work/client_secret
|
dd if=/dev/urandom bs=32 count=1 2>/dev/null | od -An -tx1 | tr -d ' \n' > /work/client_secret
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@ -62,12 +62,12 @@ spec:
|
|||||||
command: ["/bin/sh", "-c"]
|
command: ["/bin/sh", "-c"]
|
||||||
args:
|
args:
|
||||||
- |
|
- |
|
||||||
set -eu
|
set -euo pipefail
|
||||||
if [ -n "$(kubectl -n comms get secret mas-admin-client -o jsonpath='{.data.client_secret}' 2>/dev/null || true)" ]; then
|
if kubectl -n comms get secret mas-admin-client -o jsonpath='{.data.client_secret}' 2>/dev/null | grep -q .; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
secret="$(cat /work/client_secret)"
|
secret_b64="$(base64 /work/client_secret | tr -d '\n')"
|
||||||
payload="$(printf '{"stringData":{"client_secret":"%s"}}' "${secret}")"
|
payload="$(printf '{"data":{"client_secret":"%s"}}' "${secret_b64}")"
|
||||||
kubectl -n comms patch secret mas-admin-client --type=merge -p "${payload}" >/dev/null
|
kubectl -n comms patch secret mas-admin-client --type=merge -p "${payload}" >/dev/null
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: work
|
- name: work
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user