Skip to content
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

don't sync deployment when pod selector is empty #23467

Merged
merged 1 commit into from Mar 29, 2016

Conversation

mikedanese
Copy link
Member

@mikedanese mikedanese self-assigned this Mar 25, 2016
@k8s-github-robot
Copy link

Labelling this PR as size/XS

@k8s-github-robot k8s-github-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 25, 2016
@k8s-bot
Copy link

k8s-bot commented Mar 25, 2016

GCE e2e build/test passed for commit 3755f7f10f8d509cc060326b7df7c5f5566ec5d1.

for _, action := range fake.Actions() {
t.Logf("unexpected action: %#v", action)
}
t.Errorf("expected deployment controller to not take action")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On master this test fails with:

=== RUN TestDeploymentController_dontSyncDeploymentsWithEmptyPodSelector
--- FAIL: TestDeploymentController_dontSyncDeploymentsWithEmptyPodSelector (0.00s)
        deployment_controller_test.go:810: unexpected action: core.CreateActionImpl{ActionImpl:core.ActionImpl{Namespace:"default", Verb:"create", Resource:"replicasets", Subresource:""}, Object:(*extensions.ReplicaSet)(0xc2081238c0)}
        deployment_controller_test.go:810: unexpected action: core.UpdateActionImpl{ActionImpl:core.ActionImpl{Namespace:"default", Verb:"update", Resource:"deployments", Subresource:""}, Object:(*extensions.Deployment)(0xc208081b80)}
        deployment_controller_test.go:810: unexpected action: core.UpdateActionImpl{ActionImpl:core.ActionImpl{Namespace:"", Verb:"update", Resource:"replicasets", Subresource:""}, Object:(*extensions.ReplicaSet)(0xc208123b00)}
        deployment_controller_test.go:810: unexpected action: core.ListActionImpl{ActionImpl:core.ActionImpl{Namespace:"", Verb:"list", Resource:"pods", Subresource:""}, ListRestrictions:core.ListRestrictions{Labels:labels.nothingSelector{}, Fields:fields.andTerm{}}}
        deployment_controller_test.go:810: unexpected action: core.UpdateActionImpl{ActionImpl:core.ActionImpl{Namespace:"default", Verb:"update", Resource:"deployments", Subresource:"status"}, Object:(*extensions.Deployment)(0xc2081b6500)}
        deployment_controller_test.go:812: expected deployment controller to not take action
FAIL

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarification: WIthout the controller change, this test fails, as expected.

@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 25, 2016
@k8s-github-robot
Copy link

Labelling this PR as size/S

@k8s-github-robot k8s-github-robot removed the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 25, 2016
@k8s-github-robot
Copy link

Labelling this PR as size/M

@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 25, 2016
@k8s-bot
Copy link

k8s-bot commented Mar 25, 2016

GCE e2e build/test passed for commit f145b91540773de9b9de608d4862cfb75a1eddb7.

@k8s-bot
Copy link

k8s-bot commented Mar 25, 2016

GCE e2e build/test passed for commit 54c32f95d042fb2acc714f4cf80452ba6f0590c1.

@janetkuo janetkuo added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 25, 2016
@bgrant0607 bgrant0607 added this to the v1.2 milestone Mar 25, 2016
@@ -426,6 +426,11 @@ func (dc *DeploymentController) syncDeployment(key string) error {
}

d := obj.(*extensions.Deployment)
everything := unversioned.LabelSelector{}
if reflect.DeepEqual(d.Spec.Selector, &everything) {
dc.eventRecorder.Eventf(d, api.EventTypeWarning, "SelectingAll", "This controller is selecting all pods. Skipping sync.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/controller/Deployment/

I doubt "skipping sync" is very meaningful to users. How about "A non-empty selector is required."

@bgrant0607 bgrant0607 removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 25, 2016
@bgrant0607 bgrant0607 assigned bgrant0607 and janetkuo and unassigned janetkuo and bgrant0607 Mar 25, 2016
@mikedanese
Copy link
Member Author

@bgrant0607 @janetkuo I fixed both the daemon set and the deployment event message. PTAL

@@ -426,6 +426,11 @@ func (dc *DeploymentController) syncDeployment(key string) error {
}

d := obj.(*extensions.Deployment)
everything := unversioned.LabelSelector{}
if reflect.DeepEqual(d.Spec.Selector, &everything) {
dc.eventRecorder.Eventf(d, api.EventTypeWarning, "SelectingAll", "This deployment is selecting all pods. A non-empty sync is required.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/sync/selector/

@k8s-bot
Copy link

k8s-bot commented Mar 28, 2016

GCE e2e build/test passed for commit 8028751905beb2a250484826dda8cbcf2e668397.

@bgrant0607
Copy link
Member

Thanks much. LGTM

@bgrant0607 bgrant0607 assigned bgrant0607 and unassigned janetkuo Mar 28, 2016
@bgrant0607 bgrant0607 added lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Mar 28, 2016
@k8s-bot
Copy link

k8s-bot commented Mar 28, 2016

GCE e2e build/test passed for commit c430576.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Mar 29, 2016

GCE e2e build/test passed for commit c430576.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Mar 29, 2016

GCE e2e build/test passed for commit c430576.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Mar 29, 2016

GCE e2e build/test passed for commit c430576.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit e35efb5 into kubernetes:master Mar 29, 2016
@bgrant0607 bgrant0607 added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Mar 29, 2016
bgrant0607 added a commit that referenced this pull request Mar 30, 2016
…3530-#23467-upstream-release-1.2

Automated cherry pick of #23530 #23467
@bgrant0607 bgrant0607 added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Mar 30, 2016
@k8s-cherrypick-bot
Copy link

Commit found in the "release-1.2" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked.

shyamjvs pushed a commit to shyamjvs/kubernetes that referenced this pull request Dec 1, 2016
shouhong pushed a commit to shouhong/kubernetes that referenced this pull request Feb 14, 2017
openshift-publish-robot pushed a commit to openshift/kubernetes that referenced this pull request Jul 26, 2019
…from-kube

UPSTREAM: <carry>: remove embedded oauth server

Origin-commit: 68b25f8b2004119ef841feaf4a9f2c936b432363
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants