Skip to content

Conversation

pooknull
Copy link
Contributor

@pooknull pooknull commented Jul 24, 2025

K8SPS-465 Powered by Pull Request Badge

https://perconadev.atlassian.net/browse/K8SPS-465

DESCRIPTION

This PR adds liveness and readiness probes to haproxy pods

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PS version?
  • Does the change support oldest and newest supported Kubernetes version?

@pull-request-size pull-request-size bot added the size/L 100-499 lines label Jul 24, 2025
@hors hors added this to the v0.12.0 milestone Aug 4, 2025
@pooknull pooknull marked this pull request as ready for review August 12, 2025 10:48
hors
hors previously approved these changes Aug 15, 2025
Comment on lines 324 to 325
ReadinessProbe: &readinessProbe,
LivenessProbe: &livenessProbe,
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 294 to 314
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...)

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 296 to 303
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"},
}
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pooknull pooknull requested review from gkech and egegunes August 21, 2025 08:30
@JNKPercona
Copy link
Collaborator

Test name Status
version-service passed
async-ignore-annotations passed
auto-config passed
config passed
config-router passed
demand-backup passed
async-data-at-rest-encryption passed
gr-data-at-rest-encryption passed
gr-demand-backup passed
gr-demand-backup-haproxy passed
gr-finalizer passed
gr-haproxy passed
gr-ignore-annotations passed
gr-init-deploy passed
gr-one-pod passed
gr-recreate passed
gr-scaling passed
gr-scheduled-backup passed
gr-security-context passed
gr-self-healing passed
gr-tls-cert-manager passed
gr-users passed
haproxy passed
init-deploy passed
limits passed
monitoring passed
one-pod passed
operator-self-healing passed
recreate passed
scaling passed
scheduled-backup passed
service-per-pod passed
sidecars passed
smart-update passed
storage passed
tls-cert-manager passed
users passed
pvc-resize passed
We run 38 out of 38

commit: d7710be
image: perconalab/percona-server-mysql-operator:PR-975-d7710be1

@hors hors merged commit 7263f65 into main Aug 26, 2025
11 of 13 checks passed
@hors hors deleted the K8SPS-465 branch August 26, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L 100-499 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants