From 8009752d4e003bea7966030f446ab1fe52c37be6 Mon Sep 17 00:00:00 2001 From: "Martin, Chen" Date: Thu, 18 Jul 2019 05:54:25 +0800 Subject: [PATCH] Correct helm override value setting, when the setting value is a digit As helm converts a long int value to float64, which makes error when helm sets value with a big number. Update helm-override-update underlying logic to map the command line --set option to helm --set-string option for long integer values case, which can be handled correctly Test case: $ system application-upload $ system helm-override-update \ --set conf.panko.database.metering_time_to_live= stx-openstack panko openstack $ system helm-override-update \ --set =32 stx-openstack panko openstack $ system helm-override-update \ --set conf.panko.database.event_time_to_live=24828899 \ --set conf.panko.database.metering_time_to_live= stx-openstack panko openstack $ system application-apply stx-openstack Closes-Bug: 1828056 Change-Id: I44d7d5b515c5dbf121e12855dff7abfa49beb07c Signed-off-by: Martin, Chen (cherry picked from commit 71db99e824290231126022fe8af5cb7bd66d99dc) --- sysinv/sysinv/sysinv/sysinv/helm/helm.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sysinv/sysinv/sysinv/sysinv/helm/helm.py b/sysinv/sysinv/sysinv/sysinv/helm/helm.py index 73d0b022f8..94087b8445 100644 --- a/sysinv/sysinv/sysinv/sysinv/helm/helm.py +++ b/sysinv/sysinv/sysinv/sysinv/helm/helm.py @@ -404,7 +404,16 @@ class HelmOperator(object): cmd.extend(['--values', tmpfile.name]) for value_set in set_overrides: - cmd.extend(['--set', value_set]) + keypair = list(value_set.split("=")) + + # request user to input with "--set key=value" or + # "--set key=", for the second case, the value is assume "" + # skip setting like "--set =value", "--set xxxx" + if len(keypair) == 2 and keypair[0]: + if keypair[1] and keypair[1].isdigit(): + cmd.extend(['--set-string', value_set]) + else: + cmd.extend(['--set', value_set]) env = os.environ.copy() env['KUBECONFIG'] = '/etc/kubernetes/admin.conf'