Skip to content

Conversation

@pcallewaert
Copy link
Contributor

This should resolve the issue in #115

@pcallewaert pcallewaert self-assigned this Dec 24, 2025
@pcallewaert pcallewaert marked this pull request as ready for review December 24, 2025 09:49
Copy link

@pretzelmaker pretzelmaker left a comment

Choose a reason for hiding this comment

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

Thanks for taking this on! I think this is a great start.

I did notice that by returning ctrl.Result{}, nil in the scenario that the Postgres CR is not found, eventual consistency will be broken. Let me explain.

Currently, if a user applies a Postgres CR and a PostgresUser CR at the same time, or if the Posgtres CR is created after the user, the code will catch that the database is missing and the PostgresUser will not get reconciled again until the CR is updated or the operator is restarted. This breaks the idea of eventual consistency.

I think best way to go about addressing this issue in the "kubernetes way" would be to have a cross-resource watch of the Postgres CR in the SetupWithManager function. This way, PostgresUsers will only get created once changes on Postgres CRs are detected. There are pros/cons to this approach, such as a situation where the Postgres database is not managed by the operator, but we should be able to account for this.

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.

3 participants