From e209dff3ae8102131eecaaa3ecb86272710f2581 Mon Sep 17 00:00:00 2001 From: Igor Soares Date: Tue, 5 Mar 2024 18:44:25 -0300 Subject: [PATCH] Add CONF option to set default auto_update value Add a configuration option to sysinv.conf that sets the default behavior for automatically updating apps if not specified in the application metadata. The new option is named 'missing_auto_update' and it is available under the 'app_framework' section in sysinv.conf. It is set to 'False' in de code base to facilitate porting this change to previous releases, which had the auto_update option disabled by default. A separate stx-puppet change was done to set it to 'True' by default for the next releases: https://review.opendev.org/c/starlingx/stx-puppet/+/911384 Test Plan: PASS: AIO-SX fresh install. PASS: Build platform-integ-apps without the 'upgrades' metadata section. Confirm that the default value was correctly inserted into the 'auto_update' field of the 'kube_app_bundle' database table after a fresh install. PASS: Change the default 'missing_auto_update' value in sysinv.conf. Add a new version of platform-integ-apps without the 'upgrades' metadata section to /usr/local/share/applications/helm/. Restart sysinv-conductor. Confirm that the 'auto_update' column for the new version matches the new 'missing_auto_update' value. Apply platform-integ-apps and confirm that the framework complies with the new 'missing_auto_update' value. Story: 2010929 Task: 49670 Change-Id: I068310bed70a5e1cf7e8668b2e673751276ed3a8 Signed-off-by: Igor Soares --- sysinv/sysinv/sysinv/sysinv/common/app_metadata.py | 5 ++++- sysinv/sysinv/sysinv/sysinv/conductor/manager.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sysinv/sysinv/sysinv/sysinv/common/app_metadata.py b/sysinv/sysinv/sysinv/sysinv/common/app_metadata.py index f8e6de7d6f..3c12bffcc6 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/app_metadata.py +++ b/sysinv/sysinv/sysinv/sysinv/common/app_metadata.py @@ -17,6 +17,7 @@ import tarfile import tempfile import yaml +from oslo_config import cfg from oslo_log import log as logging from sysinv._i18n import _ from sysinv.common import constants @@ -24,6 +25,8 @@ from sysinv.common import exception from sysinv.common import kubernetes from sysinv.common import utils +CONF = cfg.CONF + LOG = logging.getLogger(__name__) @@ -627,7 +630,7 @@ def extract_bundle_metadata(file_path): 'auto_update': metadata.get(constants.APP_METADATA_UPGRADES, {}).get( constants.APP_METADATA_AUTO_UPDATE, - constants.APP_METADATA_AUTO_UPDATE_DEFAULT_VALUE), + CONF.app_framework.missing_auto_update), 'k8s_auto_update': k8s_auto_update, 'k8s_timing': k8s_update_timing, 'k8s_minimum_version': minimum_supported_k8s_version, diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py index bc39609e98..b9449f5cc3 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py @@ -191,6 +191,10 @@ app_framework_opts = [ cfg.IntOpt('fluxcd_hr_reconcile_check_delay', default=60, help='Delay time to check progress of helmrelease'), + cfg.BoolOpt('missing_auto_update', + default=False, + help='Auto update an application if not specified in the ' + 'application metadata'), ] CONF = cfg.CONF