Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Add controller liveness probe with controller flow #36

Merged
merged 2 commits into from
Sep 26, 2019

Conversation

jasiu001
Copy link

Related to #29

Task #29 mentions about readiness probe but both work similarly: they check containers under a given endpoint periodically. The difference are:

  • if readiness failed then all trafic is not directed to the failed pod
  • if liveness failed then the container is restarted
    (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.

@jasiu001 jasiu001 added the area/service-management Issues or PRs related to service management label Sep 24, 2019
@jasiu001 jasiu001 added this to the Sprint_Gopher_26 milestone Sep 24, 2019
@@ -138,8 +138,8 @@ spec:
command:
- curl
- localhost:{{ .Values.ctrl.statusPort }}/live
periodSeconds: 10
timeoutSeconds: 2
periodSeconds: 300
Copy link
Contributor

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

}

lg.Infof("[liveness-probe] Creating liveness probe addonsConfiguration in %q namespace", probeNamespace)
err := client.Create(context.TODO(), addonsConfiguration)
Copy link
Contributor

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

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)
Copy link
Contributor

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to Errorf


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}
Copy link
Contributor

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

return false, nil
}
if err != nil {
return false, err
Copy link
Contributor

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 {
Copy link
Contributor

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

Copy link
Contributor

@mszostok mszostok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jasiu001 jasiu001 merged commit ed53a5a into SAP-archive:master Sep 26, 2019
@mszostok mszostok added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 23, 2019
@jasiu001 jasiu001 deleted the readiness-probe branch June 25, 2021 08:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/service-management Issues or PRs related to service management kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants