-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculate Postgres HBA rules in the controller #4111
Conversation
We don't use it, and how to quote/escape it has been underspecified for years.
The controller assigned mandatory and default rules but did nothing with rules defined in the spec. The patroni.DynamicConfiguration function was interpreting its schemaless fields while also combining Postgres HBA rules from elsewhere. Its tests were long and complicated. 1. Postgres HBA rules are now extracted from the schemaless Patroni field in their own function with its own tests. 2. The PostgresCluster controller now creates a single set of HBA rules based on all the fields of the PostgresCluster spec. 3. The DynamicConfiguration function is simpler (19 lines, 18% smaller) and easier to test.
spec: `{ | ||
patroni: { | ||
dynamicConfiguration: { | ||
postgresql: { | ||
pg_hba: [custom], | ||
pg_hba: [calculated, elsewhere], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't come through?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function doesn't do that work anymore. Now,
patroni.PostgresHBAs
reads them out,postgrescluster.generatePostgresHBAs
stitches them together in the right order, then passes that result- here, to
patroni.DynamicConfiguration
which spells them correctly as input to Patroni.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The controller assigned mandatory and default rules but did nothing with rules defined in the spec.
The
patroni.DynamicConfiguration
function was interpreting its schemaless fields while also combining Postgres HBA rules from elsewhere. Its tests were long and complicated.Checklist:
Type of Changes: