Skip to content

Commit

Permalink
Fix access to missing finalizers, always add default finalizer during…
Browse files Browse the repository at this point in the history
… migration

Signed-off-by: Alexandr Stefurishin <[email protected]>
  • Loading branch information
Alexandr Stefurishin committed Dec 10, 2024
1 parent 63a9aa6 commit 669ea1b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions hooks/convert_bd_names_to_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,18 +248,18 @@ def main(ctx: hook.Context):
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']}
'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']
if default_finalizer not in lvg_backup['metadata']['finalizers']:
lvg_backup['metadata']['finalizers'].append('storage.deckhouse.io/sds-node-configurator')

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 669ea1b

Please sign in to comment.