From 8c0d3f5063455f13855f0270b4cf4a38210ab66c Mon Sep 17 00:00:00 2001 From: Enzo Candotti Date: Fri, 5 May 2023 12:17:20 -0300 Subject: [PATCH] Fix to-version field on K8S Upgrade Strategy When creating a Kubernetes Strategy, the 'to-version' field was being sent without the 'v' prefix. This was making that the kubernetes pre-check fails. This change fixes this issue. Also, the default version that is selected when the user doesn't select an item on the 'to-version' drop-down menu will be the systemcontroller active version. Test Plan: PASS: Create and apply a kubernetes upgrade strategy selecting the desired 'to-version' option. Verify the pre-check is passed and the strategy is completed. PASS: Create and apply a kubernetes upgrade strategy using the default option on the drop-down menu. Verify that the version that it being sent to dcmanager is the systemcontroller's active version. Closes-bug: 2018611 Signed-off-by: Enzo Candotti Change-Id: Ifb76950dfdc67bdda57cbaea20433f65ebcc8aa3 --- .../dashboards/dc_admin/dc_orchestration/forms.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/forms.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/forms.py index 4e196f30..0805147c 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/forms.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/forms.py @@ -75,7 +75,8 @@ class CreateCloudStrategyForm(forms.SelfHandlingForm): label=_("To version"), required=False, help_text=_("Select a version to apply the strategy. \ - Otherwise, it will be updated to the available version."), + Otherwise, it will be updated to the SystemController \ + active version."), widget=forms.Select( attrs={ 'class': 'switchable switched', @@ -221,15 +222,13 @@ class CreateCloudStrategyForm(forms.SelfHandlingForm): kube_versions = [] version = [] - is_first_available = False kube_version_list = api.sysinv.kube_version_list(self.request) for k in kube_version_list: - if k.state == "available" and not is_first_available: - version = [(k.version[1:], '--')] + if k.state == "active": + version = [(k.version, '--')] kube_versions[:0] = version - is_first_available = True if k.state != "unavailable": - version = [(k.version[1:], k.version[1:] + " - " + k.state)] + version = [(k.version, k.version + " - " + k.state)] kube_versions.extend(version) self.fields['to_version'].choices = kube_versions