Skip to content
GitLab
Menu
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 (
...
@@ -21,7 +21,7 @@ import (
var
(
var
(
version
=
"unreleased"
version
=
"unreleased"
period
int
period
time
.
Duration
dsNamespace
string
dsNamespace
string
dsName
string
dsName
string
lockAnnotation
string
lockAnnotation
string
...
@@ -38,8 +38,8 @@ func main() {
...
@@ -38,8 +38,8 @@ func main() {
Short
:
"Kubernetes Reboot Daemon"
,
Short
:
"Kubernetes Reboot Daemon"
,
Run
:
root
}
Run
:
root
}
rootCmd
.
PersistentFlags
()
.
Int
Var
(
&
period
,
"period"
,
60
,
rootCmd
.
PersistentFlags
()
.
Duration
Var
(
&
period
,
"period"
,
time
.
Minute
*
60
,
"reboot check period
in minutes
"
)
"reboot check period"
)
rootCmd
.
PersistentFlags
()
.
StringVar
(
&
dsNamespace
,
"ds-name"
,
"kube-system"
,
rootCmd
.
PersistentFlags
()
.
StringVar
(
&
dsNamespace
,
"ds-name"
,
"kube-system"
,
"namespace containing daemonset on which to place lock"
)
"namespace containing daemonset on which to place lock"
)
rootCmd
.
PersistentFlags
()
.
StringVar
(
&
dsName
,
"ds-namespace"
,
"kured"
,
rootCmd
.
PersistentFlags
()
.
StringVar
(
&
dsName
,
"ds-namespace"
,
"kured"
,
...
@@ -219,7 +219,7 @@ func root(cmd *cobra.Command, args []string) {
...
@@ -219,7 +219,7 @@ func root(cmd *cobra.Command, args []string) {
log
.
Infof
(
"Node ID: %s"
,
nodeID
)
log
.
Infof
(
"Node ID: %s"
,
nodeID
)
log
.
Infof
(
"Lock Annotation: %s/%s:%s"
,
dsNamespace
,
dsName
,
lockAnnotation
)
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
()
config
,
err
:=
rest
.
InClusterConfig
()
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -242,7 +242,7 @@ func root(cmd *cobra.Command, args []string) {
...
@@ -242,7 +242,7 @@ func root(cmd *cobra.Command, args []string) {
}
}
source
:=
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
())
source
:=
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
())
tick
:=
delaytick
.
New
(
source
,
time
.
Minute
*
time
.
Duration
(
period
)
)
tick
:=
delaytick
.
New
(
source
,
period
)
for
_
=
range
tick
{
for
_
=
range
tick
{
if
rebootRequired
()
&&
!
rebootBlocked
()
{
if
rebootRequired
()
&&
!
rebootBlocked
()
{
node
,
err
:=
client
.
CoreV1
()
.
Nodes
()
.
Get
(
nodeID
)
node
,
err
:=
client
.
CoreV1
()
.
Nodes
()
.
Get
(
nodeID
)
...
...
kured-ds.yaml
View file @
91bf84a9
...
@@ -20,7 +20,7 @@ spec:
...
@@ -20,7 +20,7 @@ spec:
# - --ds-name=kube-system
# - --ds-name=kube-system
# - --ds-namespace=kured
# - --ds-namespace=kured
# - --lock-annotation=weave.works/kured-node-lock
# - --lock-annotation=weave.works/kured-node-lock
# - --period=
60
# - --period=
1h
# - --prometheus-url=http://prometheus.monitoring.svc.cluster.local
# - --prometheus-url=http://prometheus.monitoring.svc.cluster.local
# - --reboot-sentinel=/var/run/reboot-required
# - --reboot-sentinel=/var/run/reboot-required
# - --slack-hook-url=https://hooks.slack.com/...
# - --slack-hook-url=https://hooks.slack.com/...
...
...
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