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

[SDK] Use Training Client without Kube Config #1740

Merged
merged 2 commits into from
Jan 24, 2023

Conversation

andreyvelich
Copy link
Member

This change will allow user to create TrainingClient without kube config using Client Configuration and Bearer Token.
It is useful for remote-like and enterprise usage of our SDK.

Similar to this example: https://github.com/kubernetes-client/python/blob/67f9c7a97081b4526470cad53576bc3b71fa6fcc/examples/remote_cluster.py#L31

/assign @kubeflow/wg-training-leads @tenzen-y @anencore94

@coveralls
Copy link

coveralls commented Jan 24, 2023

Pull Request Test Coverage Report for Build 3997111929

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.06%) to 38.906%

Files with Coverage Reduction New Missed Lines %
pkg/controller.v1/mpi/mpijob_controller.go 5 77.23%
Totals Coverage Status
Change from base Build 3985605283: -0.06%
Covered Lines: 2674
Relevant Lines: 6873

💛 - Coveralls

Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

@andreyvelich Thanks for this work!
This is very useful!
/lgtm

config_file: str = None,
context: str = None,
client_configuration: client.Configuration = None,
no_config: bool = False,
Copy link
Member

Choose a reason for hiding this comment

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

This is not necessary? If client_configuration is not None, then it should take precedence over config_file

Copy link
Member

@tenzen-y tenzen-y Jan 24, 2023

Choose a reason for hiding this comment

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

If we remove no_config, I guess we can not inform about missing client_configuration, right?
WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

@tenzen-y is right . I did this since user can set config_file and client_configuration to add additional information about the config at the same time.

Copy link
Member Author

Choose a reason for hiding this comment

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

We had discussion with @johnugeorge around this.

I guess kube-config supports all configuration that user can set via client.Configuration() object (proxy, token. etc.).
@terrytangyuan @tenzen-y Did you ever see the use-case when user wants to set custom client_configuration with existing kube-config ?

If not, we can do this:

  • If user set config_file use load_kube_config().
  • If user doesn't set config_file and doesn't set client_configuration use load_kube_config() or load_incluster_config().
  • If user set client_configuration skip load_kube_config() and load_incluster_config().

no_config flag might look a bit hacky.

Copy link
Member

Choose a reason for hiding this comment

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

No, I have not seen that use case.

Copy link
Member Author

Choose a reason for hiding this comment

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

@tenzen-y @terrytangyuan @johnugeorge I modified the PR to ignore kube config when client_configuration is set.
Let's see if we get any user request to change it back.

@google-oss-prow google-oss-prow bot removed the lgtm label Jan 24, 2023
config_file=None,
context=None,
client_configuration=None,
persist_config=True,
Copy link
Member

Choose a reason for hiding this comment

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

@andreyvelich Is it possible to set a persistent_config with a client_configuration?

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 persistent_config is used when we send client_configuration to load_kube_config() for Kubernetes python client.

Copy link
Member

Choose a reason for hiding this comment

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

It makes sense.

@tenzen-y
Copy link
Member

@google-oss-prow google-oss-prow bot added the lgtm label Jan 24, 2023
@andreyvelich
Copy link
Member Author

Also, can we introduce the same improvement to Katib?

Sure, I submit PR before the release once @terrytangyuan @johnugeorge agree on that change.

@johnugeorge
Copy link
Member

LGTM
/assign @terrytangyuan

@terrytangyuan
Copy link
Member

Thanks!

/lgtm
/approve

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andreyvelich, terrytangyuan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 0736e93 into kubeflow:master Jan 24, 2023
@andreyvelich andreyvelich deleted the sdk-no-config-flag branch January 24, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants