Skip to content

Commit 76e8a9f

Browse files
authored
Include new conditions.reason & conditions.type as part of maxUnavailable support (#281)
Add the new conditions types in enactment and policy Signed-off-by: Geetika Kapoor <[email protected]>
1 parent e07a481 commit 76e8a9f

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

ocp_resources/node_network_configuration_enactment.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,18 @@
33

44
class NodeNetworkConfigurationEnactment(Resource):
55
api_group = Resource.ApiGroup.NMSTATE_IO
6+
7+
class Conditions:
8+
class Type:
9+
FAILING = "Failing"
10+
AVAILABLE = "Available"
11+
PROGRESSING = "Progressing"
12+
PENDING = "Pending"
13+
ABORTED = "Aborted"
14+
15+
class Reason:
16+
CONFIGURATION_PROGRESSING = "ConfigurationProgressing"
17+
SUCCESSFULLY_CONFIGURED = "SuccessfullyConfigured"
18+
FAILED_TO_CONFIGURE = "FailedToConfigure"
19+
CONFIGURATION_ABORTED = "ConfigurationAborted"
20+
MAX_UNAVAILABLE_LIMIT_REACHED = "MaxUnavailableLimitReached"

ocp_resources/node_network_configuration_policy.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ class NodeNetworkConfigurationPolicy(Resource):
2323

2424
class Conditions:
2525
class Type:
26-
FAILING = "Failing"
26+
DEGRADED = "Degraded"
2727
AVAILABLE = "Available"
28-
PROGRESSING = "Progressing"
29-
MATCHING = "Matching"
3028

3129
class Reason:
32-
CONFIGURING = "ConfigurationProgressing"
33-
SUCCESS = "SuccessfullyConfigured"
34-
FAILED = "FailedToConfigure"
30+
CONFIGURATION_PROGRESSING = "ConfigurationProgressing"
31+
SUCCESSFULLY_CONFIGURED = "SuccessfullyConfigured"
32+
FAILED_TO_CONFIGURE = "FailedToConfigure"
3533
NO_MATCHING_NODE = "NoMatchingNode"
3634

3735
def __init__(
@@ -324,15 +322,15 @@ def status(self):
324322
return condition["reason"]
325323

326324
def wait_for_status_success(self):
327-
failed_condition_reason = self.Conditions.Reason.FAILED
325+
failed_condition_reason = self.Conditions.Reason.FAILED_TO_CONFIGURE
328326
no_match_node_condition_reason = self.Conditions.Reason.NO_MATCHING_NODE
329327
# if we get here too fast there are no conditions, we need to wait.
330328
self.wait_for_conditions()
331329

332330
samples = TimeoutSampler(wait_timeout=480, sleep=1, func=self.status)
333331
try:
334332
for sample in samples:
335-
if sample == self.Conditions.Reason.SUCCESS:
333+
if sample == self.Conditions.Reason.SUCCESSFULLY_CONFIGURED:
336334
LOGGER.info(f"NNCP {self.name} configured Successfully")
337335
return sample
338336

0 commit comments

Comments
 (0)