Skip to content

Commit

Permalink
gcp cred bug fix for multiple credentials in single pipeline (#1384)
Browse files Browse the repository at this point in the history
* gcp cred bug fix for multiple credentials in single pipeline

* squash to remove conflict
  • Loading branch information
aakashbajaj authored and k8s-ci-robot committed Aug 20, 2019
1 parent 60fd70c commit 6a7b28f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sdk/python/kfp/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

from kubernetes.client import V1Toleration


def use_gcp_secret(secret_name='user-gcp-sa', secret_file_path_in_volume='/user-gcp-sa.json', volume_name=None, secret_volume_mount_path='/secret/gcp-credentials'):
def use_gcp_secret(secret_name='user-gcp-sa', secret_file_path_in_volume=None, volume_name=None, secret_volume_mount_path='/secret/gcp-credentials'):
"""An operator that configures the container to use GCP service account.
The user-gcp-sa secret is created as part of the kubeflow deployment that
Expand All @@ -32,8 +31,13 @@ def use_gcp_secret(secret_name='user-gcp-sa', secret_file_path_in_volume='/user-
service account access permission.
"""

# permitted values for secret_name = ['admin-gcp-sa', 'user-gcp-sa']
if secret_file_path_in_volume is None:
secret_file_path_in_volume = '/' + secret_name + '.json'

if volume_name is None:
volume_name = 'gcp-credentials-' + secret_name

else:
import warnings
warnings.warn('The volume_name parameter is deprecated and will be removed in next release. The volume names are now generated automatically.', DeprecationWarning)
Expand Down Expand Up @@ -107,4 +111,4 @@ def _set_preemptible(task):
task.add_node_selector_constraint("cloud.google.com/gke-preemptible", "true")
return task

return _set_preemptible
return _set_preemptible

0 comments on commit 6a7b28f

Please sign in to comment.