Skip to content

feat: allow to disable PDB management#164

Merged
GrigoryPervakov merged 1 commit into
mainfrom
diable-pdp
Apr 15, 2026
Merged

feat: allow to disable PDB management#164
GrigoryPervakov merged 1 commit into
mainfrom
diable-pdp

Conversation

@GrigoryPervakov
Copy link
Copy Markdown
Member

Why

In some environments, users are restricted to creating/updating PDBs and need a way to ignore this feature.

What

Add ENABLE_PDB env variable that disables PDB reconciliation and controller informers.

Related Issues

Fixes #141

@GrigoryPervakov GrigoryPervakov added the feature Feature request label Apr 15, 2026
@GrigoryPervakov
Copy link
Copy Markdown
Member Author

GrigoryPervakov commented Apr 15, 2026

@Revenge-Rakesh, this PR should fix most problems.
If you need to remove PDBs from the Role too, wait for #159; newer kubebuilder will generate a chart that allows to disable operator roles creation and pass a manually created restricted role

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a global switch to disable PodDisruptionBudget (PDB) management by the operator, intended for environments where granting PDB permissions is not possible.

Changes:

  • Introduces ENABLE_PDB environment variable (default true) and Helm chart value pdbManagement.enable.
  • Threads the flag into ClickHouse/Keeper controllers to skip PDB reconciliation steps and to avoid registering PDB ownership watches.
  • Updates unit/e2e wiring to account for the new SetupWithManager(..., enablePDB bool) signature.

Reviewed changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
cmd/main.go Passes env.EnablePDB into controller setup.
internal/environment/environment.go Adds EnablePDB env var parsing with default true.
internal/environment/environment_test.go Adds coverage for ENABLE_PDB=false.
internal/controller/clickhouse/controller.go Stores EnablePDB on controller; conditionally registers PDB ownership watch; passes flag into reconciler.
internal/controller/clickhouse/controller_test.go Updates controller construction to include EnablePDB.
internal/controller/clickhouse/sync.go Gates PDB reconciliation step on EnablePDB.
internal/controller/keeper/controller.go Stores EnablePDB on controller; conditionally registers PDB ownership watch; passes flag into reconciler.
internal/controller/keeper/controller_test.go Updates controller construction to include EnablePDB.
internal/controller/keeper/sync.go Gates PDB reconciliation step on EnablePDB and extracts PDB reconcile logic into its own step.
internal/controller/keeper/sync_test.go Updates controller construction to include EnablePDB.
test/e2e/e2e_suite_test.go Updates controller setup calls for new signature.
dist/chart/values.yaml Adds pdbManagement.enable Helm value and documentation.
dist/chart/templates/manager/manager.yaml Wires Helm value into ENABLE_PDB env var for the manager container.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/controller/clickhouse/sync.go
Comment thread internal/controller/keeper/sync.go
Comment thread internal/controller/keeper/controller.go
Comment thread internal/controller/clickhouse/controller.go
@GrigoryPervakov GrigoryPervakov marked this pull request as ready for review April 15, 2026 14:59
@GrigoryPervakov GrigoryPervakov merged commit 97ddba1 into main Apr 15, 2026
29 of 32 checks passed
@GrigoryPervakov GrigoryPervakov deleted the diable-pdp branch April 15, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to disable PDB management by operator globally

2 participants