Skip to content

Commit

Permalink
rename to k8s_client_configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
casassg committed Jul 23, 2021
1 parent e58637e commit f124066
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions sdk/python/kfp/containers/_container_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
kubernetes_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
Expand All @@ -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:
Expand Down Expand Up @@ -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._kubernetes_client_configuration)
result_pod_obj = k8s_helper.run_job(kaniko_spec, timeout)
logging.info('Kaniko job complete.')

Expand Down
10 changes: 5 additions & 5 deletions sdk/python/kfp/containers/_k8s_job_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: \
Expand Down

0 comments on commit f124066

Please sign in to comment.