Handle overlapping deployments gracefully#30730
Conversation
|
@janetkuo should we print the overlapping deployments names, thus user knows which deployment should be updated. |
4253e18 to
1ee1e95
Compare
1ee1e95 to
60f057d
Compare
|
@adohe want to review this with me? |
|
cc @kubernetes/deployment |
|
@pwittrock I will review it today. |
|
Reviewed 1 of 4 files at r3. pkg/controller/deployment/deployment_controller.go, line 434 [r3] (raw file):
I thought we avoid syncing the new overlapping ones? pkg/controller/deployment/util/deployment_util.go, line 62 [r3] (raw file):
lets make this a little more in-your-face. Maybe test/e2e/deployment.go, line 1196 [r4] (raw file):
It is helpful to add a string here stating what you were trying to do when the error occurred. Comments from Reviewable |
|
pkg/controller/deployment/deployment_controller.go, line 456 [r4] (raw file):
Nice catch. Comments from Reviewable |
|
pkg/controller/deployment/util/deployment_util.go, line 62 [r3] (raw file):
|
| if len(deployments) > 1 { | ||
| sort.Sort(byCreationTimestamp(deployments)) | ||
| glog.Errorf("user error! more than one deployment is selecting replica set %s/%s with labels: %#v, returning %s/%s", rs.Namespace, rs.Name, rs.Labels, deployments[0].Namespace, deployments[0].Name) | ||
| glog.V(4).Infof("More than one deployment is selecting replica set %s/%s: %#v", rs.Namespace, rs.Name, deployments) |
There was a problem hiding this comment.
Is there any value to this log since you already log it above?
|
Review status: 1 of 5 files reviewed at latest revision, 9 unresolved discussions. pkg/controller/deployment/deployment_controller.go, line 435 [r4] (raw file):
|
|
Thank you all for the comments; code updated, ptal @pwittrock @adohe @Kargakis @deads2k |
cd9a928 to
1cf3412
Compare
|
GCE e2e build/test passed for commit cd9a9283c72e1ddc438769fdab250ae07190ebb6. |
|
GCE e2e build/test passed for commit 1cf3412. |
|
ptal |
| // RollbackDone is the done rollback event reason | ||
| RollbackDone = "DeploymentRollback" | ||
| // OverlapAnnotation marks deployments with overlapping selector with other deployments | ||
| // TODO: Delete this annotation when we gracefully handle overlapping selectors. |
There was a problem hiding this comment.
How are we going to do this? Is there any issue open?
There was a problem hiding this comment.
With controller reference and/or auto-generated selectors, see #2210
|
Two more questions, LGTM otherwise |
1cf3412 to
3e43414
Compare
1. When overlapping deployments are discovered, annotate them 2. Expose those overlapping annotations as warnings in kubectl describe 3. Only respect the earliest updated one (skip syncing all other overlapping deployments) 4. Use indexer instead of store for deployment lister
3e43414 to
c5cef18
Compare
|
+lgtm Reviewed 1 of 7 files at r9, 4 of 5 files at r12, 1 of 3 files at r14, 4 of 4 files at r15. pkg/client/cache/listers.go, line 305 [r14] (raw file):
|
|
GCE e2e build/test passed for commit 3e4341456918e6effe0977ebb86f1afeacf3f214. |
|
GCE e2e build/test passed for commit c5cef18. |
|
Comments from Reviewable |
|
Also please don't forget squash before merge. |
|
Yeah already squashed |
|
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
|
GCE e2e build/test passed for commit c5cef18. |
|
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
|
GCE e2e build/test passed for commit c5cef18. |
|
Automatic merge from submit-queue |
Fixes #30028
This change is