INNER CODE UNIT · Python

switch_context

IBM/AutoMLPipeline.jl · argo-workflow/agents/argo-k8s.py:92

def switch_context(context: str):
    """
    Switch the active Kubernetes context to connect to a different cluster.

    This tool changes the current Kubernetes context to the specified one, allowing
    you to switch between different clusters or namespaces. After switching, all
    subsequent kubectl commands and API calls will be directed to the new context.
    The Kubernetes API clients are automatically reinitialized for the new context.

    Args:
        context (str): The name of the context to switch to. Must be a valid context
                      name from your kubeconfig file. Use list_clusters() to see
                      available contexts.

    Returns:
        dict: A dictionary containing:
            - message: Success message if context switch was successful
            - error: Error message if the context switch failed

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…