Skip to content

Commit

Permalink
Add crons to receive all
Browse files Browse the repository at this point in the history
  • Loading branch information
bbedward committed Jul 27, 2024
1 parent 8cb51c9 commit ed01afa
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
36 changes: 36 additions & 0 deletions kubernetes/banano/cron.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions kubernetes/banano/secret.md
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions kubernetes/nano/cron.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ed01afa

Please sign in to comment.