Skip to content

Commit

Permalink
Merge pull request #109 from deckhouse/astef-fix-lvg-empty-finalizers…
Browse files Browse the repository at this point in the history
…-backport

Signed-off-by: Alexandr Stefurishin <[email protected]>
  • Loading branch information
AleksZimin authored Dec 11, 2024
2 parents 63a9aa6 + 2853af1 commit a23af2a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions hooks/convert_bd_names_to_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,21 @@ def main(ctx: hook.Context):
# we store the using node name as a label due to we will lose the status for the backup resource
print(f"{migrate_script} starts to create backups and add 'kubernetes.io/hostname' to store the node name")
for lvg in lvg_list.get('items', []):
lvg_backup = {'apiVersion': lvg['apiVersion'],
'kind': 'LvmVolumeGroupBackup',
'metadata': {
'name':
lvg['metadata'][
'name'],
'labels': {},
'finalizers':
lvg['metadata'][
'finalizers']},
'spec': lvg['spec']}
lvg_backup = {
'apiVersion': lvg['apiVersion'],
'kind': 'LvmVolumeGroupBackup',
'metadata': {
'name': lvg['metadata']['name'],
'labels': {},
'finalizers': lvg['metadata'].get('finalizers', [])
},
'spec': lvg['spec']
}
if 'labels' in lvg['metadata']:
lvg_backup['metadata']['labels'] = lvg['metadata']['labels']
default_finalizer = 'storage.deckhouse.io/sds-node-configurator'
if default_finalizer not in lvg_backup['metadata']['finalizers']:
lvg_backup['metadata']['finalizers'].append(default_finalizer)

lvg_backup['metadata']['labels']['kubernetes.io/hostname'] = lvg['status']['nodes'][0]['name']
lvg_backup['metadata']['labels'][migration_completed_label] = 'false'
Expand Down

0 comments on commit a23af2a

Please sign in to comment.