-
Notifications
You must be signed in to change notification settings - Fork 40.6k
Events can not reference objects that use a different name validation #127594
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
Comments
The first solution you propose will likely make the As for changing the name in the client, we will need to completely get rid of the regarded object name, otherwise the validation will never pass for IPAddresses because of the ':' character. But that would be quite a big change since AFAIK Events have always had that form and I am also not sure if any code was built with that naming structure in mind. Another option could be to soften the event validation from:
This check was added for the events/v1 API only, the core/v1 Events' name was never validated before and that's still the case today. I found some context for that change in #91645 (comment), and it sounds fairly safe to soften the validation to support IPv6 values. /cc @wojtek-t |
There are a few types which use name formats which are not DNS-subdomain compatible:
As as aside: I wish we had not done this and I REALLY wish we had not used I don't think it's a valid assumption that the "regarding" object's name can be the basis for the event's name. It's not at all a safe guarantee, and "name" is mostly irrelevant to events. It's common to have deployments and services named the same thing, so I could have events about both and they would just be mixed together. staging/src/k8s.io/client-go/tools/events/event_recorder.go
It might be better to use the refRegarding.UID if the goal is to collate events, but the UID may not be present. So maybe |
/assign |
Yes that's true, even kubectl doesn't show the event name by default, you'd have to specify -owide to see it, so I doubt anyone really use the names and it is very unlikely that users would delete or get specific events by name.
We are already combining events client-side based on the following fields:
I don't think there are use-cases where anyone would need the name to have any particular meaning as all the relevant information to visualize and manage events are already present in the other fields. We have a notion of event key in both implementations to merge similar events together, maybe we could reuse that and encode it? core/v1 client code ref: kubernetes/staging/src/k8s.io/client-go/tools/record/events_cache.go Lines 52 to 83 in d99d3f7
|
+1
+1 to that - this logic was created to distinguish whether two events are about the same or about different things. Making a name to be function of it makes perfect sense to me. |
@dgrisonnet @wojtek-t I'd like to get this merged #129790 (comment) and also explain why I think the proposal I'm sending of normalizing the name instead of using the event key is better. To generate the eventKey you need to first create the event objects, so the code will look like
I don't feel that adding this kind of pattern of generating a name of an object based on the same object without a field is ideal and just normalizing is more simpler |
After this comment from @liggitt #129790 (comment) I may step back on my proposal, scratch my previous comment |
I think it is fine for events since we don't use their name to generate the keys or anything else. This field is just here because events are Kubernetes objects and they must have a name. |
hmmm , we still have the same problem, the event key is not guaranteed to pass the event object name validation |
I changed the approach #129790
|
Seen in #127588
An IPAddress object can contain an IPv6 address
fd00:10:233::103
The event recorder creates a new Event object based on the referenced object
kubernetes/staging/src/k8s.io/client-go/tools/events/event_recorder.go
Lines 67 to 75 in 464a994
I can see two options:
r.recorder.Eventf
to make valid names on the Events objectsThe result will be the same with 1 or 2, the difference is that option 2. will be valid for all the objects that use names not valid for the existing Events validation
/sig instrumentation
The text was updated successfully, but these errors were encountered: