Skip to content

Commit 14e196c

Browse files
fix(postgres): drive postgresql.parameters int-or-string from the generator
Ivan's original schema edits were correct in intent but lived in the generated artifacts (values.schema.json and the embedded openAPISchema in postgres-rd/cozyrds/postgres.yaml). `make generate` reverts them because values.yaml's `@field {map[string]string}` annotation is the source of truth -- same regeneration trap that caught #2466 (issue #2597). cozyvalues-gen v1.4.0 (cozystack/cozyvalues-gen#25, merged 2026-05-21) adds an `intOrString` type alias for map values that emits `additionalProperties.anyOf: [integer, string]` plus `x-kubernetes-int-or-string: true`. Move the change to source by flipping the annotation, then regenerate: - packages/apps/postgres/values.yaml: `@field {map[string]intOrString}` with updated description noting integer values are accepted. - packages/apps/postgres/values.schema.json: regenerated -- now carries anyOf + x-kubernetes-int-or-string: true. - packages/system/postgres-rd/cozyrds/postgres.yaml: embedded openAPISchema regenerated to match. - packages/apps/postgres/README.md: regenerated type column. - api/apps/v1alpha1/postgresql/types.go: Parameters is now `map[string]intstr.IntOrString`. The result survives future regenerations. The template's `{{ \$value | toString | quote }}` already coerces both inputs to quoted strings, verified end-to-end with helm template against both `max_connections: 100` (int) and `max_connections: "100"` (string) -- identical render output. Dangerous-param block list still rejects archive_cleanup_command and recovery_end_command additions from the prior commit. Co-Authored-By: IvanHunters <[email protected]> Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 388e823 commit 14e196c

5 files changed

Lines changed: 18 additions & 12 deletions

File tree

‎api/apps/v1alpha1/postgresql/types.go‎

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/apps/postgres/README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ See:
177177

178178
### Application-specific parameters
179179

180-
| Name | Description | Type | Value |
181-
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ----- |
182-
| `postgresql` | PostgreSQL server configuration. | `object` | `{}` |
183-
| `postgresql.parameters` | PostgreSQL server parameters. All values must be strings (quote numbers: "100"). BLOCKED (enable arbitrary code execution): archive_command, restore_command, ssl_passphrase_command, dynamic_library_path, local_preload_libraries, session_preload_libraries, shared_preload_libraries. Do NOT override CloudNativePG-managed parameters: archive_mode, primary_conninfo, wal_level, max_replication_slots. | `map[string]string` | `{}` |
180+
| Name | Description | Type | Value |
181+
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ----- |
182+
| `postgresql` | PostgreSQL server configuration. | `object` | `{}` |
183+
| `postgresql.parameters` | PostgreSQL server parameters. Values may be strings or integers; integers are coerced to strings by the template (e.g. both `max_connections: 100` and `max_connections: "100"` are accepted). BLOCKED (enable arbitrary code execution): archive_command, restore_command, ssl_passphrase_command, archive_cleanup_command, recovery_end_command, dynamic_library_path, local_preload_libraries, session_preload_libraries, shared_preload_libraries. Do NOT override CloudNativePG-managed parameters: archive_mode, primary_conninfo, wal_level, max_replication_slots. | `map[string]intOrString` | `{}` |
184184

185185

186186
### Quorum-based synchronous replication

‎packages/apps/postgres/values.schema.json‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,21 @@
137137
"default": {},
138138
"properties": {
139139
"parameters": {
140-
"description": "PostgreSQL server parameters. String values are preferred (quote numbers: \"100\"); integer values are also accepted and converted to strings automatically. BLOCKED (enable arbitrary code execution): archive_command, restore_command, ssl_passphrase_command, archive_cleanup_command, recovery_end_command, dynamic_library_path, local_preload_libraries, session_preload_libraries, shared_preload_libraries. Do NOT override CloudNativePG-managed parameters: archive_mode, primary_conninfo, wal_level, max_replication_slots.",
140+
"description": "PostgreSQL server parameters. Values may be strings or integers; integers are coerced to strings by the template (e.g. both `max_connections: 100` and `max_connections: \"100\"` are accepted). BLOCKED (enable arbitrary code execution): archive_command, restore_command, ssl_passphrase_command, archive_cleanup_command, recovery_end_command, dynamic_library_path, local_preload_libraries, session_preload_libraries, shared_preload_libraries. Do NOT override CloudNativePG-managed parameters: archive_mode, primary_conninfo, wal_level, max_replication_slots.",
141141
"type": "object",
142142
"default": {
143143
"max_connections": "100"
144144
},
145145
"additionalProperties": {
146146
"anyOf": [
147-
{"type": "string"},
148-
{"type": "integer"}
149-
]
147+
{
148+
"type": "integer"
149+
},
150+
{
151+
"type": "string"
152+
}
153+
],
154+
"x-kubernetes-int-or-string": true
150155
}
151156
}
152157
}

‎packages/apps/postgres/values.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ version: v18
8989
##
9090

9191
## @typedef {struct} PostgreSQL - PostgreSQL server configuration.
92-
## @field {map[string]string} [parameters] - PostgreSQL server parameters. All values must be strings (quote numbers: "100"). BLOCKED (enable arbitrary code execution): archive_command, restore_command, ssl_passphrase_command, archive_cleanup_command, recovery_end_command, dynamic_library_path, local_preload_libraries, session_preload_libraries, shared_preload_libraries. Do NOT override CloudNativePG-managed parameters: archive_mode, primary_conninfo, wal_level, max_replication_slots.
92+
## @field {map[string]intOrString} [parameters] - PostgreSQL server parameters. Values may be strings or integers; integers are coerced to strings by the template (e.g. both `max_connections: 100` and `max_connections: "100"` are accepted). BLOCKED (enable arbitrary code execution): archive_command, restore_command, ssl_passphrase_command, archive_cleanup_command, recovery_end_command, dynamic_library_path, local_preload_libraries, session_preload_libraries, shared_preload_libraries. Do NOT override CloudNativePG-managed parameters: archive_mode, primary_conninfo, wal_level, max_replication_slots.
9393

9494
## @param {PostgreSQL} postgresql - PostgreSQL server configuration.
9595
postgresql:

0 commit comments

Comments
 (0)