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

Add API to get the Kubeconfig for an arbitrary UCP resource #100

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

prkalle
Copy link
Contributor

@prkalle prkalle commented Sep 25, 2023

What this PR does / why we need it

This PR adds API to get the kubeconfig for an arbitrary UCP resource given the UCP context

Summary:

  • The new API ucp.GetKubeconfigForContext() would construct the kubeconfig for any arbitrary UCP resource of given UCP context. It reads the kubeconfig referred by the UCP context and then updates the kubeconfig's cluster.server url to point to the requested arbitrary resource.
  • Client is responsible to provide the valid project/space names. API would not be validating the correctness of project/space names
  • API would return error If the context type is not UCP.

Which issue(s) this PR fixes

Fixes #

Describe testing done for PR

Unit tests and CI passed

Release note

Add API to get the kubeconfig for an arbitrary UCP resource

Additional information

Special notes for your reviewer

ucp/kubeconfig/kubeconfig.go Outdated Show resolved Hide resolved
ucp/kubeconfig/kubeconfig.go Outdated Show resolved Hide resolved
@mpanchajanya
Copy link
Contributor

Also Could you add more details on PR description regarding the changes and new APIs. Thanks

Copy link
Contributor

@mpanchajanya mpanchajanya left a comment

Choose a reason for hiding this comment

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

lgtm! Thanks for the changes

Copy link
Contributor

@anujc25 anujc25 left a comment

Choose a reason for hiding this comment

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

Overall LGTM.

Just a minor comment about adding example usage around the API doc for retrieving kubeconfig for org/project/space.

Copy link
Contributor

@vuil vuil left a comment

Choose a reason for hiding this comment

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

lgtm, some nits and a general comment about processing the kubeconfig yaml more generically but not blocking.

ucp/internal/kubeconfig/types.go Outdated Show resolved Hide resolved
}

// AuthInfo contains information that describes identity information. This is use to tell the kubernetes cluster who you are.
type AuthInfo struct {
Copy link
Contributor

@vuil vuil Sep 28, 2023

Choose a reason for hiding this comment

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

We can go with this for now, but I would like to explore whether we can process the yaml in a more generic way so we don't have to copy/maintain all this information as a followup.

ucp/internal/kubeconfig/kubeconfig.go Outdated Show resolved Hide resolved
- Add API to get the kubeconfig for arbitrary UCP resource given the UCP context

Signed-off-by: Prem Kumar Kalle <[email protected]>
@prkalle prkalle merged commit df102b0 into vmware-tanzu:main Sep 28, 2023
4 checks passed
@marckhouzam marckhouzam added this to the v1.1.0 milestone Oct 20, 2023
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.

6 participants