From 872ca0561b0fa26e1e0e1733c3507ecd239eed2b Mon Sep 17 00:00:00 2001 From: Viktor Kramarenko Date: Wed, 25 Sep 2024 15:31:23 +0300 Subject: [PATCH] fix none labels Signed-off-by: Viktor Kramarenko --- hooks/convert_bd_names_to_selector.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hooks/convert_bd_names_to_selector.py b/hooks/convert_bd_names_to_selector.py index b775e1bf..1e7595fa 100755 --- a/hooks/convert_bd_names_to_selector.py +++ b/hooks/convert_bd_names_to_selector.py @@ -253,13 +253,13 @@ def main(ctx: hook.Context): 'name': lvg['metadata'][ 'name'], - 'labels': - lvg['metadata'][ - 'labels'], 'finalizers': lvg['metadata'][ 'finalizers']}, 'spec': lvg['spec']} + if 'labels' in lvg['metadata']: + lvg_backup['metadata']['labels'] = lvg['metadata']['labels'] + lvg_backup['metadata']['labels']['kubernetes.io/hostname'] = lvg['status']['nodes'][0]['name'] lvg_backup['metadata']['labels'][migration_completed_label] = 'false' try: