-
Notifications
You must be signed in to change notification settings - Fork 216
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 fully qualified resource reference type #351
Add fully qualified resource reference type #351
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: killianmuldoon The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
0a0663d
to
29e3f73
Compare
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.
@sbueringer I'd appreciate your review on the API here. I wonder if we could also have KResourceObj that takes an interface that's able to get the GVK as well as the Name and Namespace which might make this easier to consume in some cases.
Could be nice, the problem is probably to get gvk out of an object without having to handle/return an error (for apiVersion parsing) |
@@ -156,3 +157,29 @@ func (ks kobjSlice) process() ([]interface{}, error) { | |||
} | |||
return objectRefs, nil | |||
} | |||
|
|||
// ResourceRef is a full Kubernetes resource reference composed of Group, Version, Kind, Namespace and Name. | |||
type ResourceRef struct { |
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.
Can you please check if this can be named as KResourceRef
now that there is no func KResourceRef(....)
?
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.
It feels slightly strange that KObj and KRef are functions while this would be a struct, but I'm happy to go either way on this if there's consensus.
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.
Good point. @pohly which one do you think would be more natural to the framework ?
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.
For the sake of clarity and usability, I prefer just the struct (see comment above) But for the sake of consistency we would have to use a function.
@serathius: what do you think?
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.
I agree with @pohly that struct should be preferred.
I'm not sure about the design the the API change:
|
Linking in the discussion about fully qualified object references in original structured logging kep kubernetes/enhancements#1367 (comment) @deads2k @derekwaynecarr @thockin @deads2k Was there any progress made with defining a grammar for K8s object references? |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
It might be necessary to join a meeting (presumably SIG apimachinery?) and discuss the grammar question there. |
/remove-lifecycle rotten |
To the best of my knowledge, nobody has tackled this definition. I don't have bandwidth in the near future but here's where I would start:
|
No, I was assigned today and haven't had the time to unassign myself. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale Still seems relevant, but needs someone to drive it. |
going to close this PR as a cleanup - but the issue is still open if someone has time to drive the change. |
/close |
@killianmuldoon: Closed this PR. In response to this:
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. |
This PR adds a new type -
ResourceReference
- and a function to use it which allows logging a fully qualified resource reference that allows logging Name, Namespace, Kind, Version and Group for an object.Fixes #350