-
Notifications
You must be signed in to change notification settings - Fork 609
Add a validated field for Postgres parameters #4060
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
Conversation
anyOf: | ||
- type: integer | ||
- type: string | ||
x-kubernetes-int-or-string: true |
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.
📝 a maxLength
on this string value may reduce CEL costs.
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.
I wasn't able to convince controller-gen
to do this.
- Handling of
intstr.IntOrString
is hard-coded, causing it to ignore markers on a type alias. - A local type can be marked
x-kubernetes-int-or-string
, but that doesn't generate ananyOf: [int, string]
schema.
config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml
Show resolved
Hide resolved
// | ||
// +kubebuilder:validation:XValidation:rule=`!has(self.listen_addresses)`,message=`network connectivity is always enabled: listen_addresses` | ||
// +kubebuilder:validation:XValidation:rule=`!has(self.port)`,message=`change port using .spec.port instead` | ||
// +kubebuilder:validation:XValidation:rule=`!has(self.ssl) && !self.exists(k, k.startsWith("ssl_"))` |
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.
For some of these, are you considering the message to be self evident?
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.
I don't know what to say in these cases. I welcome any suggestions!
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.
One question about some CEL checks not having messages, but LGTM, though I guess I still have a broader question re: why we're doing this. (Is this a move towards per-instance settings?)
The wide-open field in Patroni is error-prone, and its feedback loop is too slow. These presence-of rules indicate immediately which parameters are allowed/ignored by PGO. I populated this list by looking at what we assign through the I'm now noticing that these rules allow two possible |
Nope. I'll tighten the validation there for now. |
The validation rules of Kubernetes 1.29 (Beta in 1.25) allow for this kind of field. Issue: PGO-313
The validation rules of Kubernetes 1.29 (Beta in 1.25) allow for this kind of field.
Checklist:
Type of Changes:
What is the current behavior (link to any open issues here)?
Postgres parameters are specified under
.spec.patroni.dynamicConfiguration
.What is the new behavior (if this is a feature change)?
Postgres parameters can be specified under
.spec.config.parameters
and.spec.patroni.dynamicConfiguration
. The two sections are merged, with the former taking precedence.Other Information:
Issue: PGO-313