-
Notifications
You must be signed in to change notification settings - Fork 31
K8SPS-465: add liveness and readiness probes to haproxy #975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
pkg/haproxy/haproxy.go
Outdated
ReadinessProbe: &readinessProbe, | ||
LivenessProbe: &livenessProbe, |
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.
Should we have a version check for adding these? If I'm not mistaken, we discussed that at some point that we should for ps operator.
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.
pkg/haproxy/haproxy.go
Outdated
readinessProbe := spec.ReadinessProbe | ||
readinessProbe.Exec = &corev1.ExecAction{ | ||
Command: []string{"/opt/percona/haproxy_readiness_check.sh"}, | ||
} | ||
livenessProbe := spec.LivenessProbe | ||
livenessProbe.Exec = &corev1.ExecAction{ | ||
Command: []string{"/opt/percona/haproxy_liveness_check.sh"}, | ||
} | ||
|
||
probsEnvs := []corev1.EnvVar{ | ||
{ | ||
Name: "LIVENESS_CHECK_TIMEOUT", | ||
Value: fmt.Sprint(livenessProbe.TimeoutSeconds), | ||
}, | ||
{ | ||
Name: "READINESS_CHECK_TIMEOUT", | ||
Value: fmt.Sprint(readinessProbe.TimeoutSeconds), | ||
}, | ||
} | ||
env = append(env, probsEnvs...) | ||
|
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.
We can add a test case for the probes in haproxy_test.go
checking that the probe handlers have the right exec command, that the various seconds configs exist and also that the env vars used by the probe bash scripts are set up properly.
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.
pkg/haproxy/haproxy.go
Outdated
readinessProbe = &spec.ReadinessProbe | ||
readinessProbe.Exec = &corev1.ExecAction{ | ||
Command: []string{"/opt/percona/haproxy_readiness_check.sh"}, | ||
} | ||
livenessProbe = &spec.LivenessProbe | ||
livenessProbe.Exec = &corev1.ExecAction{ | ||
Command: []string{"/opt/percona/haproxy_liveness_check.sh"}, | ||
} |
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.
i think we can use k8s.ExecProbe
here
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.
commit: d7710be |
https://perconadev.atlassian.net/browse/K8SPS-465
DESCRIPTION
This PR adds liveness and readiness probes to haproxy pods
CHECKLIST
Jira
Needs Doc
) and QA (Needs QA
)?Tests
Config/Logging/Testability