chore: Update manifests after change
This commit is contained in:
@@ -9,20 +9,50 @@ metadata:
|
|||||||
app.kubernetes.io/part-of: qbittorrent
|
app.kubernetes.io/part-of: qbittorrent
|
||||||
data:
|
data:
|
||||||
update.sh: |
|
update.sh: |
|
||||||
|
API_ENDPOINT="http://localhost:8080/api/v2";
|
||||||
|
MAX_RETRIES=5
|
||||||
|
SUCCESS=false
|
||||||
|
|
||||||
|
for ((i=1; i<=$MAX_RETRIES; i++)); do
|
||||||
|
if apk update --short &> /dev/null; then
|
||||||
|
echo ">> Attempt $i: Repositories are reachable"
|
||||||
|
SUCCESS=true
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo ">> Attempt $i: Connection failed, retrying in 5 seconds ..."
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$SUCCESS" = false ]; then
|
||||||
|
echo ">> ERROR: Could not connect to apk repositories after $MAX_RETRIES attempts, exiting ..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if ! command -v curl 2>&1 >/dev/null
|
if ! command -v curl 2>&1 >/dev/null
|
||||||
then
|
then
|
||||||
echo "curl could not be found, installing";
|
echo "curl could not be found, installing";
|
||||||
apk add curl;
|
apk add --no-cache curl;
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo ">> Installation successful"
|
||||||
|
else
|
||||||
|
echo ">> Installation failed with exit code $?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
if ! command -v jq 2>&1 >/dev/null
|
if ! command -v jq 2>&1 >/dev/null
|
||||||
then
|
then
|
||||||
echo "jq could not be found, installing";
|
echo "jq could not be found, installing";
|
||||||
apk add jq;
|
apk add --no-cache jq;
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo ">> Installation successful"
|
||||||
|
else
|
||||||
|
echo ">> Installation failed with exit code $?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
API_ENDPOINT="http://localhost:8080/api/v2";
|
|
||||||
|
|
||||||
# echo " ";
|
# echo " ";
|
||||||
# echo ">> Authentication ...";
|
# echo ">> Authentication ...";
|
||||||
# curl -i --silent --header 'Referer: http://localhost:8080' --output response_body_auth.json --data 'username=admin&password=adminadmin' "${API_ENDPOINT}/auth/login" -c cookie;
|
# curl -i --silent --header 'Referer: http://localhost:8080' --output response_body_auth.json --data 'username=admin&password=adminadmin' "${API_ENDPOINT}/auth/login" -c cookie;
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: vault-snapshot-script
|
||||||
|
namespace: vault
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: vault-snapshot-script
|
||||||
|
app.kubernetes.io/instance: vault
|
||||||
|
app.kubernetes.io/part-of: vault
|
||||||
|
data:
|
||||||
|
update.sh: |
|
||||||
|
BACKUP_FOLDER=/opt/backup
|
||||||
|
BACKUP_FILE=$(ls -t $BACKUP_FOLDER | head -n 1)
|
||||||
|
|
||||||
|
echo " ";
|
||||||
|
echo ">> Running S3 backup for Vault snapshot";
|
||||||
|
|
||||||
|
if s3cmd put --no-check-md5 --no-check-certificate -v "$BACKUP_FOLDER/$BACKUP_FILE" "${BUCKET}/cl01tl/cl01tl-vault-snapshots/$BACKUP_FILE"; then
|
||||||
|
echo ">> Upload succeeded"
|
||||||
|
else
|
||||||
|
echo ">> ERROR: Upload failed"
|
||||||
|
fi
|
||||||
@@ -39,14 +39,7 @@ spec:
|
|||||||
initContainers:
|
initContainers:
|
||||||
- args:
|
- args:
|
||||||
- -ec
|
- -ec
|
||||||
- |
|
- /scripts/snapshot.sh
|
||||||
apk add --no-cache jq;
|
|
||||||
echo ">> Running Vault snapshot"
|
|
||||||
export VAULT_TOKEN=$(vault write auth/approle/login role_id=$VAULT_APPROLE_ROLE_ID secret_id=$VAULT_APPROLE_SECRET_ID -format=json | jq -r .auth.client_token);
|
|
||||||
vault operator raft snapshot save /opt/backup/vault-snapshot-latest.snap;
|
|
||||||
cp /opt/backup/vault-snapshot-latest.snap /opt/backup/vault-snapshot-$(date +"%Y%m%d-%H-%M").snap;
|
|
||||||
cp /opt/backup/vault-snapshot-latest.snap /opt/backup/vault-snapshot-s3.snap;
|
|
||||||
echo ">> Completed Vault snapshot"
|
|
||||||
command:
|
command:
|
||||||
- /bin/ash
|
- /bin/ash
|
||||||
env:
|
env:
|
||||||
@@ -58,21 +51,16 @@ spec:
|
|||||||
image: hashicorp/vault:1.21.1
|
image: hashicorp/vault:1.21.1
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
name: snapshot
|
name: snapshot
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 10m
|
|
||||||
memory: 64Mi
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /opt/backup
|
- mountPath: /opt/backup
|
||||||
name: config
|
name: backup
|
||||||
|
- mountPath: /scripts/snapshot.sh
|
||||||
|
name: snapshot-script
|
||||||
|
subPath: snapshot.sh
|
||||||
containers:
|
containers:
|
||||||
- args:
|
- args:
|
||||||
- -ec
|
- -ec
|
||||||
- |
|
- /scripts/backup.sh
|
||||||
echo ">> Running S3 backup for Vault snapshot"
|
|
||||||
s3cmd put --no-check-md5 --no-check-certificate -v /opt/backup/vault-snapshot-s3.snap ${BUCKET}/cl01tl/cl01tl-vault-snapshots/vault-snapshot-$(date +"%Y%m%d-%H-%M").snap;
|
|
||||||
rm -f /opt/backup/vault-snapshot-s3.snap;
|
|
||||||
echo ">> Completed S3 backup for Vault snapshot"
|
|
||||||
command:
|
command:
|
||||||
- /bin/sh
|
- /bin/sh
|
||||||
env:
|
env:
|
||||||
@@ -80,26 +68,89 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
key: BUCKET
|
key: BUCKET
|
||||||
name: vault-s3cmd-config
|
name: vault-s3cmd-external-config
|
||||||
image: d3fk/s3cmd:latest@sha256:ed348a0fae5723d2e62636c175baf4dfaf732a790179ca675d1f24f863d0d68f
|
image: d3fk/s3cmd:latest@sha256:ed348a0fae5723d2e62636c175baf4dfaf732a790179ca675d1f24f863d0d68f
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
name: s3-backup
|
name: s3-backup-external
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 128Mi
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /opt/backup
|
- mountPath: /opt/backup
|
||||||
name: config
|
name: backup
|
||||||
|
- mountPath: /scripts/backup.sh
|
||||||
|
name: backup-script
|
||||||
|
subPath: backup.sh
|
||||||
- mountPath: /root/.s3cfg
|
- mountPath: /root/.s3cfg
|
||||||
mountPropagation: None
|
mountPropagation: None
|
||||||
name: s3cmd-config
|
name: s3cmd-external-config
|
||||||
|
readOnly: true
|
||||||
|
subPath: .s3cfg
|
||||||
|
- args:
|
||||||
|
- -ec
|
||||||
|
- /scripts/backup.sh
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
env:
|
||||||
|
- name: BUCKET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: BUCKET
|
||||||
|
name: vault-s3cmd-local-config
|
||||||
|
image: d3fk/s3cmd:latest@sha256:ed348a0fae5723d2e62636c175baf4dfaf732a790179ca675d1f24f863d0d68f
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
name: s3-backup-local
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /opt/backup
|
||||||
|
name: backup
|
||||||
|
- mountPath: /scripts/backup.sh
|
||||||
|
name: backup-script
|
||||||
|
subPath: backup.sh
|
||||||
|
- mountPath: /root/.s3cfg
|
||||||
|
mountPropagation: None
|
||||||
|
name: s3cmd-local-config
|
||||||
|
readOnly: true
|
||||||
|
subPath: .s3cfg
|
||||||
|
- args:
|
||||||
|
- -ec
|
||||||
|
- /scripts/backup.sh
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
env:
|
||||||
|
- name: BUCKET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: BUCKET
|
||||||
|
name: vault-s3cmd-remote-config
|
||||||
|
image: d3fk/s3cmd:latest@sha256:ed348a0fae5723d2e62636c175baf4dfaf732a790179ca675d1f24f863d0d68f
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
name: s3-backup-remote
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /opt/backup
|
||||||
|
name: backup
|
||||||
|
- mountPath: /scripts/backup.sh
|
||||||
|
name: backup-script
|
||||||
|
subPath: backup.sh
|
||||||
|
- mountPath: /root/.s3cfg
|
||||||
|
mountPropagation: None
|
||||||
|
name: s3cmd-remote-config
|
||||||
readOnly: true
|
readOnly: true
|
||||||
subPath: .s3cfg
|
subPath: .s3cfg
|
||||||
volumes:
|
volumes:
|
||||||
- name: config
|
- name: backup
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: vault-nfs-storage-backup
|
claimName: vault-storage-backup
|
||||||
- name: s3cmd-config
|
- configMap:
|
||||||
|
defaultMode: 493
|
||||||
|
name: vault-backup-script
|
||||||
|
name: backup-script
|
||||||
|
- name: s3cmd-external-config
|
||||||
secret:
|
secret:
|
||||||
secretName: vault-s3cmd-config
|
secretName: vault-s3cmd-external-config
|
||||||
|
- name: s3cmd-local-config
|
||||||
|
secret:
|
||||||
|
secretName: vault-s3cmd-local-config
|
||||||
|
- name: s3cmd-remote-config
|
||||||
|
secret:
|
||||||
|
secretName: vault-s3cmd-remote-config
|
||||||
|
- configMap:
|
||||||
|
defaultMode: 493
|
||||||
|
name: vault-snapshot-script
|
||||||
|
name: snapshot-script
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
apiVersion: external-secrets.io/v1
|
apiVersion: external-secrets.io/v1
|
||||||
kind: ExternalSecret
|
kind: ExternalSecret
|
||||||
metadata:
|
metadata:
|
||||||
name: vault-s3cmd-config
|
name: vault-s3cmd-external-config
|
||||||
namespace: vault
|
namespace: vault
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: vault-s3cmd-config
|
app.kubernetes.io/name: vault-s3cmd-external-config
|
||||||
app.kubernetes.io/instance: vault
|
app.kubernetes.io/instance: vault
|
||||||
app.kubernetes.io/part-of: vault
|
app.kubernetes.io/part-of: vault
|
||||||
spec:
|
spec:
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
apiVersion: external-secrets.io/v1
|
||||||
|
kind: ExternalSecret
|
||||||
|
metadata:
|
||||||
|
name: vault-s3cmd-local-config
|
||||||
|
namespace: vault
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: vault-s3cmd-local-config
|
||||||
|
app.kubernetes.io/instance: vault
|
||||||
|
app.kubernetes.io/part-of: vault
|
||||||
|
spec:
|
||||||
|
secretStoreRef:
|
||||||
|
kind: ClusterSecretStore
|
||||||
|
name: vault
|
||||||
|
data:
|
||||||
|
- secretKey: .s3cfg
|
||||||
|
remoteRef:
|
||||||
|
conversionStrategy: Default
|
||||||
|
decodingStrategy: None
|
||||||
|
key: /garage/home-infra/vault-backups
|
||||||
|
metadataPolicy: None
|
||||||
|
property: s3cfg-local
|
||||||
|
- secretKey: BUCKET
|
||||||
|
remoteRef:
|
||||||
|
conversionStrategy: Default
|
||||||
|
decodingStrategy: None
|
||||||
|
key: /garage/home-infra/vault-backups
|
||||||
|
metadataPolicy: None
|
||||||
|
property: BUCKET
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
apiVersion: external-secrets.io/v1
|
||||||
|
kind: ExternalSecret
|
||||||
|
metadata:
|
||||||
|
name: vault-s3cmd-remote-config
|
||||||
|
namespace: vault
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: vault-s3cmd-remote-config
|
||||||
|
app.kubernetes.io/instance: vault
|
||||||
|
app.kubernetes.io/part-of: vault
|
||||||
|
spec:
|
||||||
|
secretStoreRef:
|
||||||
|
kind: ClusterSecretStore
|
||||||
|
name: vault
|
||||||
|
data:
|
||||||
|
- secretKey: .s3cfg
|
||||||
|
remoteRef:
|
||||||
|
conversionStrategy: Default
|
||||||
|
decodingStrategy: None
|
||||||
|
key: /garage/home-infra/vault-backups
|
||||||
|
metadataPolicy: None
|
||||||
|
property: s3cfg-remote
|
||||||
|
- secretKey: BUCKET
|
||||||
|
remoteRef:
|
||||||
|
conversionStrategy: Default
|
||||||
|
decodingStrategy: None
|
||||||
|
key: /garage/home-infra/vault-backups
|
||||||
|
metadataPolicy: None
|
||||||
|
property: BUCKET
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: vault-storage-backup
|
||||||
|
namespace: vault
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: vault-storage-backup
|
||||||
|
app.kubernetes.io/instance: vault
|
||||||
|
app.kubernetes.io/part-of: vault
|
||||||
|
spec:
|
||||||
|
volumeMode: Filesystem
|
||||||
|
storageClassName: ceph-filesystem
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
@@ -34,11 +34,17 @@ spec:
|
|||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /opt/backups/
|
- mountPath: /opt/backups-old/
|
||||||
name: vault-nfs-storage-backup
|
name: vault-nfs-storage-backup
|
||||||
|
readOnly: true
|
||||||
|
- mountPath: /opt/backups/
|
||||||
|
name: vault-storage-backup
|
||||||
readOnly: false
|
readOnly: false
|
||||||
volumes:
|
volumes:
|
||||||
- name: vault-nfs-storage-backup
|
- name: vault-nfs-storage-backup
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: vault-nfs-storage-backup
|
claimName: vault-nfs-storage-backup
|
||||||
|
- name: vault-nfs-storage-backup
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: vault-nfs-storage-backup
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ spec:
|
|||||||
- name: vault-nfs-storage-backup
|
- name: vault-nfs-storage-backup
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: vault-nfs-storage-backup
|
claimName: vault-nfs-storage-backup
|
||||||
|
- name: vault-nfs-storage-backup
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: vault-nfs-storage-backup
|
||||||
- name: home
|
- name: home
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
containers:
|
containers:
|
||||||
@@ -110,8 +113,11 @@ spec:
|
|||||||
mountPath: /vault/data
|
mountPath: /vault/data
|
||||||
- name: config
|
- name: config
|
||||||
mountPath: /vault/config
|
mountPath: /vault/config
|
||||||
- mountPath: /opt/backups/
|
- mountPath: /opt/backups-old/
|
||||||
name: vault-nfs-storage-backup
|
name: vault-nfs-storage-backup
|
||||||
|
readOnly: true
|
||||||
|
- mountPath: /opt/backups/
|
||||||
|
name: vault-storage-backup
|
||||||
readOnly: false
|
readOnly: false
|
||||||
- name: home
|
- name: home
|
||||||
mountPath: /home/vault
|
mountPath: /home/vault
|
||||||
|
|||||||
Reference in New Issue
Block a user