Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ARM
k8s
Kured
Commits
91bf84a9
Commit
91bf84a9
authored
Sep 21, 2017
by
Adam Harrison
Browse files
Convert period arg to time.Duration
parent
4e4b6f06
Changes
2
Hide whitespace changes
Inline
Side-by-side
cmd/kured/main.go
View file @
91bf84a9
...
...
@@ -21,7 +21,7 @@ import (
var
(
version
=
"unreleased"
period
int
period
time
.
Duration
dsNamespace
string
dsName
string
lockAnnotation
string
...
...
@@ -38,8 +38,8 @@ func main() {
Short
:
"Kubernetes Reboot Daemon"
,
Run
:
root
}
rootCmd
.
PersistentFlags
()
.
Int
Var
(
&
period
,
"period"
,
60
,
"reboot check period
in minutes
"
)
rootCmd
.
PersistentFlags
()
.
Duration
Var
(
&
period
,
"period"
,
time
.
Minute
*
60
,
"reboot check period"
)
rootCmd
.
PersistentFlags
()
.
StringVar
(
&
dsNamespace
,
"ds-name"
,
"kube-system"
,
"namespace containing daemonset on which to place lock"
)
rootCmd
.
PersistentFlags
()
.
StringVar
(
&
dsName
,
"ds-namespace"
,
"kured"
,
...
...
@@ -219,7 +219,7 @@ func root(cmd *cobra.Command, args []string) {
log
.
Infof
(
"Node ID: %s"
,
nodeID
)
log
.
Infof
(
"Lock Annotation: %s/%s:%s"
,
dsNamespace
,
dsName
,
lockAnnotation
)
log
.
Infof
(
"Reboot Sentinel: %s every %
d minutes
"
,
rebootSentinel
,
period
)
log
.
Infof
(
"Reboot Sentinel: %s every %
v
"
,
rebootSentinel
,
period
)
config
,
err
:=
rest
.
InClusterConfig
()
if
err
!=
nil
{
...
...
@@ -242,7 +242,7 @@ func root(cmd *cobra.Command, args []string) {
}
source
:=
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
())
tick
:=
delaytick
.
New
(
source
,
time
.
Minute
*
time
.
Duration
(
period
)
)
tick
:=
delaytick
.
New
(
source
,
period
)
for
_
=
range
tick
{
if
rebootRequired
()
&&
!
rebootBlocked
()
{
node
,
err
:=
client
.
CoreV1
()
.
Nodes
()
.
Get
(
nodeID
)
...
...
kured-ds.yaml
View file @
91bf84a9
...
...
@@ -20,7 +20,7 @@ spec:
# - --ds-name=kube-system
# - --ds-namespace=kured
# - --lock-annotation=weave.works/kured-node-lock
# - --period=
60
# - --period=
1h
# - --prometheus-url=http://prometheus.monitoring.svc.cluster.local
# - --reboot-sentinel=/var/run/reboot-required
# - --slack-hook-url=https://hooks.slack.com/...
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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