Skip to content

AB-449 PostgreSQL Operator: DefaultPrivilege CRD - #4

Merged
ThoSap merged 7 commits into
mainfrom
ab-449-postgresql-operator-default-priviege
Jan 22, 2026
Merged

AB-449 PostgreSQL Operator: DefaultPrivilege CRD#4
ThoSap merged 7 commits into
mainfrom
ab-449-postgresql-operator-default-priviege

Conversation

@ThoSap

@ThoSap ThoSap commented Jan 22, 2026

Copy link
Copy Markdown
Member

No description provided.

@ThoSap ThoSap self-assigned this Jan 22, 2026
@linear

linear Bot commented Jan 22, 2026

Copy link
Copy Markdown
AB-449 PostgreSQL Operator

Based on the research and PoC done in the ticket and PR https://github.com/aboutbits/minio-operator/pull/1

We most likely will use CloudNativePG AB-396 for the DB Setup and this operator to manage the access, e.g. PostgreSQL roles and grants.

The scope of the operator is:

  • Role management
  • Grant management
  • Database management

@ThoSap
ThoSap requested a review from Copilot January 22, 2026 13:37

Copilot AI 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.

Pull request overview

This pull request introduces a new DefaultPrivilege CRD (Custom Resource Definition) for the PostgreSQL Operator. The implementation follows a similar pattern to the existing Grant CRD but handles default privileges instead of direct grants. The changes also include refactoring privilege handling by moving GrantPrivilege to a shared Privilege enum and updating timeout configurations.

Changes:

  • Introduces DefaultPrivilege CRD with reconciler, service, and object type support
  • Refactors GrantPrivilege to shared Privilege enum in core package
  • Updates Quarkus version from 3.30.6 to 3.30.7
  • Standardizes wait timeout values from 10 to 5 seconds across test creators

Reviewed changes

Copilot reviewed 24 out of 32 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
operator/src/main/java/it/aboutbits/postgresql/core/Privilege.java Moved and renamed from GrantPrivilege to shared Privilege enum
operator/src/main/java/it/aboutbits/postgresql/crd/defaultprivilege/DefaultPrivilege.java New CRD class for default privileges
operator/src/main/java/it/aboutbits/postgresql/crd/defaultprivilege/DefaultPrivilegeSpec.java Specification class defining default privilege fields and validation rules
operator/src/main/java/it/aboutbits/postgresql/crd/defaultprivilege/DefaultPrivilegeObjectType.java Enum defining supported object types (schema, table, sequence) for default privileges
operator/src/main/java/it/aboutbits/postgresql/crd/defaultprivilege/DefaultPrivilegeService.java Service implementing grant/revoke operations for default privileges
operator/src/main/java/it/aboutbits/postgresql/crd/defaultprivilege/DefaultPrivilegeReconciler.java Reconciler managing lifecycle of default privilege resources
operator/src/main/java/it/aboutbits/postgresql/crd/grant/*.java Updated to use shared Privilege enum instead of GrantPrivilege
operator/src/test/java/it/aboutbits/postgresql/crd/defaultprivilege/DefaultPrivilegeReconcilerTest.java Comprehensive test coverage for default privilege functionality
operator/src/test/java/it/aboutbits/postgresql/_support/testdata/persisted/creator/DefaultPrivilegeCreate.java Test data creator for default privilege resources
gradle.properties Updated Quarkus version to 3.30.7

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

@ThoSap
ThoSap requested a review from Copilot January 22, 2026 13:45

This comment was marked as outdated.

@ThoSap
ThoSap requested a review from Copilot January 22, 2026 13:46

This comment was marked as outdated.

@ThoSap
ThoSap requested a review from Copilot January 22, 2026 13:49

This comment was marked as outdated.

@ThoSap
ThoSap marked this pull request as ready for review January 22, 2026 13:50
Comment on lines +121 to +122
return DeleteControl.noFinalizerRemoval()
.rescheduleAfter(1, TimeUnit.SECONDS);

@ThoSap ThoSap Jan 22, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If you are wondering why I added this to every CRD cleanup callback method after the phase DELETING patchStatus call.
Without this, we will get the following error on CR instance deletion (and in the @BeforeEach test cleanup):

Deleting Role [resource=default/test-role-valid-until, spec.name=test-role-valid-until, status.phase=DELETING]
Uncaught error during event processing ExecutionScope{ resource id: ResourceID{name='test-role-nologin', namespace='default'}, version: 2422} - but another reconciliation will be attempted because a superseding event has been received or another retry attempt is pending.
io.javaoperatorsdk.operator.OperatorException: Exceeded maximum (10) retry attempts to patch resource: ResourceID{name='test-role-nologin', namespace='default'}
        at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.conflictRetryingPatch(ReconciliationDispatcher.java:401)
        at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleCleanup(ReconciliationDispatcher.java:274)
        at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleDispatch(ReconciliationDispatcher.java:96)
        at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleExecution(ReconciliationDispatcher.java:69)
        at io.javaoperatorsdk.operator.processing.event.EventProcessor$ReconcilerExecutor.run(EventProcessor.java:483)
        at java.base@25.0.2/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
        at java.base@25.0.2/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
        at java.base@25.0.2/java.lang.Thread.run(Thread.java:1474)

@ThoSap
ThoSap merged commit ee47a37 into main Jan 22, 2026
1 check passed
@ThoSap
ThoSap deleted the ab-449-postgresql-operator-default-priviege branch January 22, 2026 21:19
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.

4 participants