Replay of bootstrap playbook fails providing initial system config

During system bootstrap, after bootstrap ansible playbook starts,
if it fails after completing persist-config step and before k8s service
is started, the installation will fail again when trying to replay the
bootstrap ansible playbook.

Test Plan:
  PASS: Start fresh install with Debian AIO-SX.
  PASS: Stop bootstrap ansible playbook after persist-config step.
  PASS: Replay bootstrap ansible playbook and complete the installation.
  PASS: Add extra-volumes during runtime, apply changes and delete.

Closes-Bug: 2013103

Signed-off-by: Jorge Saffe <jorge.saffe@windriver.com>
Change-Id: I59f08b587c45c405a4ce1afc88913efd7befe8f9
This commit is contained in:
Jorge Saffe 2023-03-28 12:35:38 -04:00
parent 5386ad8f8d
commit 90c8e6aaf9
2 changed files with 13 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# Copyright (c) 2015-2022 Wind River Systems, Inc.
# Copyright (c) 2015-2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -39,6 +39,8 @@ from sysinv.common import service_parameter
from sysinv.common import utils as cutils
from sysinv.openstack.common.rpc import common as rpc_common
from tsconfig.tsconfig import INITIAL_K8S_CONFIG_COMPLETE
LOG = log.getLogger(__name__)
k8s_volumes_sections = [
@ -63,6 +65,13 @@ def delete_k8s_configmap(parameter, kube_operator):
"""
_volume, _noConfigMap = service_parameter.parse_volume_string_to_dict(parameter)
# only removes the configmaps if k8s has been initialized
# this case is only valid during the bootstrap scenario. When the ansible
# playbook fails before the k8s service is initialized, during a replay
# it will fail when trying to remove configmaps that don't exist yet.
if not os.path.isfile(INITIAL_K8S_CONFIG_COMPLETE):
return
# only delete configmaps for 'File' type since
# 'DirectoryorCreate' type has no associated configmaps
pathType = _volume['pathType']

View File

@ -201,6 +201,9 @@ PLATFORM_BACKUP_PATH = '/opt/platform-backup'
# Set after the first application of controller manifests
INITIAL_CONTROLLER_CONFIG_COMPLETE = os.path.join(
PLATFORM_CONF_PATH, ".initial_controller_config_complete")
# Set after initial K8s config is completed
INITIAL_K8S_CONFIG_COMPLETE = os.path.join(
PLATFORM_CONF_PATH, ".initial_k8s_config_complete")
# Set after each application of controller manifests
VOLATILE_CONTROLLER_CONFIG_COMPLETE = os.path.join(
VOLATILE_PATH, ".controller_config_complete")