Adding 'force' support and 'to-version' for kube-upgrade

The 'force' allows a subcloud that is in-sync to be upgraded.
The 'to-version' allows a version to be specified, as long as it
is greater or equal to the available version in the subcloud.

These changes add the ability for subclouds to be orchestrated
independently of the version running on the system controller.

Story: 2008972
Task: 44137
Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/820552
Signed-off-by: albailey <Al.Bailey@windriver.com>
Change-Id: I62a383712eba3a2809df0af356fe1f41b228ee46
This commit is contained in:
albailey 2021-12-06 10:22:15 -06:00
parent 42a9de9825
commit fa45089d42
3 changed files with 23 additions and 2 deletions

View File

@ -25,3 +25,4 @@ class kube_upgrade_manager(sw_update_manager):
super(kube_upgrade_manager, self).__init__(
http_client,
update_type=SW_UPDATE_TYPE_KUBERNETES)
self.extra_args = ['to-version']

View File

@ -56,7 +56,7 @@ class CreateKubeRootcaUpdateStrategy(KubeRootcaUpdateManagerMixin,
# override validate_force_params defined in CreateSwUpdateStrategy
def validate_force_params(self, parsed_args):
"""Disable validation the force option. Allows multiple subclouds."""
"""Disable validating the force option. Allows multiple subclouds."""
pass

View File

@ -27,7 +27,27 @@ class KubeUpgradeManagerMixin(object):
class CreateKubeUpgradeStrategy(KubeUpgradeManagerMixin,
sw_update_manager.CreateSwUpdateStrategy):
"""Create a kubernetes upgrade strategy."""
pass
def get_parser(self, prog_name):
parser = super(CreateKubeUpgradeStrategy,
self).get_parser(prog_name)
parser.add_argument(
'--to-version',
required=False,
help='Specify a version other than the system controller version.'
)
return parser
def process_custom_params(self, parsed_args, kwargs_dict):
"""Updates kwargs dictionary from parsed_args for kube upgrade"""
# Note the "-" vs "_" when dealing with parsed_args
if parsed_args.to_version:
kwargs_dict['to-version'] = parsed_args.to_version
# override validate_force_params defined in CreateSwUpdateStrategy
def validate_force_params(self, parsed_args):
"""Disable validating the force option. Allows multiple subclouds."""
pass
class ShowKubeUpgradeStrategy(KubeUpgradeManagerMixin,