Try including date in backup name
This commit is contained in:
parent
6d338157fa
commit
b4c9947e4c
@ -43,20 +43,7 @@ spec:
|
|||||||
subPath: app-quarkus-dir
|
subPath: app-quarkus-dir
|
||||||
containers:
|
containers:
|
||||||
- args:
|
- args:
|
||||||
- /opt/bitnami/keycloak/bin/kc.sh
|
- /script/backup_keycloak.sh
|
||||||
- export
|
|
||||||
- --file
|
|
||||||
- /backup/realm-export.json
|
|
||||||
- --realm
|
|
||||||
- avril
|
|
||||||
- --db
|
|
||||||
- postgres
|
|
||||||
- --db-url
|
|
||||||
- jdbc:postgresql://keycloak-postgresql-hl/bitnami_keycloak
|
|
||||||
- --db-password
|
|
||||||
- $(KEYCLOAK_DATABASE_PASSWORD)
|
|
||||||
- --db-username
|
|
||||||
- bn_keycloak
|
|
||||||
env:
|
env:
|
||||||
- name: KUBERNETES_NAMESPACE
|
- name: KUBERNETES_NAMESPACE
|
||||||
valueFrom:
|
valueFrom:
|
||||||
@ -104,6 +91,8 @@ spec:
|
|||||||
subPath: app-quarkus-dir
|
subPath: app-quarkus-dir
|
||||||
- mountPath: /backup
|
- mountPath: /backup
|
||||||
name: backup-dir
|
name: backup-dir
|
||||||
|
- mountPath: /script
|
||||||
|
name: script-volume
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
securityContext:
|
securityContext:
|
||||||
# https://stackoverflow.com/questions/50156124/kubernetes-nfs-persistent-volumes-permission-denied
|
# https://stackoverflow.com/questions/50156124/kubernetes-nfs-persistent-volumes-permission-denied
|
||||||
@ -115,6 +104,10 @@ spec:
|
|||||||
- name: backup-dir
|
- name: backup-dir
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: backup-dir-pvc
|
claimName: backup-dir-pvc
|
||||||
|
- name: script-volume
|
||||||
|
configMap:
|
||||||
|
name: keycloak-backup-script
|
||||||
|
defaultMode: 0777
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolume
|
kind: PersistentVolume
|
||||||
@ -146,3 +139,19 @@ spec:
|
|||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 2M
|
storage: 2M
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: "2024-04-20T04:14:45Z"
|
||||||
|
name: keycloak-backup-script
|
||||||
|
namespace: keycloak
|
||||||
|
data:
|
||||||
|
backup_keycloak.sh: |+
|
||||||
|
/opt/bitnami/keycloak/bin/kc.sh export \
|
||||||
|
--file "/backup/realm-export-$(date '+%Y-%m-%d').json" \
|
||||||
|
--realm avril \
|
||||||
|
--db postgres \
|
||||||
|
--db-url jdbc:postgresql://keycloak-postgresql-hl/bitnami_keycloak \
|
||||||
|
--db-password $(KEYCLOAK_DATABASE_PASSWORD) \
|
||||||
|
--db-username bn_keycloak
|
||||||
|
Loading…
x
Reference in New Issue
Block a user