42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
|
apiVersion: batch/v1
|
||
|
kind: CronJob
|
||
|
metadata:
|
||
|
annotations:
|
||
|
kubenix/k8s-version: "1.30"
|
||
|
kubenix/project-name: kubenix
|
||
|
labels:
|
||
|
kubenix/hash: e672eb08bf0db5ef675b3b6036ca047f43b4614f
|
||
|
name: piped-refresh
|
||
|
namespace: piped
|
||
|
spec:
|
||
|
jobTemplate:
|
||
|
spec:
|
||
|
template:
|
||
|
spec:
|
||
|
containers:
|
||
|
- command:
|
||
|
- /bin/bash
|
||
|
- -c
|
||
|
- >
|
||
|
apt update && apt install -y postgresql-client curl
|
||
|
|
||
|
curl -o /dev/null "https://healthchecks.gmem.ca/ping/$HEALTHCHECKS_UUID/start"
|
||
|
|
||
|
export PGPASSWORD=$password &&
|
||
|
|
||
|
export subs=$(psql -U piped -h 192.168.50.236 -qtAX -c 'select id from public.pubsub;') &&
|
||
|
|
||
|
while IFS= read -r line; do
|
||
|
echo "refreshing $line"
|
||
|
curl -k -o /dev/null "http://piped-backend:8080/channel/$line"
|
||
|
done < <(printf '%s' "$subs")
|
||
|
|
||
|
curl -o /dev/null "https://healthchecks.gmem.ca/ping/$HEALTHCHECKS_UUID"
|
||
|
envFrom:
|
||
|
- secretRef:
|
||
|
name: postgres-piped
|
||
|
image: debian:bookworm-slim
|
||
|
name: refresh-subscriptions
|
||
|
restartPolicy: Never
|
||
|
schedule: "*/30 * * * *"
|