Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
e35efb57
Commit
e35efb57
authored
Mar 29, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #23467 from mikedanese/dont-sync-deployment
Auto commit by PR queue bot
parents
e829a4a3
c4305762
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
controller.go
pkg/controller/daemon/controller.go
+1
-1
deployment_controller.go
pkg/controller/deployment/deployment_controller.go
+5
-0
deployment_controller_test.go
pkg/controller/deployment/deployment_controller_test.go
+25
-0
No files found.
pkg/controller/daemon/controller.go
View file @
e35efb57
...
@@ -627,7 +627,7 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
...
@@ -627,7 +627,7 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
everything
:=
unversioned
.
LabelSelector
{}
everything
:=
unversioned
.
LabelSelector
{}
if
reflect
.
DeepEqual
(
ds
.
Spec
.
Selector
,
&
everything
)
{
if
reflect
.
DeepEqual
(
ds
.
Spec
.
Selector
,
&
everything
)
{
dsc
.
eventRecorder
.
Eventf
(
ds
,
api
.
EventTypeWarning
,
"SelectingAll"
,
"This
controller is selecting all pods. Skipping sync
."
)
dsc
.
eventRecorder
.
Eventf
(
ds
,
api
.
EventTypeWarning
,
"SelectingAll"
,
"This
daemon set is selecting all pods. A non-empty selector is required
."
)
return
nil
return
nil
}
}
...
...
pkg/controller/deployment/deployment_controller.go
View file @
e35efb57
...
@@ -426,6 +426,11 @@ func (dc *DeploymentController) syncDeployment(key string) error {
...
@@ -426,6 +426,11 @@ func (dc *DeploymentController) syncDeployment(key string) error {
}
}
d
:=
obj
.
(
*
extensions
.
Deployment
)
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 selector is required."
)
return
nil
}
if
d
.
Spec
.
Paused
{
if
d
.
Spec
.
Paused
{
// TODO: Implement scaling for paused deployments.
// TODO: Implement scaling for paused deployments.
...
...
pkg/controller/deployment/deployment_controller_test.go
View file @
e35efb57
...
@@ -789,3 +789,28 @@ func TestSyncDeploymentCreatesReplicaSet(t *testing.T) {
...
@@ -789,3 +789,28 @@ func TestSyncDeploymentCreatesReplicaSet(t *testing.T) {
f
.
run
(
getKey
(
d
,
t
))
f
.
run
(
getKey
(
d
,
t
))
}
}
// issue: https://github.com/kubernetes/kubernetes/issues/23218
func
TestDeploymentController_dontSyncDeploymentsWithEmptyPodSelector
(
t
*
testing
.
T
)
{
fake
:=
&
fake
.
Clientset
{}
controller
:=
NewDeploymentController
(
fake
,
controller
.
NoResyncPeriodFunc
)
controller
.
eventRecorder
=
&
record
.
FakeRecorder
{}
controller
.
rsStoreSynced
=
alwaysReady
controller
.
podStoreSynced
=
alwaysReady
d
:=
newDeployment
(
1
,
nil
)
empty
:=
unversioned
.
LabelSelector
{}
d
.
Spec
.
Selector
=
&
empty
controller
.
dStore
.
Store
.
Add
(
d
)
// We expect the deployment controller to not take action here since it's configuration
// is invalid, even though no replicasets exist that match it's selector.
controller
.
syncDeployment
(
fmt
.
Sprintf
(
"%s/%s"
,
d
.
ObjectMeta
.
Namespace
,
d
.
ObjectMeta
.
Name
))
if
len
(
fake
.
Actions
())
==
0
{
return
}
for
_
,
action
:=
range
fake
.
Actions
()
{
t
.
Logf
(
"unexpected action: %#v"
,
action
)
}
t
.
Errorf
(
"expected deployment controller to not take action"
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment