def set_kubeconfig_environment_var()

in azure/util.py [0:0]


def set_kubeconfig_environment_var():
    if os.path.isdir("_output"):
        config_path = os.path.join(
            PETCTL_DIR, "_output", "azure-pytorch-elastic", "kubeconfig"
        )
        logger.info(f"Reading KUBECONFIG environment variable from {config_path}")

        for files in walk(config_path):
            for f in files:
                if f and f[0].endswith(".json"):
                    config_path = os.path.join(config_path, f[0])

        if config_path.endswith(".json"):
            os.environ["KUBECONFIG"] = config_path
            logger.info(
                f"Setting KUBECONFIG env variable {os.environ.get('KUBECONFIG')}"
            )