-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Pod annotations cannot contain duplicate keys when combining pod templates #220
Conversation
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.
Please clarify the template inheritance precedence - ideally add a test to prove it.
podAnnotations.addAll(template.getAnnotations()); | ||
|
||
podAnnotations.addAll(parent.getAnnotations()); |
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.
Maybe I am wrong, but this looks like the precedence favors parent
, not as you write, template
:
changed precedence so that the template will override the parent in inheritance.
Why do you want to change the precedence in the first place? Reading the documentation, I would expect the template
to have precedence.
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 thought the same but actually he is right
https://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html#add(E)
Adds the specified element to this set if it is not already present.
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.
You are right, makes sense when you think about it.
podAnnotations.addAll(template.getAnnotations()); | ||
|
||
podAnnotations.addAll(parent.getAnnotations()); |
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 thought the same but actually he is right
https://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html#add(E)
Adds the specified element to this set if it is not already present.
Added equals and hashCode overrides to podAnnotations so that combining doesn't allow duplicate keys Also, changed precedence so that the template will override the parent in inheritance.