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
Warn about implications on selector updates #3877
Conversation
@kubernetes/sig-apps-misc |
|
||
* Selector additions require the pod template labels in the Deployment spec to be updated with the new label, too, | ||
otherwise a validation error is returned. This change is a non-overlapping one, meaning that the new selector does | ||
not select ReplicaSets and Pods created with the old selector, resulting in orphaning all of those objects. Also, |
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.
The orphaning will also trigger garbage collection?
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.
No, the Deployment controller removes the owner refs from children that no longer match the parent label selector as per the owner ref proposal.
not select ReplicaSets and Pods created with the old selector, resulting in orphaning all of those objects. Also, | ||
note that changes in the PodTemplateSpec of the Deployment result in new rollouts, but a new ReplicaSet with Pods | ||
will be created anyway since the Deployment selector is not matching anything anymore. | ||
* Selector updates, ie. changing the existing value in a selector key, result in the same behavior as additions. |
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.
nit: s/ie./i.e./
* Selector additions require the pod template labels in the Deployment spec to be updated with the new label, too, | ||
otherwise a validation error is returned. This change is a non-overlapping one, meaning that the new selector does | ||
not select ReplicaSets and Pods created with the old selector, resulting in orphaning all of those objects. Also, | ||
note that changes in the PodTemplateSpec of the Deployment result in new rollouts, but a new ReplicaSet with Pods |
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.
changes in the PodTemplateSpec of the Deployment result in new rollouts
This could be a separate point entirely? A bit confusing when placed with creation of new RS-es.
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.
The points here are about selector {additions, updates, removals}, unrelated to creation of RSs.
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.
Yes, I meant that these were separate points:
- Changes to PodTemplateSpec results in new rollouts
- New ReplicaSet will be created since it isn't matching anything because of selector addition.
I think it just seemed a bit difficult to comprehend why those were stated together on my first pass.
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.
To elaborate, a selector addition will require from users to also update their Deployment pod templates too. That will result in the creation of a new ReplicaSet but the new RS will be created anyway since the Deployment is not matching anything due to having a new selector.
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.
Ok, I will drop 2. entirely and just mention that the new selector not matching anything will result in a new RS.
LGTM after comments |
@foxish thanks for the review, comments addressed and I also made it explicit during selector key removals that no orphaning or creation of RS is involved. |
Signed-off-by: Michail Kargakis <mkargaki@redhat.com>
@Kargakis Thanks for working on this! |
Fixes #1938
This change is