Skip to content

Use pg_isready health checks for PostgreSQL#129

Merged
openshift-merge-bot[bot] merged 1 commit into
openstack-lightspeed:lcore-migrationfrom
umago:postgres-health
Jul 2, 2026
Merged

Use pg_isready health checks for PostgreSQL#129
openshift-merge-bot[bot] merged 1 commit into
openstack-lightspeed:lcore-migrationfrom
umago:postgres-health

Conversation

@umago

@umago umago commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Add startup, liveness, and readiness probes to the lightspeed-postgres-server container using pg_isready.

Summary by CodeRabbit

  • New Features
    • Added PostgreSQL container health checks for startup, liveness, and readiness.
    • Health probes now verify the database with pg_isready, improving pod startup and availability detection.

Add startup, liveness, and readiness probes to the lightspeed-postgres-server
container using pg_isready.

Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
@openshift-ci openshift-ci Bot requested review from Akrog and lpiwowar July 1, 2026 14:23
@openshift-ci openshift-ci Bot added the approved label Jul 1, 2026
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c846c261-f19c-428f-a97d-d486f504509c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
internal/controller/postgres_deployment.go (1)

201-214: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Positional int32 params are a footgun for future edits.

buildPostgresProbe(period, timeout, failure, initialDelay int32) uses an argument order that doesn't match corev1.Probe's field order, and since all four params share the same type, a future call-site swap (e.g. timeout/period) will compile silently and misconfigure probe timing without any error.

♻️ Suggested refactor using named fields
-func buildPostgresProbe(period, timeout, failure, initialDelay int32) *corev1.Probe {
+type postgresProbeConfig struct {
+	Period       int32
+	Timeout      int32
+	Failure      int32
+	InitialDelay int32
+}
+
+func buildPostgresProbe(cfg postgresProbeConfig) *corev1.Probe {
 	return &corev1.Probe{
 		ProbeHandler: corev1.ProbeHandler{
 			Exec: &corev1.ExecAction{
 				Command: []string{"pg_isready", "-U", PostgresDefaultUser, "-d", PostgresDefaultDbName},
 			},
 		},
-		InitialDelaySeconds: initialDelay,
-		PeriodSeconds:       period,
-		TimeoutSeconds:      timeout,
-		FailureThreshold:    failure,
+		InitialDelaySeconds: cfg.InitialDelay,
+		PeriodSeconds:       cfg.Period,
+		TimeoutSeconds:      cfg.Timeout,
+		FailureThreshold:    cfg.Failure,
 	}
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/controller/postgres_deployment.go` around lines 201 - 214, Refactor
buildPostgresProbe to avoid the positional int32 footgun by using clearly named
inputs or a small config struct instead of relying on the current
period/timeout/failure/initialDelay parameter order. Update the probe
construction in buildPostgresProbe so the values map explicitly to
InitialDelaySeconds, PeriodSeconds, TimeoutSeconds, and FailureThreshold, making
future call-site changes safe and readable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@internal/controller/postgres_deployment.go`:
- Around line 201-214: Refactor buildPostgresProbe to avoid the positional int32
footgun by using clearly named inputs or a small config struct instead of
relying on the current period/timeout/failure/initialDelay parameter order.
Update the probe construction in buildPostgresProbe so the values map explicitly
to InitialDelaySeconds, PeriodSeconds, TimeoutSeconds, and FailureThreshold,
making future call-site changes safe and readable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 141b9d37-cf5d-43ea-9353-81966e03777d

📥 Commits

Reviewing files that changed from the base of the PR and between a8a71f8 and af7cbea.

📒 Files selected for processing (2)
  • internal/controller/constants.go
  • internal/controller/postgres_deployment.go

@lpiwowar lpiwowar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

Thank you!:)

@openshift-ci

openshift-ci Bot commented Jul 2, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lpiwowar, umago

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot Bot merged commit 06cef90 into openstack-lightspeed:lcore-migration Jul 2, 2026
8 checks passed
@umago umago deleted the postgres-health branch July 3, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants