def context_exists()

in src/hyperpod_cli/clients/kubernetes_client.py [0:0]


    def context_exists(self, context: str) -> bool:
        """
        Check if the specified context exists in the kubeconfig.

        Args:
            context (str): The name of the context to check.

        Returns:
            bool: True if the context exists, False otherwise.
        """
        try:
            contexts, _ = config.list_kube_config_contexts()
            return any(ctx["name"] == context for ctx in contexts)
        except Exception as e:
            raise RuntimeError(f"Failed to check Kubernetes context: {e}")