k8s/secrets/test.yaml

52 lines
1.6 KiB
YAML
Raw Normal View History

2026-03-19 08:13:29 +00:00
apiVersion: batch/v1
kind: Job
metadata:
name: contabo-test
namespace: backups
2026-03-19 08:13:29 +00:00
spec:
backoffLimit: 0
2026-03-19 08:13:29 +00:00
template:
spec:
restartPolicy: Never
containers:
- name: s3-test
image: amazon/aws-cli:2.17.37
2026-03-19 08:13:29 +00:00
command:
- /bin/sh
- -ec
2026-03-19 08:13:29 +00:00
- |
test -n "$AWS_ACCESS_KEY_ID"
test -n "$AWS_SECRET_ACCESS_KEY"
test -n "$CONTABO_ENDPOINT"
test -n "$CONTABO_BUCKET"
2026-03-19 08:13:29 +00:00
TS="$(date +%s)"
KEY="k8s-contabo-test/${TS}.txt"
BODY="contabo write test from ${HOSTNAME} at ${TS}"
2026-03-19 08:13:29 +00:00
printf '%s\n' "$BODY" > /tmp/test.txt
aws --endpoint-url "$CONTABO_ENDPOINT" s3 cp /tmp/test.txt "s3://$CONTABO_BUCKET/$KEY"
aws --endpoint-url "$CONTABO_ENDPOINT" s3 cp "s3://$CONTABO_BUCKET/$KEY" /tmp/test-read.txt
grep -F "$BODY" /tmp/test-read.txt
aws --endpoint-url "$CONTABO_ENDPOINT" s3 rm "s3://$CONTABO_BUCKET/$KEY"
echo "Contabo object storage write/read/delete test passed."
2026-03-19 08:13:29 +00:00
env:
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: contabo-s3-creds
key: AWS_ACCESS_KEY_ID
- name: AWS_SECRET_ACCESS_KEY
2026-03-19 08:13:29 +00:00
valueFrom:
secretKeyRef:
name: contabo-s3-creds
key: AWS_SECRET_ACCESS_KEY
- name: CONTABO_ENDPOINT
value: "https://eu2.contabostorage.com"
- name: CONTABO_BUCKET
value: "test"
- name: AWS_DEFAULT_REGION
value: "us-east-1"