feat(postgres): add an audit toggle for access and statement logging (#5404)

## What this PR does

Managed Postgres can already load pgaudit through the
`sharedPreloadLibraries` allowlist and set
`pgaudit.log`/`log_connections` through `postgresql.parameters`, but
that leaves an orchestrator such as a customer-facing panel depending on
internal parameter names to answer "who connected and what did they
run". This adds an `audit` block that bundles access and statement
auditing behind a single switch.

With `audit.enabled`, the chart adds `pgaudit` to
`shared_preload_libraries` and seeds `pgaudit.log` (set by `audit.log`,
default `write, ddl, role`), `log_connections` and `log_disconnections`.
The audit parameters are seeded as defaults, so an explicit
`pgaudit.log` or `log_connections` in `postgresql.parameters` still
takes precedence. The audit records go to the instance log, which the
platform log stack already collects, so they are queryable per database
by its labels without extra wiring. `audit` is off by default, and
toggling it restarts PostgreSQL because pgaudit is a preloaded library.

Postgres only; MariaDB, MongoDB and ClickHouse auditing are left for
follow-ups.

### Screenshots

Not applicable — no UI change.

### Downstream repositories

Walked the trigger map against the diff. One repository is reached:
`cozystack/terraform-provider-cozystack` hand-models each postgres
`values.schema.json` field, and this diff adds the `audit` block to that
schema, so the provider would need the field added to its postgres
schema and its expand/flatten pair. That is separate work there, tracked
in cozystack/terraform-provider-cozystack#87. The website postgres
reference page regenerates from the package `README.md` on release, so
it needs no manual follow-up, and `ansible-cozystack` carries no
postgres values key.

- [ ] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [x]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up: cozystack/terraform-provider-cozystack#87
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
feat(postgres): managed PostgreSQL gains an `audit` toggle that enables pgaudit statement auditing and connection logging, with the audited classes set by `audit.log` (default `write, ddl, role`).
```
This commit is contained in:
IvanHunters authored and GitHub committed 2026-11-25 13:16:04 +03:00
commit 907d369813
8 files changed
+289 -3

No files matched your search

+13
View File
@@ -53,6 +53,9 @@ type ConfigSpec struct {
// PostgreSQL server configuration.
// +kubebuilder:default:={}
Postgresql PostgreSQL `json:"postgresql"`
// PostgreSQL audit configuration.
// +kubebuilder:default:={}
Audit Audit `json:"audit"`
// Quorum configuration for synchronous replication.
// +kubebuilder:default:={}
Quorum Quorum `json:"quorum"`
@@ -73,6 +76,16 @@ type ConfigSpec struct {
Bootstrap Bootstrap `json:"bootstrap"`
}
type Audit struct {
// Enable PostgreSQL auditing. Loads the pgaudit extension through the `sharedPreloadLibraries` allowlist and turns on `log_connections`/`log_disconnections`, so who connected and the classes of statement they ran are written to the instance log and collected by the platform log stack. The audited statement classes are set by `log`. Off by default. Enabling or disabling it restarts PostgreSQL, since pgaudit is a preloaded library. Note that `write` and `all` record statement text with literal values, so anyone who can read the tenant's log stack can read audited data; keep that in mind on a shared Monitoring.
// +kubebuilder:default:=false
Enabled bool `json:"enabled,omitempty"`
// pgaudit session audit classes recorded when `enabled`, as the comma-separated value of `pgaudit.log`. Valid classes are `read`, `write`, `function`, `role`, `ddl`, `misc`, `misc_set`, `all` and `none`; a class may be prefixed with `-` to subtract it from `all` (for example `ddl, role`, `write, ddl, role`, or `all, -misc`). `all` logs every statement including reads and is heavy. Defaults to `write, ddl, role`. A `pgaudit.log` set in `postgresql.parameters` overrides this. The pattern rejects an unrecognised class at admission, which otherwise makes pgaudit fall back to `none` at the next start and silently disables auditing.
// +kubebuilder:default:="write, ddl, role"
// +kubebuilder:validation:Pattern="^(\\s*-?(read|write|function|role|ddl|misc_set|misc|all|none)\\s*(,\\s*-?(read|write|function|role|ddl|misc_set|misc|all|none)\\s*)*)?$"
Log string `json:"log,omitempty"`
}
type Autoscaling struct {
// Recommendation mode: keep the static count and render the ScaledObject with both scaling directions paused, so KEDA keeps the HPA and keeps serving its trigger metric but actuates neither way. Note both scaling policies are disabled, so the HPA's desiredReplicas is frozen to the current count - read the recommendation from the matching read-load dashboard panel for your metric (connections or CPU): desired = 1 + ceil(read load / target), clamped to [effectiveMin..maxReplicas] where effectiveMin = max(minReplicas, maxSyncReplicas+1, 2), not from the desired-replicas line. Like disabling, flipping a LIVE autoscaled cluster into dryRun re-renders `instances: replicas` (the raw static value, which can be below the autoscaling floor); if `replicas` is below the live count, stage it to the live count first (see the enablement note) or the cluster sheds down to `replicas`. No shed occurs when the rendered value is unchanged (replicas already equals the active seed) — client-side merge is then a no-op and the live count is preserved. Permanent, unlike `transition`.
// +kubebuilder:default:=false
+16
View File
@@ -25,6 +25,21 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Audit) DeepCopyInto(out *Audit) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Audit.
func (in *Audit) DeepCopy() *Audit {
if in == nil {
return nil
}
out := new(Audit)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Autoscaling) DeepCopyInto(out *Autoscaling) {
*out = *in
@@ -105,6 +120,7 @@ func (in *ConfigSpec) DeepCopyInto(out *ConfigSpec) {
out.Size = in.Size.DeepCopy()
in.Tls.DeepCopyInto(&out.Tls)
in.Postgresql.DeepCopyInto(&out.Postgresql)
out.Audit = in.Audit
out.Quorum = in.Quorum
out.Autoscaling = in.Autoscaling
if in.Users != nil {
+9
View File
@@ -240,6 +240,15 @@ For `sslmode=verify-full` to work, the CA bundle retrieved above must be saved t
| `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` | `{}` |
### Audit parameters
| Name | Description | Type | Value |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------ |
| `audit` | PostgreSQL audit configuration. | `object` | `{}` |
| `audit.enabled` | Enable PostgreSQL auditing. Loads the pgaudit extension through the `sharedPreloadLibraries` allowlist and turns on `log_connections`/`log_disconnections`, so who connected and the classes of statement they ran are written to the instance log and collected by the platform log stack. The audited statement classes are set by `log`. Off by default. Enabling or disabling it restarts PostgreSQL, since pgaudit is a preloaded library. Note that `write` and `all` record statement text with literal values, so anyone who can read the tenant's log stack can read audited data; keep that in mind on a shared Monitoring. | `bool` | `false` |
| `audit.log` | pgaudit session audit classes recorded when `enabled`, as the comma-separated value of `pgaudit.log`. Valid classes are `read`, `write`, `function`, `role`, `ddl`, `misc`, `misc_set`, `all` and `none`; a class may be prefixed with `-` to subtract it from `all` (for example `ddl, role`, `write, ddl, role`, or `all, -misc`). `all` logs every statement including reads and is heavy. Defaults to `write, ddl, role`. A `pgaudit.log` set in `postgresql.parameters` overrides this. The pattern rejects an unrecognised class at admission, which otherwise makes pgaudit fall back to `none` at the next start and silently disables auditing. | `string` | `write, ddl, role` |
### Quorum-based synchronous replication
| Name | Description | Type | Value |
+27 -1
View File
@@ -342,7 +342,17 @@ spec:
that bypass schema validation. helm-unittest cannot reach it, since the schema
rejects first, so hack/check-postgres-preload-allowlist.bats pins it instead.
*/ -}}
{{- with .Values.postgresql.sharedPreloadLibraries }}
{{- /*
audit.enabled loads pgaudit through the same allowlist the explicit list
uses, so the audit trail is on without the tenant hand-editing the preload
list. The class set and connection-logging parameters are seeded below.
*/ -}}
{{- $auditEnabled := and .Values.audit .Values.audit.enabled }}
{{- $preload := default (list) .Values.postgresql.sharedPreloadLibraries }}
{{- if and $auditEnabled (not (has "pgaudit" $preload)) }}
{{- $preload = append $preload "pgaudit" }}
{{- end }}
{{- with $preload }}
{{- $allowedPreload := list "pg_stat_statements" "auto_explain" "pgaudit" "pg_prewarm" }}
shared_preload_libraries:
{{- range . }}
@@ -354,6 +364,22 @@ spec:
{{- end }}
parameters:
{{- $defaults := dict "max_wal_senders" "30" }}
{{- /*
Audit seeds pgaudit.log and connection logging. Each key is seeded only
when postgresql.parameters does not set it, so an explicit value wins
unconditionally — including a falsy one like log_connections: 0, which
merge would otherwise read as unset and overwrite with the default.
The match is case-insensitive because PostgreSQL parameter names are,
so a user key like pgaudit.LoG still suppresses the lowercase seed
instead of landing beside it.
*/}}
{{- if $auditEnabled }}
{{- $userKeys := dict }}
{{- range $k, $_v := (default (dict) .Values.postgresql.parameters) }}{{- $_ := set $userKeys (lower $k) true }}{{- end }}
{{- if not (hasKey $userKeys "pgaudit.log") }}{{- $_ := set $defaults "pgaudit.log" (default "write, ddl, role" .Values.audit.log) }}{{- end }}
{{- if not (hasKey $userKeys "log_connections") }}{{- $_ := set $defaults "log_connections" "on" }}{{- end }}
{{- if not (hasKey $userKeys "log_disconnections") }}{{- $_ := set $defaults "log_disconnections" "on" }}{{- end }}
{{- end }}
{{- /*
PostgreSQL sizes shared_buffers at 128MB whatever the container gets.
The pool is shared memory, which the kernel cannot reclaim without
@@ -0,0 +1,190 @@
suite: audit toggle
# audit.enabled is a one-switch bundle for PostgreSQL access auditing. It loads
# the pgaudit extension through the sharedPreloadLibraries allowlist and turns on
# connection logging, so "who connected" (log_connections/log_disconnections) and
# "what they ran" (pgaudit.log classes) land in the instance log, which the
# platform log stack already collects. The pgaudit classes default to
# "write, ddl, role" and are overridable through audit.log; a pgaudit.log set
# directly in postgresql.parameters still wins, since audit only seeds a default.
templates:
- templates/db.yaml
release:
name: pg-test
namespace: tenant-test
set:
_cluster:
scheduling: {}
cluster-domain: cozy.local
tests:
- it: "off by default: no pgaudit preload and no audit parameters"
documentSelector:
path: kind
value: Cluster
asserts:
- notExists:
path: spec.postgresql.shared_preload_libraries
- notExists:
path: spec.postgresql.parameters["pgaudit.log"]
- notExists:
path: spec.postgresql.parameters.log_connections
- it: "enabling it preloads pgaudit and seeds the audit parameters"
set:
audit:
enabled: true
documentSelector:
path: kind
value: Cluster
asserts:
- equal:
path: spec.postgresql.shared_preload_libraries
value:
- pgaudit
- equal:
path: spec.postgresql.parameters["pgaudit.log"]
value: "write, ddl, role"
- equal:
path: spec.postgresql.parameters.log_connections
value: "on"
- equal:
path: spec.postgresql.parameters.log_disconnections
value: "on"
- it: "audit.log overrides the default pgaudit class set"
set:
audit:
enabled: true
log: "all"
documentSelector:
path: kind
value: Cluster
asserts:
- equal:
path: spec.postgresql.parameters["pgaudit.log"]
value: "all"
- it: "pgaudit already in the preload list is not duplicated"
set:
audit:
enabled: true
postgresql:
sharedPreloadLibraries:
- pg_stat_statements
- pgaudit
documentSelector:
path: kind
value: Cluster
asserts:
- equal:
path: spec.postgresql.shared_preload_libraries
value:
- pg_stat_statements
- pgaudit
- it: "an explicit pgaudit.log in parameters wins over the audit default"
set:
audit:
enabled: true
log: "write, ddl, role"
postgresql:
parameters:
pgaudit.log: "ddl"
documentSelector:
path: kind
value: Cluster
asserts:
- equal:
path: spec.postgresql.parameters["pgaudit.log"]
value: "ddl"
- it: "an explicit falsy connection-logging value wins over the audit default"
set:
audit:
enabled: true
postgresql:
parameters:
log_connections: 0
documentSelector:
path: kind
value: Cluster
asserts:
- equal:
path: spec.postgresql.parameters.log_connections
value: "0"
- equal:
path: spec.postgresql.parameters.log_disconnections
value: "on"
- it: "an explicit falsy log_disconnections wins over the audit default"
set:
audit:
enabled: true
postgresql:
parameters:
log_disconnections: 0
documentSelector:
path: kind
value: Cluster
asserts:
- equal:
path: spec.postgresql.parameters.log_disconnections
value: "0"
- it: "an explicit empty pgaudit.log in parameters wins over the audit default"
set:
audit:
enabled: true
postgresql:
parameters:
pgaudit.log: ""
documentSelector:
path: kind
value: Cluster
asserts:
- equal:
path: spec.postgresql.parameters["pgaudit.log"]
value: ""
- it: "an empty audit.log falls back to the default classes"
set:
audit:
enabled: true
log: ""
documentSelector:
path: kind
value: Cluster
asserts:
- equal:
path: spec.postgresql.parameters["pgaudit.log"]
value: "write, ddl, role"
- it: "a case-variant parameter key suppresses the lowercase audit seed"
set:
audit:
enabled: true
postgresql:
parameters:
pgaudit.LoG: "all"
documentSelector:
path: kind
value: Cluster
asserts:
- equal:
path: spec.postgresql.parameters["pgaudit.LoG"]
value: "all"
- notExists:
path: spec.postgresql.parameters["pgaudit.log"]
- it: "a mistyped audit class is rejected by the schema"
set:
audit:
enabled: true
log: "write, ddl, rol"
asserts:
- failedTemplate:
errorPattern: "audit/log"
+18
View File
@@ -208,6 +208,24 @@
}
}
},
"audit": {
"description": "PostgreSQL audit configuration.",
"type": "object",
"default": {},
"properties": {
"enabled": {
"description": "Enable PostgreSQL auditing. Loads the pgaudit extension through the `sharedPreloadLibraries` allowlist and turns on `log_connections`/`log_disconnections`, so who connected and the classes of statement they ran are written to the instance log and collected by the platform log stack. The audited statement classes are set by `log`. Off by default. Enabling or disabling it restarts PostgreSQL, since pgaudit is a preloaded library. Note that `write` and `all` record statement text with literal values, so anyone who can read the tenant's log stack can read audited data; keep that in mind on a shared Monitoring.",
"type": "boolean",
"default": false
},
"log": {
"description": "pgaudit session audit classes recorded when `enabled`, as the comma-separated value of `pgaudit.log`. Valid classes are `read`, `write`, `function`, `role`, `ddl`, `misc`, `misc_set`, `all` and `none`; a class may be prefixed with `-` to subtract it from `all` (for example `ddl, role`, `write, ddl, role`, or `all, -misc`). `all` logs every statement including reads and is heavy. Defaults to `write, ddl, role`. A `pgaudit.log` set in `postgresql.parameters` overrides this. The pattern rejects an unrecognised class at admission, which otherwise makes pgaudit fall back to `none` at the next start and silently disables auditing.",
"type": "string",
"default": "write, ddl, role",
"pattern": "^(\\s*-?(read|write|function|role|ddl|misc_set|misc|all|none)\\s*(,\\s*-?(read|write|function|role|ddl|misc_set|misc|all|none)\\s*)*)?$"
}
}
},
"quorum": {
"description": "Quorum configuration for synchronous replication.",
"type": "object",
+14
View File
@@ -159,6 +159,20 @@ postgresql:
## memory request rounded down to whole MiB. Larger limits keep the
## PostgreSQL default of 128MB.
##
## @section Audit parameters
##
## @typedef {struct} Audit - PostgreSQL audit configuration.
## @field {bool} [enabled] - Enable PostgreSQL auditing. Loads the pgaudit extension through the `sharedPreloadLibraries` allowlist and turns on `log_connections`/`log_disconnections`, so who connected and the classes of statement they ran are written to the instance log and collected by the platform log stack. The audited statement classes are set by `log`. Off by default. Enabling or disabling it restarts PostgreSQL, since pgaudit is a preloaded library. Note that `write` and `all` record statement text with literal values, so anyone who can read the tenant's log stack can read audited data; keep that in mind on a shared Monitoring.
## @field {string} [log] - pgaudit session audit classes recorded when `enabled`, as the comma-separated value of `pgaudit.log`. Valid classes are `read`, `write`, `function`, `role`, `ddl`, `misc`, `misc_set`, `all` and `none`; a class may be prefixed with `-` to subtract it from `all` (for example `ddl, role`, `write, ddl, role`, or `all, -misc`). `all` logs every statement including reads and is heavy. Defaults to `write, ddl, role`. A `pgaudit.log` set in `postgresql.parameters` overrides this. The pattern rejects an unrecognised class at admission, which otherwise makes pgaudit fall back to `none` at the next start and silently disables auditing.
## @pattern ^(\s*-?(read|write|function|role|ddl|misc_set|misc|all|none)\s*(,\s*-?(read|write|function|role|ddl|misc_set|misc|all|none)\s*)*)?$
## @param {Audit} audit - PostgreSQL audit configuration.
audit:
enabled: false
log: "write, ddl, role"
##
## @section Quorum-based synchronous replication
##
+2 -2
View File
@@ -30,7 +30,7 @@ spec:
singular: postgres
plural: postgreses
openAPISchema: |-
{"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of Postgres replicas. Under active autoscaling this is the resting/seed count, not the live count — KEDA drives the live count via `/scale`. Disabling autoscaling does NOT automatically bring the live count back to `replicas`: the client-side merge writes `instances` only when the rendered value changes, so a cluster KEDA grew past `replicas` stays there with no autoscaler left to reduce it — lower `replicas` to the count you want and it rebases down (shedding the surplus replicas + PVCs). Lowering it below the live count, or disabling/dry-running while it sits below the live count, sheds in one step past the scaleDown pacing; stage it to the live count first (suspend the HelmRelease and `kubectl scale` if needed) to avoid a transient. Must stay greater than `quorum.maxSyncReplicas`.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each PostgreSQL replica. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.micro","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume Claim size available for application data.","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":"","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"schedulingClass":{"description":"Name of a SchedulingClass CR (cluster-scoped, group cozystack.io) used in place of the tenant's for this application's pods. A pod gets its class when it is created, so running pods keep theirs until they are recreated. Must be the tenant's own class or one listed in the tenant's `allowedSchedulingClasses`. Setting any other value is refused, and the pods of an application whose class is not, or no longer, in that list get the tenant's class. Empty means inherit from the tenant.","type":"string","default":"","maxLength":63},"version":{"description":"PostgreSQL major version to deploy","type":"string","default":"v18","enum":["v18","v17","v16","v15","v14","v13"]},"flavor":{"description":"PostgreSQL image flavor, fixed when the cluster is created. `postgresql` uses the CloudNativePG PostgreSQL image. `postgis` uses the CloudNativePG PostGIS image, which adds postgis, postgis_raster, postgis_topology, postgis_sfcgal, postgis_tiger_geocoder and address_standardizer; enable them per database in `databases.<name>.extensions`. Changing the flavor of an existing cluster is refused, and a backup restores only into a cluster of the flavor it was taken from: to change flavor, create a new cluster and move the data with a logical dump (pg_dump / pg_restore).","type":"string","default":"postgresql","enum":["postgresql","postgis"]},"tls":{"description":"TLS configuration for server connections.","type":"object","default":{},"properties":{"enabled":{"description":"Tri-state switch controlling whether the chart injects the external hostnames into the operator-managed CNPG cert via spec.certificates.serverAltDNSNames. When omitted, the chart injects them if `external: true` and skips them otherwise. Set explicitly to `true` to inject regardless of `external` (no-op when `external: false` since there is no external hostname to add). Set to `false` to skip injection. Note that CNPG keeps its built-in TLS on the wire regardless of this flag Line truncated
{"title":"Chart Values","type":"object","properties":{"replicas":{"description":"Number of Postgres replicas. Under active autoscaling this is the resting/seed count, not the live count — KEDA drives the live count via `/scale`. Disabling autoscaling does NOT automatically bring the live count back to `replicas`: the client-side merge writes `instances` only when the rendered value changes, so a cluster KEDA grew past `replicas` stays there with no autoscaler left to reduce it — lower `replicas` to the count you want and it rebases down (shedding the surplus replicas + PVCs). Lowering it below the live count, or disabling/dry-running while it sits below the live count, sheds in one step past the scaleDown pacing; stage it to the live count first (suspend the HelmRelease and `kubectl scale` if needed) to avoid a transient. Must stay greater than `quorum.maxSyncReplicas`.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration for each PostgreSQL replica. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.micro","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume Claim size available for application data.","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":"","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"schedulingClass":{"description":"Name of a SchedulingClass CR (cluster-scoped, group cozystack.io) used in place of the tenant's for this application's pods. A pod gets its class when it is created, so running pods keep theirs until they are recreated. Must be the tenant's own class or one listed in the tenant's `allowedSchedulingClasses`. Setting any other value is refused, and the pods of an application whose class is not, or no longer, in that list get the tenant's class. Empty means inherit from the tenant.","type":"string","default":"","maxLength":63},"version":{"description":"PostgreSQL major version to deploy","type":"string","default":"v18","enum":["v18","v17","v16","v15","v14","v13"]},"flavor":{"description":"PostgreSQL image flavor, fixed when the cluster is created. `postgresql` uses the CloudNativePG PostgreSQL image. `postgis` uses the CloudNativePG PostGIS image, which adds postgis, postgis_raster, postgis_topology, postgis_sfcgal, postgis_tiger_geocoder and address_standardizer; enable them per database in `databases.<name>.extensions`. Changing the flavor of an existing cluster is refused, and a backup restores only into a cluster of the flavor it was taken from: to change flavor, create a new cluster and move the data with a logical dump (pg_dump / pg_restore).","type":"string","default":"postgresql","enum":["postgresql","postgis"]},"tls":{"description":"TLS configuration for server connections.","type":"object","default":{},"properties":{"enabled":{"description":"Tri-state switch controlling whether the chart injects the external hostnames into the operator-managed CNPG cert via spec.certificates.serverAltDNSNames. When omitted, the chart injects them if `external: true` and skips them otherwise. Set explicitly to `true` to inject regardless of `external` (no-op when `external: false` since there is no external hostname to add). Set to `false` to skip injection. Note that CNPG keeps its built-in TLS on the wire regardless of this flag Line truncated
release:
prefix: postgres-
labels:
@@ -74,7 +74,7 @@ spec:
# labelSelector:
# helm.toolkit.fluxcd.io/name: "{reqs[0]['metadata','name']}"
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "replicas"], ["spec", "resources"], ["spec", "resourcesPreset"], ["spec", "size"], ["spec", "storageClass"], ["spec", "external"], ["spec", "schedulingClass"], ["spec", "version"], ["spec", "flavor"], ["spec", "tls"], ["spec", "postgresql"], ["spec", "postgresql", "parameters"], ["spec", "postgresql", "parameters", "max_connections"], ["spec", "quorum"], ["spec", "quorum", "minSyncReplicas"], ["spec", "quorum", "maxSyncReplicas"], ["spec", "autoscaling"], ["spec", "autoscaling", "enabled"], ["spec", "autoscaling", "serverAddress"], ["spec", "autoscaling", "minReplicas"], ["spec", "autoscaling", "maxReplicas"], ["spec", "autoscaling", "metric"], ["spec", "autoscaling", "target"], ["spec", "autoscaling", "maxReplicationLagSeconds"], ["spec", "autoscaling", "dryRun"], ["spec", "autoscaling", "transition"], ["spec", "users"], ["spec", "databases"], ["spec", "backup"], ["spec", "backup", "enabled"], ["spec", "backup", "useSystemBucket"], ["spec", "backup", "retentionPolicy"], ["spec", "backup", "destinationPath"], ["spec", "backup", "endpointURL"], ["spec", "backup", "schedule"], ["spec", "backup", "s3AccessKey"], ["spec", "backup", "s3SecretKey"], ["spec", "backup", "s3CredentialsSecret"], ["spec", "backup", "s3CredentialsSecret", "name"], ["spec", "backup", "s3CredentialsSecret", "accessKeyIDKey"], ["spec", "backup", "s3CredentialsSecret", "secretAccessKeyKey"], ["spec", "backup", "endpointCA"], ["spec", "backup", "endpointCA", "name"], ["spec", "backup", "endpointCA", "key"], ["spec", "bootstrap"], ["spec", "bootstrap", "enabled"], ["spec", "bootstrap", "recoveryTime"], ["spec", "bootstrap", "backupID"], ["spec", "bootstrap", "oldName"], ["spec", "bootstrap", "serverName"], ["spec", "bootstrap", "newServerName"]]
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "replicas"], ["spec", "resources"], ["spec", "resourcesPreset"], ["spec", "size"], ["spec", "storageClass"], ["spec", "external"], ["spec", "schedulingClass"], ["spec", "version"], ["spec", "flavor"], ["spec", "tls"], ["spec", "postgresql"], ["spec", "postgresql", "parameters"], ["spec", "postgresql", "parameters", "max_connections"], ["spec", "audit"], ["spec", "audit", "enabled"], ["spec", "audit", "log"], ["spec", "quorum"], ["spec", "quorum", "minSyncReplicas"], ["spec", "quorum", "maxSyncReplicas"], ["spec", "autoscaling"], ["spec", "autoscaling", "enabled"], ["spec", "autoscaling", "serverAddress"], ["spec", "autoscaling", "minReplicas"], ["spec", "autoscaling", "maxReplicas"], ["spec", "autoscaling", "metric"], ["spec", "autoscaling", "target"], ["spec", "autoscaling", "maxReplicationLagSeconds"], ["spec", "autoscaling", "dryRun"], ["spec", "autoscaling", "transition"], ["spec", "users"], ["spec", "databases"], ["spec", "backup"], ["spec", "backup", "enabled"], ["spec", "backup", "useSystemBucket"], ["spec", "backup", "retentionPolicy"], ["spec", "backup", "destinationPath"], ["spec", "backup", "endpointURL"], ["spec", "backup", "schedule"], ["spec", "backup", "s3AccessKey"], ["spec", "backup", "s3SecretKey"], ["spec", "backup", "s3CredentialsSecret"], ["spec", "backup", "s3CredentialsSecret", "name"], ["spec", "backup", "s3CredentialsSecret", "accessKeyIDKey"], ["spec", "backup", "s3CredentialsSecret", "secretAccessKeyKey"], ["spec", "backup", "endpointCA"], ["spec", "backup", "endpointCA", "name"], ["spec", "backup", "endpointCA", "key"], ["spec", "bootstrap"], ["spec", "bootstrap", "enabled"], ["spec", "bootstrap", "recoveryTime"], ["spec", "bootstrap", "backupID"], ["spec", "bootstrap", "oldName"], ["spec", "bootstrap", "serverName"], ["spec", "bootstrap", "newServerName"]]
secrets:
exclude: []
include: