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:
parent
0b0844d51b
commit
78b64129a2
|
@ -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
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
@ -27,13 +27,15 @@ WAIT_INTERVAL = 60
|
||||||
class ApplyingVIMStrategyState(BaseState):
|
class ApplyingVIMStrategyState(BaseState):
|
||||||
"""State for applying the VIM strategy."""
|
"""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__(
|
super(ApplyingVIMStrategyState, self).__init__(
|
||||||
next_state=next_state, region_name=region_name)
|
next_state=next_state, region_name=region_name)
|
||||||
self.strategy_name = strategy_name
|
self.strategy_name = strategy_name
|
||||||
self.max_failed_queries = DEFAULT_MAX_FAILED_QUERIES
|
self.max_failed_queries = DEFAULT_MAX_FAILED_QUERIES
|
||||||
self.wait_attempts = DEFAULT_MAX_WAIT_ATTEMPTS
|
self.wait_attempts = wait_attempts
|
||||||
self.wait_interval = WAIT_INTERVAL
|
self.wait_interval = wait_interval
|
||||||
|
|
||||||
def perform_state_action(self, strategy_step):
|
def perform_state_action(self, strategy_step):
|
||||||
"""Apply a VIM strategy using VIM REST API
|
"""Apply a VIM strategy using VIM REST API
|
||||||
|
|
|
@ -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
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
@ -9,6 +9,11 @@ from dcmanager.orchestrator.states.applying_vim_strategy \
|
||||||
import ApplyingVIMStrategyState
|
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):
|
class ApplyingVIMKubeRootcaUpdateStrategyState(ApplyingVIMStrategyState):
|
||||||
"""State for applying the VIM kube rootca update strategy."""
|
"""State for applying the VIM kube rootca update strategy."""
|
||||||
|
|
||||||
|
@ -16,4 +21,6 @@ class ApplyingVIMKubeRootcaUpdateStrategyState(ApplyingVIMStrategyState):
|
||||||
super(ApplyingVIMKubeRootcaUpdateStrategyState, self).__init__(
|
super(ApplyingVIMKubeRootcaUpdateStrategyState, self).__init__(
|
||||||
next_state=consts.STRATEGY_STATE_COMPLETE,
|
next_state=consts.STRATEGY_STATE_COMPLETE,
|
||||||
region_name=region_name,
|
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)
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
import mock
|
||||||
|
|
||||||
from dcmanager.common import consts
|
from dcmanager.common import consts
|
||||||
from dcmanager.tests.unit.orchestrator.states.kube_rootca.test_base \
|
from dcmanager.tests.unit.orchestrator.states.kube_rootca.test_base \
|
||||||
import TestKubeRootCaUpgradeState
|
import TestKubeRootCaUpgradeState
|
||||||
|
@ -10,6 +12,10 @@ from dcmanager.tests.unit.orchestrator.states.test_applying_vim_strategy \
|
||||||
import ApplyingVIMStrategyMixin
|
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,
|
class TestApplyingVIMKubeRootCAUpgradeStrategyStage(ApplyingVIMStrategyMixin,
|
||||||
TestKubeRootCaUpgradeState):
|
TestKubeRootCaUpgradeState):
|
||||||
"""Tests apply 'kube_rootca' vim strategy during kube rootca upgrade"""
|
"""Tests apply 'kube_rootca' vim strategy during kube rootca upgrade"""
|
||||||
|
|
|
@ -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
|
# 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)
|
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."
|
@mock.patch("dcmanager.orchestrator.states.applying_vim_strategy."
|
||||||
"DEFAULT_MAX_FAILED_QUERIES", 3)
|
"DEFAULT_MAX_FAILED_QUERIES", 3)
|
||||||
@mock.patch("dcmanager.orchestrator.states.applying_vim_strategy."
|
@mock.patch("dcmanager.orchestrator.states.applying_vim_strategy."
|
||||||
"DEFAULT_MAX_WAIT_ATTEMPTS", 3)
|
"DEFAULT_MAX_WAIT_ATTEMPTS", 3)
|
||||||
@mock.patch("dcmanager.orchestrator.states.applying_vim_strategy."
|
@mock.patch("dcmanager.orchestrator.states.applying_vim_strategy."
|
||||||
"WAIT_INTERVAL", 1)
|
"WAIT_INTERVAL", 1)
|
||||||
|
@mock.patch("dcmanager.orchestrator.states.applying_vim_strategy."
|
||||||
|
"ApplyingVIMStrategyState.__init__.__defaults__", (3, 1))
|
||||||
class ApplyingVIMStrategyMixin(object):
|
class ApplyingVIMStrategyMixin(object):
|
||||||
|
|
||||||
def set_state(self, state, success_state):
|
def set_state(self, state, success_state):
|
||||||
|
|
Loading…
Reference in New Issue