Skip to content

Conversation

@swcho
Copy link
Contributor

@swcho swcho commented Jan 23, 2019

Thank you for your efforts on this project.

I'd like to add namespace in Context object and properly parsed from configuration file.

Thank you.

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please email the CNCF helpdesk: [email protected]

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jan 23, 2019
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jan 23, 2019
@itowlson
Copy link
Contributor

@swcho Thanks for the contribution! Can you clarify your intended scope here? It looks like this will surface the namespace in a kubeconfig to the JavaScript Context objects, but doesn't appear to use the namespace in any operations involving the context. Is that your intention?

@brendandburns
Copy link
Contributor

@itowlson I think that's a reasonable feature to support, since I don't think we can/should set the default namespace in the client via this parameter, but making it available to users of the client library makes sense.

@swcho you need to sign the CNCF CLA, also will you add a unit test to validate this behavior?

Thanks!

@swcho
Copy link
Contributor Author

swcho commented Jan 24, 2019

@itowlson
Thank you for reviewing.

It is somehow trivial change but as document described below namespace is one of configurable item and I think it is beneficial for developer to have access to it.
Define clusters, users, and contexts

Especially, on-premise kube cluster, not like kube cluster provisioned via major cloud vendor, namespace can be utilized to encapsulate service environment.

My use case is below. And I just want to have namespace access-able through official client library.
https://github.com/swcho/kube-eye/blob/486ebc5c5f562d95ff9b472517b99131e2140f30/src/server.tsx#L32-L39

@brendandburns
As soon as I have some time to make unit test, I will try it.

Thank you all for having some time to review.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 24, 2019
Copy link
Contributor

@drubin drubin left a comment

Choose a reason for hiding this comment

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

Some minor stylistic comments. But I think this would be a great addition.

Might even be nice to add an example showing the usage?

readonly cluster: string;
readonly user: string;
readonly name: string;
readonly namespace?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this not be just namespace like the others and set to undefined if not set?

cluster: elt.context.cluster,
name: elt.name,
user: (elt.context.user ? elt.context.user : undefined),
namespace: elt.context.namespace || undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we standise on one of the above to formats? Not sure which one is better though.

Copy link
Contributor

Choose a reason for hiding this comment

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

|| syntax is fine with me, and agree standardization is good.

@swcho
Copy link
Contributor Author

swcho commented Jan 28, 2019

@brendandburns

Sorry for late reply, I added simple test case for namespace access.

1695e27

Thank you.

@brendandburns
Copy link
Contributor

@swcho looks good to me, I added a suggestion based on @drubin 's comment above, if you're ok with that, then I think this is ready to merge.

Thanks

Thanks

Co-Authored-By: swcho <[email protected]>
@drubin
Copy link
Contributor

drubin commented Jan 29, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 29, 2019
@brendandburns
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, swcho

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 29, 2019
@k8s-ci-robot k8s-ci-robot merged commit 63cbc28 into kubernetes-client:master Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants