-
Notifications
You must be signed in to change notification settings - Fork 296
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
Use value from ContextDetails to populate Namespace #373
Use value from ContextDetails to populate Namespace #373
Conversation
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.
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. |
Welcome @rynowak! |
I signed it |
/assign @brendandburns |
// This serves as validation for any of the properties of ContextDetails being set. | ||
// Other locations in code assume that ContextDetails is non-null. | ||
throw new KubeConfigException($"Cluster not set for context `{currentContext}` in kubeconfig"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this validation because I see a bunch of code running after this at assumes activeContext.ContextDetails
is null, and it will crash with a null-ref based on invalid config data.
This is a fix for: kubernetes-client#372 This change uses the value from ContextDetails.Namespace to populate KubernetesClientConfiguration.Namespace. The issue is there's a Namespace property on both Context and ContextDetails - The property on Context is used today - The property on ContextDetails is not - The property on ContextDetails maps to the actual yaml config
This property doesn't map to anything in the YAML and thus will never be set. Other clients I checked (java, golang) don't look for a property at this level. I think this was likely a mistake, and it should be obsoleted because it will never be populated. Example: ```yaml contexts: - context: cluster: ... namespace: ... # this is ContextDetails.Namespace user: ... name: foo ``` ```yaml contexts: - context: cluster: ... namespace: ... user: ... name: foo namespace: ... # this is Context.Namespace ```
e774afe
to
e687129
Compare
/LGTM |
/lgtm Thanks for the PR! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns, rynowak 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 |
Use value from ContextDetails to populate Namespace
Fixes: #372
This change uses the value from ContextDetails.Namespace to populate
KubernetesClientConfiguration.Namespace.
The issue is there's a Namespace property on both Context and ContextDetails
Obsolete Context.Namespace
I did a separate commit for this so we can skip it if you don't want it. Reasonable people disagree on whether its good semver to obsolete something in a patch/minor release. I'd like some confirmation as well about whether this property is supposed to be there for some reason
This property doesn't map to anything in the YAML and thus will never be
set. Other clients I checked (java, golang) don't look for a property
at this level.
I think this was likely a mistake, and it should be obsoleted because
it will never be populated.
Example: