Skip to content

Commit

Permalink
Update AppSet workload deployment verification to check health status…
Browse files Browse the repository at this point in the history
… instead of phase

Signed-off-by: Sidhant Agrawal <[email protected]>
  • Loading branch information
sidhant-agrawal committed Jan 13, 2025
1 parent dfda6e3 commit 5571c70
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions ocs_ci/ocs/dr/dr_workload.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
CommandFailed,
UnexpectedBehaviour,
ResourceNotDeleted,
ResourceWrongStatusException,
)
from ocs_ci.ocs.resources.pod import get_all_pods
from ocs_ci.ocs.utils import get_primary_cluster_config, get_non_acm_cluster_config
from ocs_ci.utility import templating
from ocs_ci.utility.utils import clone_repo, run_cmd
from ocs_ci.utility.utils import clone_repo, run_cmd, TimeoutSampler

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -614,13 +615,26 @@ def verify_workload_deployment(self):
)

if self.appset_model == "pull":
appset_pull_obj = ocp.OCP(
kind=constants.APPLICATION_ARGOCD,
resource_name=appset_resource_name,
namespace=constants.GITOPS_CLUSTER_NAMESPACE,
sampler = TimeoutSampler(
120, sleep=5, func=self.check_workload_health_status
)
appset_pull_obj._has_phase = True
appset_pull_obj.wait_for_phase(phase="Succeeded", timeout=120)
if not sampler.wait_for_func_status(True):
raise ResourceWrongStatusException(
f"{appset_resource_name} health status is not Healthy"
)

def check_workload_health_status(self):
appset_resource_name = (
self._get_applicaionset_name() + "-" + self.preferred_primary_cluster
)
appset_obj = ocp.OCP(
kind=constants.APPLICATION_ARGOCD,
resource_name=appset_resource_name,
namespace=constants.GITOPS_CLUSTER_NAMESPACE,
)
health_status = appset_obj.get().get("status").get("health").get("status")
log.info(f"{appset_resource_name} health status: {health_status}")
return health_status == "Healthy"

def check_pod_pvc_status(self, skip_replication_resources=False):
"""
Expand Down

0 comments on commit 5571c70

Please sign in to comment.