From 6815fd9556eaf52882b7aa177a94f1261e42e319 Mon Sep 17 00:00:00 2001 From: Viktor Kram <92625690+ViktorKram@users.noreply.github.com> Date: Thu, 26 Sep 2024 09:36:25 +0300 Subject: [PATCH] fix none labels (#96) 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: