Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sample): add note about secret needing to be pre-created #10659

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion samples/v2/pipeline_with_secret_as_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
from kfp import dsl
from kfp import kubernetes

# Note: this sample will only work if this secret is pre-created before running this pipeline.
# Is is pre-created by default only in the Google Cloud distribution listed here:
# https://www.kubeflow.org/docs/started/installing-kubeflow/#packaged-distributions-of-kubeflow
# If you are using a different distribution, you'll need to pre-create the secret yourself, or
# use a different secret that you know will exist.
SECRET_NAME = "user-gcp-sa"

@dsl.component
def comp():
Expand All @@ -34,7 +40,7 @@ def pipeline_secret_env():
task = comp()
kubernetes.use_secret_as_env(
task,
secret_name='user-gcp-sa',
secret_name=SECRET_NAME,
secret_key_to_env={'type': 'SECRET_VAR'})


Expand Down
8 changes: 7 additions & 1 deletion samples/v2/pipeline_with_secret_as_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
from kfp import kubernetes
from kfp import compiler

# Note: this sample will only work if this secret is pre-created before running this pipeline.
# Is is pre-created by default only in the Google Cloud distribution listed here:
# https://www.kubeflow.org/docs/started/installing-kubeflow/#packaged-distributions-of-kubeflow
# If you are using a different distribution, you'll need to pre-create the secret yourself, or
# use a different secret that you know will exist.
SECRET_NAME = "user-gcp-sa"

@dsl.component
def comp():
Expand Down Expand Up @@ -49,7 +55,7 @@ def comp():
def pipeline_secret_volume():
task = comp()
kubernetes.use_secret_as_volume(
task, secret_name='user-gcp-sa', mount_path='/mnt/my_vol')
task, secret_name=SECRET_NAME, mount_path='/mnt/my_vol')


if __name__ == '__main__':
Expand Down