apiVersion: velero.io/v1 kind: Restore metadata: name: restore-etcd namespace: velero spec: scheduleName: daily-backup backupName: "" includedNamespaces: - prod-central - prod-cinecity namespaceMapping: prod-central: qualif-central prod-cinecity: qualif-cinecity labelSelector: matchLabels: app: "etcd" hooks: resources: # PROD-CENTRAL-JASPERDB - labelSelector: matchLabels: app.kubernetes.io/instance: "jasperdb" includedNamespaces: - 'qualif-central' name: qualif-central-jasperdb postHooks: - exec: onError: Fail command: - sh - -c - | sleep 20 zcat /backups/bitnami_jasperreports.sql.gz | mysql -u${MARIADB_USER} -p$(cat $MARIADB_PASSWORD_FILE) bitnami_jasperreports waitTimeout: 5m execTimeout: 60m # PROD-CENTRAL-PGSTATS - labelSelector: matchLabels: app: "postgres-13" includedNamespaces: - 'qualif-central' name: qualif-central-pgstats postHooks: - exec: command: - sh - -c - | sleep 20 createdb -U ${POSTGRES_USER} ${POSTGRES_DB} chown -R postgres. /var/lib/postgresql/data/pgdata gunzip -c /backups/pgstats.sql.gz | psql -U ${POSTGRES_USER} ${POSTGRES_DB} execTimeout: 1200s # PROD-CENTRAL-MINIO - labelSelector: matchLabels: app: "minio" name: qualif-central-minio # PROD-CENTRAL-ETCD - labelSelector: matchLabels: app: "etcd" includedNamespaces: - 'prod-central' name: qualif-central-etcd # PROD-CENTRAL-ES6 - labelSelector: matchLabels: app: "es6" statefulset.kubernetes.io/pod-name: "es6-2" includedNamespaces: - 'qualif-central' name: qualif-central-es6 postHooks: - exec: onError: Fail execTimeout: 10m command: - sh - -c - | sleep 20 for i in $(curl localhost:9200/_cat/indices|awk '/open/ {print $3}') do curl localhost:9200/${i}/_close -XPOST done curl -XPUT -H 'Content-type: application/json' -d '{"type": "fs","settings":{"location": "/snapshots/","compress":true}}' localhost:9200/_snapshot/nfs TZ=Pacific/Noumea curl -XPOST localhost:9200/_snapshot/nfs/$(date +%F --date=yesterday)/_restore # PROD-CINECITY-POSTGRES - labelSelector: matchLabels: app: postgres statefulset.kubernetes.io/pod-name: postgres-0 includedNamespaces: - 'qualif-cinecity' name: prod-cinecity-postgresql postHooks: - exec: onError: Fail execTimeout: 30m command: - sh - -c - | sleep 20 createdb -U ${POSTGRES_USER} qualif-complexe-cinecity chown -R postgres. /var/lib/postgresql/data/pgdata gunzip -c /backups/prod-complexe-cinecity.sql.gz | psql -U ${POSTGRES_USER} qualif-complexe-cinecity # PROD-CINECITY-MINIO - labelSelector: matchLabels: app: "minio" name: prod-cinecity-minio # PROD-CINECITY-ETCD - labelSelector: matchLabels: app: "etcd" includedNamespaces: - 'prod-cinecity' name: qualif-cinecity-etcd - labelSelector: matchLabels: app: "es6" statefulset.kubernetes.io/pod-name: "es6-2" includedNamespaces: - 'qualif-cinecity' name: qualif-cinecity-es6 postHooks: - exec: onError: Fail execTimeout: 10m command: - sh - -c - | sleep 20 for i in $(curl localhost:9200/_cat/indices|awk '/open/ {print $3}') do curl localhost:9200/${i}/_close -XPOST done curl -XPUT -H 'Content-type: application/json' -d '{"type": "fs","settings":{"location": "/snapshots/","compress":true}}' localhost:9200/_snapshot/nfs TZ=Pacific/Noumea curl -XPOST localhost:9200/_snapshot/nfs/$(date +%F --date=yesterday)/_restore