-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |