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

Support namespace configuration when using dex with kfp #1081

Merged
merged 4 commits into from
Nov 19, 2020

Conversation

akchinSTC
Copy link
Member

@akchinSTC akchinSTC commented Nov 18, 2020

Add user_namespace field to kfp metadata schema and
update kfp processor to allow submission of pipelines
to a dex enabled kfp cluster

Fixes #1053

Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the Apache License 2.0; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

@elyra-bot
Copy link

elyra-bot bot commented Nov 18, 2020

Thanks for making a pull request to Elyra!

To try out this branch on binder, follow this link: Binder

@lresende
Copy link
Member

Could you please add the related issue to the description...

@lresende lresende requested a review from kevin-bates November 18, 2020 00:55

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add user_namespace field to kfp metadata schema and
update kfp processor to allow submission of pipelines
to a dex enabled kfp cluster

Fixes elyra-ai#1053
@lresende lresende added this to the 1.4.2 milestone Nov 18, 2020
Copy link
Member

@lresende lresende left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lresende
Copy link
Member

@akchinSTC Should I wait for @reevejd feedback before merging?

@akchinSTC
Copy link
Member Author

@lresende - yes lets wait until he responds. He will be testing first thing in the morning.

Copy link
Member

@kevin-bates kevin-bates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good Alan - thanks.
(I'm assuming you confirmed that runtime_configuration.metadata['user_namespace'] is None when a user namespace value is not specified.)

@kevin-bates
Copy link
Member

Thanks for the last update. I'm afk but will look into the metadata behavior tomorrow. I think we should be able to use something like .get('user_namespace') and should look why that isn't happening. I may also be misremembering things. 🙂

@kevin-bates
Copy link
Member

I think the issue with user_namespace being the empty string when the intention is to not set is the front-end issue that they always set a value, in this case the empty string. I believe this is because they can't distinguish between null and the empty string in the UI. As a result, the user_namespace field will always have a "value" - and logic like Alan has provided will be necessary since that field is persisted with a value of an empty string.

Were the UI able to distinguish "set" vs. "not set", then they could simply not include user_namespace in the metadata when it is created in the first place resulting in the object's persistence w/o user_namespace.

In fact, we should probably add an existence check to see if the key (user_namespace) is present just in case this occurs. I believe the CLI tool could probably create such an instance (i.e., one where no user_namespace field is persisted).

@@ -50,6 +50,10 @@ def process(self, pipeline):
cos_endpoint = runtime_configuration.metadata['cos_endpoint']
cos_bucket = runtime_configuration.metadata['cos_bucket']

user_namespace = None
if runtime_configuration.metadata['user_namespace']:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per my last comment I recommend the following:

Suggested change
if runtime_configuration.metadata['user_namespace']:
if 'user_namespace' in runtime_configuration.metadata and runtime_configuration.metadata['user_namespace']:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or use get('user_namespace')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lresende - removing the if statement and using get('user_namespace') when using an empty user_namespace field in the runtime metadata returns the original error in the issue. Issue with using get atm is that it will never return None since the user_namespace key will always exist in the metadata dict, even when the field is empty.
@kevin-bates - Since the key will always exist, the extra check for the key in metadata is redundant. I think the current check should be enough where an empty string would be considered "falsy"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think once the front-end issue is resolved, the key won't exist when no value is present because it won't be persisted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement (directly from the docs) should produce an instance in which user_namespace is not persisted and is valid metadata:

elyra-metadata install runtimes --schema_name=kfp \
       --name=my_kfp \
       --display_name="My Kubeflow Pipeline Runtime" \
       --api_endpoint=https://kubernetes-service.ibm.com/pipeline \
       --api_username=username@email.com \
       --api_password=mypassword \
       --cos_endpoint=http://minio-service.kubeflow:9000 \
       --cos_username=minio \
       --cos_password=minio123 \
       --cos_bucket=test-bucket

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think once the front-end issue is resolved, the key won't exist when no value is present because it won't be persisted.

Ive opened #1087 for this. Should we wait then until that issue is fixed and merged before merging this one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to revisit this if you add the field existence test now. This does mean a condition will be required before the .get() call.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note that the condition can occur now via the CLI tool. You should be able to produce a KeyError if not setting a user_namespace value (and without adding the field existence test).

@reevejd
Copy link

reevejd commented Nov 18, 2020

@akchinSTC Should I wait for @reevejd feedback before merging?

I can confirm that @akchinSTC 's fix is working. Thanks a bunch!

@kevin-bates
Copy link
Member

Excellent. Thank you for all your help with this James. Alan - great (and simple) fix! (The best kind there is!)

@lresende lresende merged commit 39d2a98 into elyra-ai:master Nov 19, 2020
lresende pushed a commit that referenced this pull request Nov 19, 2020
Add user_namespace field to kfp metadata schema and
update kfp processor to allow submission of pipelines
to a dex enabled kfp cluster

Fixes #1053
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants