Skip to content

Feat/config log levels - #134

Merged
Agalin merged 1 commit into
operasoftware:mainfrom
geico:feat/config-log-levels
Aug 13, 2026
Merged

Feat/config log levels#134
Agalin merged 1 commit into
operasoftware:mainfrom
geico:feat/config-log-levels

Conversation

@MaybeSam05

Copy link
Copy Markdown
Contributor

Summary

Adds an optional log.levelStderr field so pod-log verbosity for pgBackRest can be configured instead of the hard-coded --log-level-stderr=warn. Console (stdout) logging is always pinned to --log-level-console=off so info --output=json stays parseable.

Note: levelFile and path were split out into a follow-up PR ([MaybeSam05#1]) so this one stays focused on pod-log verbosity and the console-off behavior.

Problem

Log levels were hard-coded (stderr=warn, console=off), so debugging a failing backup often surfaced only a few WARN lines in kubectl logs with no way to raise verbosity.

Changes

  • Config API (internal/pgbackrest/api/config.go): optional log block with levelStderr only; levels constrained to pgBackRest's valid values.
  • Command builder (internal/pgbackrest/command/commandbuilder.go): stderr level from config (default warn); console always off.
  • CRD / deepcopy: regenerated for the narrowed log block.
  • Tests: unit tests for defaults and overridden stderr level; e2e verifies stderr flags reach pgBackRest via plugin pod logs.

Testing

  • go test ./internal/pgbackrest/command/
  • E2e logconfig: configures levelStderr=debug, runs a backup, asserts --log-level-stderr=debug and --log-level-console=off in logged pgBackRest invocations.

Compatibility

Fully backward compatible. With no log block, behavior matches before (stderr=warn, console=off).

Follow-up

File logging (levelFile, path, log directory creation) is in a stacked PR on top of this branch.

@MaybeSam05
MaybeSam05 force-pushed the feat/config-log-levels branch 2 times, most recently from c269d5a to e861855 Compare August 12, 2026 19:40
@MaybeSam05

Copy link
Copy Markdown
Contributor Author

Squashed the branch into a single commit and force-pushed to clean up the history and match the repo's conventional-commit format (feat: subject + Signed-off-by). No code changes in this push, CI should be re-running now.

Comment thread internal/pgbackrest/api/config.go Outdated
Adds a log configuration block to the Archive CRD so operators can
control pgBackRest stderr verbosity. Pins console output to off, applies
the setting across backup, restore, and WAL commands, and includes e2e
coverage. Drops the additionalCommandArgs reserved-flag filtering per
review, since silently overriding explicit user args is better handled
at admission time.

Refs: operasoftware#134
Signed-off-by: Samarth Verma <verma.samarth05@gmail.com>
@MaybeSam05
MaybeSam05 force-pushed the feat/config-log-levels branch from e861855 to 226f69e Compare August 13, 2026 16:48
@Agalin
Agalin enabled auto-merge (rebase) August 13, 2026 21:53
@Agalin
Agalin merged commit d43bf2b into operasoftware:main Aug 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants