-
Notifications
You must be signed in to change notification settings - Fork 21
Add controller liveness probe with controller flow #36
Conversation
@@ -138,8 +138,8 @@ spec: | |||
command: | |||
- curl | |||
- localhost:{{ .Values.ctrl.statusPort }}/live | |||
periodSeconds: 10 | |||
timeoutSeconds: 2 | |||
periodSeconds: 300 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
liveness with 5minutes periods? maybe start with 1minute, processing such event should not kill us. IMO 5min is definitely too much
internal/health/health.go
Outdated
} | ||
|
||
lg.Infof("[liveness-probe] Creating liveness probe addonsConfiguration in %q namespace", probeNamespace) | ||
err := client.Create(context.TODO(), addonsConfiguration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you already have the context in req *http.Request
just pass that into this function
internal/health/health.go
Outdated
lg.Infof("[liveness-probe] Creating liveness probe addonsConfiguration in %q namespace", probeNamespace) | ||
err := client.Create(context.TODO(), addonsConfiguration) | ||
if err != nil { | ||
lg.Infof("[liveness-probe] Cannot create liveness probe addonsConfiguration: %s", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lg.Infof
? same question for other occurrences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to Errorf
internal/health/health.go
Outdated
|
||
lg.Info("[liveness-probe] Waiting for liveness probe clusterAddonsConfiguration desirable status") | ||
err = wait.Poll(1*time.Second, 10*time.Second, func() (done bool, err error) { | ||
key := types.NamespacedName{Name: probeName, Namespace: v1.NamespaceAll} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u didn't need to set namespace there
internal/health/health.go
Outdated
return false, nil | ||
} | ||
if err != nil { | ||
return false, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't return err, log it
lg.Info("[liveness-probe] Liveness probe addonsConfiguration not found") | ||
return false, nil | ||
} | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't return error, log it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Related to #29
Task #29 mentions about readiness probe but both work similarly: they check containers under a given endpoint periodically. The difference are:
(additionally readiness is run at the beggining to check if traffic can be directed to pod)
According to this bug liveness probe is IMO more desirable, the container should be restarted if the controller cannot handle resources.