Skip to content

Commit be2c457

Browse files
authored
adding Vm state save script (#4)
* added vm-state script * added nerc openstack credential secrets * updated backup.sh to run vm save python script * rolled back the cron to run once per day * removed last blank line * cron will run once per hour * addeed a script to compare current state to a state in json save file specified * cleaned up eof blank line, renamed vm-state to vm-save because it seems to make better sense. * updated Docker file to include new openstack-vm scripts * simplified to use openstack shell commands instead of python script and moved restore script out of this repo
1 parent 5637613 commit be2c457

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

k8s/overlays/nerc-shift-0/patches/patch-openstack-api-backup-cron.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,21 @@ spec:
3030
secretKeyRef:
3131
name: openstack-api-backup
3232
key: backup_rotate
33+
- name: OS_AUTH_URL
34+
valueFrom:
35+
$patch: replace
36+
secretKeyRef:
37+
name: openstack-api-backup
38+
key: os_auth_url
39+
- name: OS_APPLICATION_CREDENTIAL_ID
40+
valueFrom:
41+
$patch: replace
42+
secretKeyRef:
43+
name: openstack-api-backup
44+
key: os_application_credential_id
45+
- name: OS_APPLICATION_CREDENTIAL_SECRET
46+
valueFrom:
47+
$path: replace
48+
secretKeyRef:
49+
name: openstack-api-backup
50+
key: os_application_credential_secret

k8s/overlays/nerc-shift-0/secrets/openstack-api-backup.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,15 @@ spec:
2828
remoteRef:
2929
key: openstack-api-backup/config
3030
property: s3_bucket_uri
31+
- secretKey: os_auth_url
32+
remoteRef:
33+
key: openstack-api-backup/config
34+
property: os_auth_url
35+
- secretKey: os_application_credential_id
36+
remoteRef:
37+
key: openstack-api-backup/config
38+
property: os_application_credential_id
39+
- secretKey: os_application_credential_secret
40+
remoteRef:
41+
key: openstack-api-backup/config
42+
property: os_application_credential_secret

src/bin/openstack-api-backup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ S3_BUCKET_URI=${S3_BUCKET_URI:-""}
1313
function backup_openstack_apis() {
1414
echo ">>> Backing up OpenStack servers"
1515
timestamp=$(date +%Y%m%d%H%M%S)
16+
openstack server list --all-projects -f json > $BACKUP_DIR/$timestamp.nova-server-info
1617
}
1718

18-
1919
function retention() {
2020
backups_to_delete=$(find "${BACKUP_DIR}" -type f | sort -rn | tail -n +$((${BACKUP_ROTATE} + 1)))
2121
echo ">>> Running retention (rotate: ${BACKUP_ROTATE})"
@@ -55,7 +55,7 @@ function validate_input() {
5555
function main() {
5656
sync_s3_to_backups_dir
5757
validate_input
58-
backup_servers
58+
backup_openstack_apis
5959
retention
6060
sync_backups_to_s3
6161
}

0 commit comments

Comments
 (0)