def wait_for_deployment_ready(name: str, namespace: str, timeout: int = 60) -> "RobustaDeployment":
        """
        Waits for the deployment to be ready, i.e., the expected number of pods are running.
        """
        for _ in range(timeout):  # retry for up to timeout seconds
            try:
                deployment = RobustaDeployment().read(name, namespace)
                if deployment.status.readyReplicas == deployment.spec.replicas:
                    return deployment
            except ApiException as e:
                if e.status != 404:  # re-raise the exception if it's not a NotFound error
                    raise
            time.sleep(1)
        else:
            raise RuntimeError(f"Deployment {name} in namespace {namespace} is not ready after {timeout} seconds")

        Waits for the deployment to be ready, i.e., the expected number of pods are running.
        
src/robusta/integrations/kubernetes/custom_models.py