canonical / opensearch-operator

OpenSearch operator
Apache License 2.0
9 stars 5 forks source link

[Large Deployments] Allow to override the `OpenSearchHealth.apply` #255

Closed phvalguima closed 2 months ago

phvalguima commented 2 months ago

Currently, on large deployments, OpenSearchHealth.apply will return HealthColors.IGNORE for the orchestrator clusters. However, there are certain situations, e.g. upgrades, where we need to know the status of the cluster before executing the node upgrade.

Therefore, we need an option to override the check:

    def apply(
        self,
        wait_for_green_first: bool = False,
        use_localhost: bool = True,
        app: bool = True,
        override: bool = False,
    ) -> str:
        """Fetch cluster health and set it on the app status."""
        try:
            host = self._charm.unit_ip if use_localhost else None
            status = self._fetch_status(host, wait_for_green_first)

......

            # compute health only in clusters where data nodes exist
            if override:
                return status
            else:
                compute_health = (
                    deployment_desc.start == StartMode.WITH_GENERATED_ROLES
                    or "data" in deployment_desc.config.roles
                )
                if not compute_health:
                    return HealthColors.IGNORE
github-actions[bot] commented 2 months ago

https://warthogs.atlassian.net/browse/DPE-4205

Mehdi-Bendriss commented 2 months ago

Addressed in https://github.com/canonical/opensearch-operator/pull/279 - through the introduction of the health.get