Increment timeout of DC K8s Root CA strategy

Recently, the internal pod rollout script used in the stages
"trust-both-cas" and "trust-new-ca" of the Kubernetes Root CA update
process was increased from ~8 minutes to ~30 minutes, so the max
possible timeout for the root CA update increased in ~44 minutes.
This change increases the timeout for subclouds, used by dcmanager
kube-rootca-update-strategy, from 60 minutes to 120 minutes.

Test Plan:

PASS: In a DC deploy with 1 subcloud, successfully apply a dcmanager
kube-rootca-update-strategy on the subcloud.

PASS: Repeat the test above, but artificially make the root CA update
process in the subcloud take more than 1 hour to complete and check
that no timeout occurs on the central cloud.

Closes-Bug: 2004594
Signed-off-by: Joao Victor Portal <Joao.VictorPortal@windriver.com>
Change-Id: I6460846eba6a37d1d0cdc634ea4cf1314b1b6bc4
This commit is contained in:
Joao Victor Portal 2023-02-22 11:04:00 -03:00
parent 0b0844d51b
commit 78b64129a2
4 changed files with 29 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2020-2021 Wind River Systems, Inc.
# Copyright (c) 2020-2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -27,13 +27,15 @@ WAIT_INTERVAL = 60
class ApplyingVIMStrategyState(BaseState):
"""State for applying the VIM strategy."""
def __init__(self, next_state, region_name, strategy_name):
def __init__(self, next_state, region_name, strategy_name,
wait_attempts=DEFAULT_MAX_WAIT_ATTEMPTS,
wait_interval=WAIT_INTERVAL):
super(ApplyingVIMStrategyState, self).__init__(
next_state=next_state, region_name=region_name)
self.strategy_name = strategy_name
self.max_failed_queries = DEFAULT_MAX_FAILED_QUERIES
self.wait_attempts = DEFAULT_MAX_WAIT_ATTEMPTS
self.wait_interval = WAIT_INTERVAL
self.wait_attempts = wait_attempts
self.wait_interval = wait_interval
def perform_state_action(self, strategy_step):
"""Apply a VIM strategy using VIM REST API

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2021 Wind River Systems, Inc.
# Copyright (c) 2021-2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -9,6 +9,11 @@ from dcmanager.orchestrator.states.applying_vim_strategy \
import ApplyingVIMStrategyState
# Max time: 120 minutes = 120 queries x 60 seconds
KUBE_ROOTCA_UPDATE_MAX_WAIT_ATTEMPTS = 120
KUBE_ROOTCA_UPDATE_WAIT_INTERVAL = 60
class ApplyingVIMKubeRootcaUpdateStrategyState(ApplyingVIMStrategyState):
"""State for applying the VIM kube rootca update strategy."""
@ -16,4 +21,6 @@ class ApplyingVIMKubeRootcaUpdateStrategyState(ApplyingVIMStrategyState):
super(ApplyingVIMKubeRootcaUpdateStrategyState, self).__init__(
next_state=consts.STRATEGY_STATE_COMPLETE,
region_name=region_name,
strategy_name=vim.STRATEGY_NAME_KUBE_ROOTCA_UPDATE)
strategy_name=vim.STRATEGY_NAME_KUBE_ROOTCA_UPDATE,
wait_attempts=KUBE_ROOTCA_UPDATE_MAX_WAIT_ATTEMPTS,
wait_interval=KUBE_ROOTCA_UPDATE_WAIT_INTERVAL)

View File

@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: Apache-2.0
#
import mock
from dcmanager.common import consts
from dcmanager.tests.unit.orchestrator.states.kube_rootca.test_base \
import TestKubeRootCaUpgradeState
@ -10,6 +12,10 @@ from dcmanager.tests.unit.orchestrator.states.test_applying_vim_strategy \
import ApplyingVIMStrategyMixin
@mock.patch("dcmanager.orchestrator.states.kube_rootca.applying_vim_strategy."
"KUBE_ROOTCA_UPDATE_MAX_WAIT_ATTEMPTS", 3)
@mock.patch("dcmanager.orchestrator.states.kube_rootca.applying_vim_strategy."
"KUBE_ROOTCA_UPDATE_WAIT_INTERVAL", 1)
class TestApplyingVIMKubeRootCAUpgradeStrategyStage(ApplyingVIMStrategyMixin,
TestKubeRootCaUpgradeState):
"""Tests apply 'kube_rootca' vim strategy during kube rootca upgrade"""

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2020-2022 Wind River Systems, Inc.
# Copyright (c) 2020-2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -20,12 +20,19 @@ STRATEGY_APPLIED = FakeVimStrategy(state=vim.STATE_APPLIED)
STRATEGY_APPLY_FAILED = FakeVimStrategy(state=vim.STATE_APPLY_FAILED)
# Note: although the values of DEFAULT_MAX_WAIT_ATTEMPTS and WAIT_INTERVAL of
# "dcmanager.orchestrator.states.applying_vim_strategy" are patched in the lines below,
# the default values of parameters "wait_attempts" and "wait_interval" of method
# "ApplyingVIMStrategyState.__init__" don't change. To fix this, we patch these default
# values in "ApplyingVIMStrategyState.__init__.__defaults__".
@mock.patch("dcmanager.orchestrator.states.applying_vim_strategy."
"DEFAULT_MAX_FAILED_QUERIES", 3)
@mock.patch("dcmanager.orchestrator.states.applying_vim_strategy."
"DEFAULT_MAX_WAIT_ATTEMPTS", 3)
@mock.patch("dcmanager.orchestrator.states.applying_vim_strategy."
"WAIT_INTERVAL", 1)
@mock.patch("dcmanager.orchestrator.states.applying_vim_strategy."
"ApplyingVIMStrategyState.__init__.__defaults__", (3, 1))
class ApplyingVIMStrategyMixin(object):
def set_state(self, state, success_state):