From 6647d36fe81c1324e0c6cf06ebe99a95c6fd8f52 Mon Sep 17 00:00:00 2001 From: Gerard Casas Saez Date: Thu, 22 Jul 2021 19:48:37 -0600 Subject: [PATCH] rename to k8s_client_configuration --- sdk/python/kfp/containers/_container_builder.py | 8 ++++---- sdk/python/kfp/containers/_k8s_job_helper.py | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sdk/python/kfp/containers/_container_builder.py b/sdk/python/kfp/containers/_container_builder.py index 60e9cd6a5f4..3627055e01f 100644 --- a/sdk/python/kfp/containers/_container_builder.py +++ b/sdk/python/kfp/containers/_container_builder.py @@ -56,7 +56,7 @@ class ContainerBuilder(object): ContainerBuilder helps build a container image """ def __init__(self, gcs_staging=None, default_image_name=None, namespace=None, - service_account='kubeflow-pipelines-container-builder', kaniko_executor_image=KANIKO_EXECUTOR_IMAGE_DEFAULT, kubernetes_configuration=None): + service_account='kubeflow-pipelines-container-builder', kaniko_executor_image=KANIKO_EXECUTOR_IMAGE_DEFAULT, k8s_client_configuration=None): """ Args: gcs_staging (str): GCS bucket/blob that can store temporary build files, @@ -71,7 +71,7 @@ def __init__(self, gcs_staging=None, default_image_name=None, namespace=None, The default value is "kubeflow-pipelines-container-builder". It works with Kubeflow Pipelines clusters installed using Google Cloud Marketplace or Standalone with version > 0.4.0. The service account should have permission to read and write from staging gcs path and upload built images to gcr.io. kaniko_executor_image (str): Docker image used to run kaniko executor. Defaults to gcr.io/kaniko-project/executor:v0.10.0. - kubernetes_configuration (kubernetes.Configuration): Kubernetes client configuration object to be used when talking with Kubernetes API. + k8s_client_configuration (kubernetes.Configuration): Kubernetes client configuration object to be used when talking with Kubernetes API. This is optional. If not specified, it will use the default configuration. This can be used to personalize the client used to talk to the Kubernetes server and change authentication parameters. """ self._gcs_staging = gcs_staging @@ -80,7 +80,7 @@ def __init__(self, gcs_staging=None, default_image_name=None, namespace=None, self._namespace = namespace self._service_account = service_account self._kaniko_image = kaniko_executor_image - self._kubernetes_configuration = kubernetes_configuration + self._k8s_client_configuration = k8s_client_configuration def _get_namespace(self): if self._namespace is None: @@ -186,7 +186,7 @@ def build(self, local_dir, docker_filename : str = 'Dockerfile', target_image=No target_image=target_image) logging.info('Start a kaniko job for build.') from ._k8s_job_helper import K8sJobHelper - k8s_helper = K8sJobHelper(self._kubernetes_configuration) + k8s_helper = K8sJobHelper(self._k8s_client_configuration) result_pod_obj = k8s_helper.run_job(kaniko_spec, timeout) logging.info('Kaniko job complete.') diff --git a/sdk/python/kfp/containers/_k8s_job_helper.py b/sdk/python/kfp/containers/_k8s_job_helper.py index 411f47f68dd..f3f508e4179 100644 --- a/sdk/python/kfp/containers/_k8s_job_helper.py +++ b/sdk/python/kfp/containers/_k8s_job_helper.py @@ -23,16 +23,16 @@ class K8sJobHelper(object): """ Kubernetes Helper """ - def __init__(self, kubernetes_configuration=None): - if not self._configure_k8s(kubernetes_configuration): + def __init__(self, k8s_client_configuration=None): + if not self._configure_k8s(k8s_client_configuration): raise Exception('K8sHelper __init__ failure') - def _configure_k8s(self, kubernetes_configuration=None): + def _configure_k8s(self, k8s_client_configuration=None): k8s_config_file = os.environ.get('KUBECONFIG') if k8s_config_file: try: logging.info('Loading kubernetes config from the file %s', k8s_config_file) - config.load_kube_config(config_file=k8s_config_file, client_configuration=kubernetes_configuration) + config.load_kube_config(config_file=k8s_config_file, client_configuration=k8s_client_configuration) except Exception as e: raise RuntimeError('Can not load kube config from the file %s, error: %s', k8s_config_file, e) else: @@ -42,7 +42,7 @@ def _configure_k8s(self, kubernetes_configuration=None): except: logging.info('Cannot find in-cluster config, trying the local kubernetes config. ') try: - config.load_kube_config(client_configuration=kubernetes_configuration) + config.load_kube_config(client_configuration=k8s_client_configuration) logging.info('Found local kubernetes config. Initialized with kube_config.') except: raise RuntimeError('Forgot to run the gcloud command? Check out the link: \