Skip to content

Commit

Permalink
Remove usage of deprecated ContainerOp methods in use_gcp_secret (#2280)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsmartin authored and k8s-ci-robot committed Oct 2, 2019
1 parent f649eb5 commit e19efdf
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions sdk/python/kfp/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,36 +45,35 @@ def use_gcp_secret(secret_name='user-gcp-sa', secret_file_path_in_volume=None, v

def _use_gcp_secret(task):
from kubernetes import client as k8s_client
return (
task
.add_volume(
k8s_client.V1Volume(
name=volume_name,
secret=k8s_client.V1SecretVolumeSource(
secret_name=secret_name,
)
)
task = task.add_volume(
k8s_client.V1Volume(
name=volume_name,
secret=k8s_client.V1SecretVolumeSource(
secret_name=secret_name,
)
.add_volume_mount(
)
)
task.container \
.add_volume_mount(
k8s_client.V1VolumeMount(
name=volume_name,
mount_path=secret_volume_mount_path,
)
) \
.add_env_variable(
k8s_client.V1EnvVar(
name='GOOGLE_APPLICATION_CREDENTIALS',
value=secret_volume_mount_path + secret_file_path_in_volume,
)
.add_env_variable(
k8s_client.V1EnvVar(
name='GOOGLE_APPLICATION_CREDENTIALS',
value=secret_volume_mount_path + secret_file_path_in_volume,
)
) \
.add_env_variable(
k8s_client.V1EnvVar(
name='CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE',
value=secret_volume_mount_path + secret_file_path_in_volume,
)
.add_env_variable(
k8s_client.V1EnvVar(
name='CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE',
value=secret_volume_mount_path + secret_file_path_in_volume,
)
) # Set GCloud Credentials by using the env var override.
# TODO: Is there a better way for GCloud to pick up the credential?
)
) # Set GCloud Credentials by using the env var override.
# TODO: Is there a better way for GCloud to pick up the credential?
return task

return _use_gcp_secret

Expand Down

0 comments on commit e19efdf

Please sign in to comment.