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
dadce343
Commit
dadce343
authored
Feb 05, 2018
by
dmathieu
Committed by
dmathieu
Feb 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix golint warnings in daemon controller
The only on remaining asks to rename DaemonSetsController, which is a public interface and would need proper deprecation first.
parent
68da4562
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
9 deletions
+13
-9
.golint_failures
hack/.golint_failures
+0
-1
daemon_controller.go
pkg/controller/daemon/daemon_controller.go
+8
-3
daemon_controller_test.go
pkg/controller/daemon/daemon_controller_test.go
+4
-4
daemonset_util.go
pkg/controller/daemon/util/daemonset_util.go
+1
-1
No files found.
hack/.golint_failures
View file @
dadce343
...
@@ -100,7 +100,6 @@ pkg/controller/cloud
...
@@ -100,7 +100,6 @@ pkg/controller/cloud
pkg/controller/clusterroleaggregation
pkg/controller/clusterroleaggregation
pkg/controller/cronjob
pkg/controller/cronjob
pkg/controller/daemon
pkg/controller/daemon
pkg/controller/daemon/util
pkg/controller/deployment
pkg/controller/deployment
pkg/controller/deployment/util
pkg/controller/deployment/util
pkg/controller/disruption
pkg/controller/disruption
...
...
pkg/controller/daemon/daemon_controller.go
View file @
dadce343
...
@@ -63,13 +63,16 @@ import (
...
@@ -63,13 +63,16 @@ import (
)
)
const
(
const
(
// The value of 250 is chosen b/c values that are too high can cause registry DoS issues
// BurstReplicas is a rate limiter for booting pods on a lot of pods.
// The value of 250 is chosen b/c values that are too high can cause registry DoS issues.
BurstReplicas
=
250
BurstReplicas
=
250
//
If sending a status update to API server fails, we retry a finite number of time
s.
//
StatusUpdateRetries limits the number of retries if sending a status update to API server fail
s.
StatusUpdateRetries
=
1
StatusUpdateRetries
=
1
)
// Reasons for DaemonSet events
// Reasons for DaemonSet events
const
(
// SelectingAllReason is added to an event when a DaemonSet selects all Pods.
// SelectingAllReason is added to an event when a DaemonSet selects all Pods.
SelectingAllReason
=
"SelectingAll"
SelectingAllReason
=
"SelectingAll"
// FailedPlacementReason is added to an event when a DaemonSet can't schedule a Pod to a specified node.
// FailedPlacementReason is added to an event when a DaemonSet can't schedule a Pod to a specified node.
...
@@ -130,6 +133,7 @@ type DaemonSetsController struct {
...
@@ -130,6 +133,7 @@ type DaemonSetsController struct {
suspendedDaemonPods
map
[
string
]
sets
.
String
suspendedDaemonPods
map
[
string
]
sets
.
String
}
}
// NewDaemonSetsController creates a new DaemonSetsController
func
NewDaemonSetsController
(
daemonSetInformer
extensionsinformers
.
DaemonSetInformer
,
historyInformer
appsinformers
.
ControllerRevisionInformer
,
podInformer
coreinformers
.
PodInformer
,
nodeInformer
coreinformers
.
NodeInformer
,
kubeClient
clientset
.
Interface
)
(
*
DaemonSetsController
,
error
)
{
func
NewDaemonSetsController
(
daemonSetInformer
extensionsinformers
.
DaemonSetInformer
,
historyInformer
appsinformers
.
ControllerRevisionInformer
,
podInformer
coreinformers
.
PodInformer
,
nodeInformer
coreinformers
.
NodeInformer
,
kubeClient
clientset
.
Interface
)
(
*
DaemonSetsController
,
error
)
{
eventBroadcaster
:=
record
.
NewBroadcaster
()
eventBroadcaster
:=
record
.
NewBroadcaster
()
eventBroadcaster
.
StartLogging
(
glog
.
Infof
)
eventBroadcaster
.
StartLogging
(
glog
.
Infof
)
...
@@ -1320,6 +1324,7 @@ func (dsc *DaemonSetsController) nodeShouldRunDaemonPod(node *v1.Node, ds *exten
...
@@ -1320,6 +1324,7 @@ func (dsc *DaemonSetsController) nodeShouldRunDaemonPod(node *v1.Node, ds *exten
return
return
}
}
// NewPod creates a new pod
func
NewPod
(
ds
*
extensions
.
DaemonSet
,
nodeName
string
)
*
v1
.
Pod
{
func
NewPod
(
ds
*
extensions
.
DaemonSet
,
nodeName
string
)
*
v1
.
Pod
{
newPod
:=
&
v1
.
Pod
{
Spec
:
ds
.
Spec
.
Template
.
Spec
,
ObjectMeta
:
ds
.
Spec
.
Template
.
ObjectMeta
}
newPod
:=
&
v1
.
Pod
{
Spec
:
ds
.
Spec
.
Template
.
Spec
,
ObjectMeta
:
ds
.
Spec
.
Template
.
ObjectMeta
}
newPod
.
Namespace
=
ds
.
Namespace
newPod
.
Namespace
=
ds
.
Namespace
...
...
pkg/controller/daemon/daemon_controller_test.go
View file @
dadce343
...
@@ -84,12 +84,12 @@ var (
...
@@ -84,12 +84,12 @@ var (
)
)
func
getKey
(
ds
*
extensions
.
DaemonSet
,
t
*
testing
.
T
)
string
{
func
getKey
(
ds
*
extensions
.
DaemonSet
,
t
*
testing
.
T
)
string
{
if
key
,
err
:=
controller
.
KeyFunc
(
ds
);
err
!=
nil
{
key
,
err
:=
controller
.
KeyFunc
(
ds
)
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error getting key for ds %v: %v"
,
ds
.
Name
,
err
)
t
.
Errorf
(
"Unexpected error getting key for ds %v: %v"
,
ds
.
Name
,
err
)
return
""
}
else
{
return
key
}
}
return
key
}
}
func
newDaemonSet
(
name
string
)
*
extensions
.
DaemonSet
{
func
newDaemonSet
(
name
string
)
*
extensions
.
DaemonSet
{
...
...
pkg/controller/daemon/util/daemonset_util.go
View file @
dadce343
...
@@ -94,7 +94,7 @@ func CreatePodTemplate(template v1.PodTemplateSpec, generation int64, hash strin
...
@@ -94,7 +94,7 @@ func CreatePodTemplate(template v1.PodTemplateSpec, generation int64, hash strin
return
newTemplate
return
newTemplate
}
}
// IsPodUpdate checks if pod contains label value that either matches templateGeneration or hash
// IsPodUpdate
d
checks if pod contains label value that either matches templateGeneration or hash
func
IsPodUpdated
(
dsTemplateGeneration
int64
,
pod
*
v1
.
Pod
,
hash
string
)
bool
{
func
IsPodUpdated
(
dsTemplateGeneration
int64
,
pod
*
v1
.
Pod
,
hash
string
)
bool
{
// Compare with hash to see if the pod is updated, need to maintain backward compatibility of templateGeneration
// Compare with hash to see if the pod is updated, need to maintain backward compatibility of templateGeneration
templateMatches
:=
pod
.
Labels
[
extensions
.
DaemonSetTemplateGenerationKey
]
==
fmt
.
Sprint
(
dsTemplateGeneration
)
templateMatches
:=
pod
.
Labels
[
extensions
.
DaemonSetTemplateGenerationKey
]
==
fmt
.
Sprint
(
dsTemplateGeneration
)
...
...
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