diff --git a/kubernetes/banano/cron.yaml b/kubernetes/banano/cron.yaml new file mode 100644 index 0000000..dc446c2 --- /dev/null +++ b/kubernetes/banano/cron.yaml @@ -0,0 +1,36 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: receive-all-banano + namespace: pippin +spec: + schedule: "*/10 * * * *" + concurrencyPolicy: Forbid + successfulJobsHistoryLimit: 1 + failedJobsHistoryLimit: 1 + jobTemplate: + spec: + template: + spec: + containers: + - name: wallet-post + image: alpine:3.15 + command: ["/bin/sh", "-c"] + args: + - | + set -e + apk add --no-cache curl jq + WALLET_IDS=$(cat /etc/wallet-ids/wallet-ids) || { echo "Failed to decode base64"; exit 1; } + for wallet_id in $(echo $WALLET_IDS | jq -r '.[]'); do + echo "Processing wallet ID: $wallet_id" + curl -sS -X POST -H "Content-Type: application/json" -d '{"action":"receive_all","wallet":"'$wallet_id'"}' pippin-banano.pippin:11338 || { echo "Failed to make POST request for wallet ID: $wallet_id"; exit 1; } + done + volumeMounts: + - name: wallet-ids + mountPath: /etc/wallet-ids + readOnly: true + restartPolicy: OnFailure + volumes: + - name: wallet-ids + secret: + secretName: wallet-ids-banano diff --git a/kubernetes/banano/secret.md b/kubernetes/banano/secret.md new file mode 100644 index 0000000..5921b6f --- /dev/null +++ b/kubernetes/banano/secret.md @@ -0,0 +1,12 @@ +// B64 encode wallet IDs +echo -n '["id", "id2"]' | base64 + +// Secret +apiVersion: v1 +kind: Secret +metadata: +name: wallet-ids-banano +namespace: pippin +type: Opaque +data: +wallet-ids: b64encoded diff --git a/kubernetes/nano/cron.yaml b/kubernetes/nano/cron.yaml new file mode 100644 index 0000000..04b2577 --- /dev/null +++ b/kubernetes/nano/cron.yaml @@ -0,0 +1,36 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: receive-all-nano + namespace: pippin +spec: + schedule: "*/10 * * * *" + concurrencyPolicy: Forbid + successfulJobsHistoryLimit: 1 + failedJobsHistoryLimit: 1 + jobTemplate: + spec: + template: + spec: + containers: + - name: wallet-post + image: alpine:3.15 + command: ["/bin/sh", "-c"] + args: + - | + set -e + apk add --no-cache curl jq + WALLET_IDS=$(cat /etc/wallet-ids/wallet-ids) || { echo "Failed to decode base64"; exit 1; } + for wallet_id in $(echo $WALLET_IDS | jq -r '.[]'); do + echo "Processing wallet ID: $wallet_id" + curl -sS -X POST -H "Content-Type: application/json" -d '{"action":"receive_all","wallet":"'$wallet_id'"}' pippin-nano.pippin:11338 || { echo "Failed to make POST request for wallet ID: $wallet_id"; exit 1; } + done + volumeMounts: + - name: wallet-ids + mountPath: /etc/wallet-ids + readOnly: true + restartPolicy: OnFailure + volumes: + - name: wallet-ids + secret: + secretName: wallet-ids-nano