Generate postgresql CRD from go structs #3007
Draft
+784
−355
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Similar to #3004 this introduces CRD (yaml) generation based on the go structs using
controler-genThis enables the generation of the
postgresqlCRD.The PR has two commits:
Sort postgresql.crd.yamlthis just sorts the yaml keys similar to the CRD generation does, but doesn't change the yaml from what is inmaster. This is just done to make the diff cleanerGenerate postgresql CRD from go structsthis includes the new YAML generated from the go structs. Look at this commit to see how it's different frommaster.As this goes from a "manually" defined schema to a generated one there are a few changes:
patroni.maximum_lag_on_failoverwas changed fromfloat32toint64as it was defined asintegerin the schema. Related code was changed to cast tofloat32.map[string][]stringallowed nullable of the[]string. This is not possible to set in kubebuilder so it's missing meaning you can't dokey: nullin those cases, which I anyway thing is better to not allow.oneOfon thestandbyfield and specifyingmaintenanceWindowsfield as a list of strings (as opposed to a list of objects). To handle this I have added a custom scripthack/adjust_postgresql_crd.shwhich injects the right settings viasedafter the manifest is generated. This is intended to be temporary until those features are supported upstream bycontroller-gen.TODO:
maintenanceWindows(this uses a string in the yaml, but a go struct in code)init_containersoneOfon thestandbyfield