Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions api/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,11 @@ type CellName string
// +kubebuilder:validation:MaxLength=512
type InitdbArgs string

// PostgresConfigRef references a ConfigMap containing extra postgresql.conf lines
// appended to pgctld's auto-tuned defaults via POSTGRES_INITDB_EXTRA_CONF.
// The referenced ConfigMap must exist in the same namespace as the MultigresCluster.
// PostgresConfigRef references a ConfigMap whose postgresql.conf lines are
// merged into the operator-rendered config. The referenced ConfigMap must exist
// in the same namespace as the MultigresCluster. This type is deprecated in
// favor of the inline spec.postgresConfig map; it remains supported for backward
// compatibility and will be removed in a future version.
type PostgresConfigRef struct {
// Name is the name of the ConfigMap.
// +kubebuilder:validation:MinLength=1
Expand Down
32 changes: 24 additions & 8 deletions api/v1alpha1/multigrescluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,21 @@ type ShardOverrides struct {
// +optional
InitdbArgs InitdbArgs `json:"initdbArgs,omitempty"`

// PostgresConfigRef references a ConfigMap containing extra postgresql.conf
// lines appended to pgctld's auto-tuned defaults. The ConfigMap must exist in
// the same namespace. When set, the operator mounts it and sets
// POSTGRES_INITDB_EXTRA_CONF on pgctld.
// PostgresConfigRef references a ConfigMap whose postgresql.conf lines are
// merged into the operator-rendered config for this shard's pools. This field
// is deprecated in favor of the inline PostgresConfig map; it remains
// supported for backward compatibility and will be removed in a future
// version.
// +optional
PostgresConfigRef *PostgresConfigRef `json:"postgresConfigRef,omitempty"`

// PostgresConfig is a map of PostgreSQL parameter (GUC) names to string
// values, merged into the operator-rendered postgresql.conf. It takes
// precedence over PostgresConfigRef and the operator's built-in defaults.
// +optional
// +kubebuilder:validation:MaxProperties=200
PostgresConfig map[string]string `json:"postgresConfig,omitempty"`

// Pools overrides. Keyed by pool name.
// +optional
// +kubebuilder:validation:MaxProperties=8
Expand All @@ -422,13 +430,21 @@ type ShardInlineSpec struct {
// +optional
InitdbArgs InitdbArgs `json:"initdbArgs,omitempty"`

// PostgresConfigRef references a ConfigMap containing extra postgresql.conf
// lines appended to pgctld's auto-tuned defaults. The ConfigMap must exist in
// the same namespace. When set, the operator mounts it and sets
// POSTGRES_INITDB_EXTRA_CONF on pgctld.
// PostgresConfigRef references a ConfigMap whose postgresql.conf lines are
// merged into the operator-rendered config for this shard's pools. This field
// is deprecated in favor of the inline PostgresConfig map; it remains
// supported for backward compatibility and will be removed in a future
// version.
// +optional
PostgresConfigRef *PostgresConfigRef `json:"postgresConfigRef,omitempty"`

// PostgresConfig is a map of PostgreSQL parameter (GUC) names to string
// values, merged into the operator-rendered postgresql.conf. It takes
// precedence over PostgresConfigRef and the operator's built-in defaults.
// +optional
// +kubebuilder:validation:MaxProperties=200
PostgresConfig map[string]string `json:"postgresConfig,omitempty"`

// Pools configuration. Keyed by pool name.
// +optional
// +kubebuilder:validation:MaxProperties=8
Expand Down
48 changes: 44 additions & 4 deletions api/v1alpha1/shard_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,22 @@ type ShardSpec struct {
// +optional
InitdbArgs InitdbArgs `json:"initdbArgs,omitempty"`

// PostgresConfigRef references a ConfigMap containing extra postgresql.conf
// lines appended to pgctld's auto-tuned defaults. The operator mounts it and
// sets POSTGRES_INITDB_EXTRA_CONF on pgctld; PostgreSQL's last-write-wins
// rule lets you override specific params without replacing the whole config.
// PostgresConfigRef references a ConfigMap whose postgresql.conf lines are
// merged into the operator-rendered config for this shard's pools. This field
// is deprecated in favor of the inline PostgresConfig map; it remains
// supported for backward compatibility and will be removed in a future
// version.
// +optional
PostgresConfigRef *PostgresConfigRef `json:"postgresConfigRef,omitempty"`

// PostgresConfig is the resolved map of PostgreSQL parameter (GUC) names to
// string values for this shard. The operator renders it over its defaults and
// any PostgresConfigRef content (PostgresConfig wins on key conflicts) into
// the postgresql.conf mounted into pgctld.
// +optional
// +kubebuilder:validation:MaxProperties=200
PostgresConfig map[string]string `json:"postgresConfig,omitempty"`

// Pools is the map of fully resolved data pool configurations.
// +kubebuilder:validation:MaxProperties=8
// +kubebuilder:validation:XValidation:rule="self.all(key, size(key) < 63)",message="pool names must be < 63 chars"
Expand Down Expand Up @@ -240,12 +249,43 @@ type ShardImages struct {
// CR Controller Status Specs
// ============================================================================

// PostgresConfigStatus reports the rollout state of the operator-rendered
// postgresql.conf for a shard, so a caller can tell whether a config change has
// finished rolling out or failed without inspecting pods.
//
// InProgress is content-based: it compares the config effective on the pods
// against the desired render, so it reflects any config change — a spec edit, a
// PostgresConfigRef ConfigMap edit, or a new operator baseline on upgrade — none
// of which are captured by generation alone. A caller checks
// InProgress == false && Error == "" for "settled", and uses the shard's
// top-level status.observedGeneration as the freshness watermark for a spec
// change.
type PostgresConfigStatus struct {
// InProgress is true while the desired rendered config has not yet landed on
// every pool pod (a config rollout is under way).
// +optional
InProgress bool `json:"inProgress,omitempty"`

// LastAppliedAt is when the rendered config last settled onto every pool pod.
// +optional
LastAppliedAt *metav1.Time `json:"lastAppliedAt,omitempty"`

// Error is non-empty when the config could not be rendered or read (for
// example, a missing PostgresConfigRef ConfigMap).
// +optional
Error string `json:"error,omitempty"`
}

// ShardStatus defines the observed state of Shard.
type ShardStatus struct {
// ObservedGeneration is the most recent generation observed.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// PostgresConfig reports the rollout state of the rendered postgresql.conf.
// +optional
PostgresConfig *PostgresConfigStatus `json:"postgresConfig,omitempty"`

// Conditions represent the latest available observations.
// +optional
// +listType=map
Expand Down
16 changes: 12 additions & 4 deletions api/v1alpha1/shardtemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,21 @@ type ShardTemplateSpec struct {
// +optional
InitdbArgs InitdbArgs `json:"initdbArgs,omitempty"`

// PostgresConfigRef references a ConfigMap containing extra postgresql.conf
// lines appended to pgctld's auto-tuned defaults. The ConfigMap must exist in
// the same namespace. When set, the operator mounts it and sets
// POSTGRES_INITDB_EXTRA_CONF on pgctld.
// PostgresConfigRef references a ConfigMap whose postgresql.conf lines are
// merged into the operator-rendered config for this shard's pools. This field
// is deprecated in favor of the inline PostgresConfig map; it remains
// supported for backward compatibility and will be removed in a future
// version.
// +optional
PostgresConfigRef *PostgresConfigRef `json:"postgresConfigRef,omitempty"`

// PostgresConfig is a map of PostgreSQL parameter (GUC) names to string
// values, merged into the operator-rendered postgresql.conf. It takes
// precedence over PostgresConfigRef and the operator's built-in defaults.
// +optional
// +kubebuilder:validation:MaxProperties=200
PostgresConfig map[string]string `json:"postgresConfig,omitempty"`

// +optional
// +kubebuilder:validation:MaxProperties=8
// +kubebuilder:validation:XValidation:rule="self.all(key, size(key) < 63)",message="pool names must be < 63 chars"
Expand Down
16 changes: 13 additions & 3 deletions api/v1alpha1/tablegroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,22 @@ type ShardResolvedSpec struct {
// +optional
InitdbArgs InitdbArgs `json:"initdbArgs,omitempty"`

// PostgresConfigRef references a ConfigMap containing extra postgresql.conf
// lines appended to pgctld's auto-tuned defaults. When set, the operator
// mounts it and sets POSTGRES_INITDB_EXTRA_CONF on pgctld.
// PostgresConfigRef references a ConfigMap whose postgresql.conf lines are
// merged into the operator-rendered config for this shard's pools. This field
// is deprecated in favor of the inline PostgresConfig map; it remains
// supported for backward compatibility and will be removed in a future
// version.
// +optional
PostgresConfigRef *PostgresConfigRef `json:"postgresConfigRef,omitempty"`

// PostgresConfig is the resolved map of PostgreSQL parameter (GUC) names to
// string values, merged per-key through the shard template override chain.
// The operator renders it over its defaults and any PostgresConfigRef content
// (PostgresConfig wins) into the postgresql.conf mounted into pgctld.
// +optional
// +kubebuilder:validation:MaxProperties=200
PostgresConfig map[string]string `json:"postgresConfig,omitempty"`

// Pools is the map of fully resolved data pool configurations.
// +kubebuilder:validation:MaxProperties=8
// +kubebuilder:validation:XValidation:rule="self.all(key, size(key) < 63)",message="pool names must be < 63 chars"
Expand Down
59 changes: 59 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 28 additions & 8 deletions config/crd/bases/multigres.com_multigresclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5499,12 +5499,22 @@ spec:
- message: Pools cannot be removed or renamed
in this version (Append-Only)
rule: oldSelf.all(k, k in self)
postgresConfig:
additionalProperties:
type: string
description: |-
PostgresConfig is a map of PostgreSQL parameter (GUC) names to string
values, merged into the operator-rendered postgresql.conf. It takes
precedence over PostgresConfigRef and the operator's built-in defaults.
maxProperties: 200
type: object
postgresConfigRef:
description: |-
PostgresConfigRef references a ConfigMap containing extra postgresql.conf
lines appended to pgctld's auto-tuned defaults. The ConfigMap must exist in
the same namespace. When set, the operator mounts it and sets
POSTGRES_INITDB_EXTRA_CONF on pgctld.
PostgresConfigRef references a ConfigMap whose postgresql.conf lines are
merged into the operator-rendered config for this shard's pools. This field
is deprecated in favor of the inline PostgresConfig map; it remains
supported for backward compatibility and will be removed in a future
version.
properties:
key:
description: Key is the key within the ConfigMap's
Expand Down Expand Up @@ -7976,12 +7986,22 @@ spec:
- message: Pools cannot be removed or renamed
in this version (Append-Only)
rule: oldSelf.all(k, k in self)
postgresConfig:
additionalProperties:
type: string
description: |-
PostgresConfig is a map of PostgreSQL parameter (GUC) names to string
values, merged into the operator-rendered postgresql.conf. It takes
precedence over PostgresConfigRef and the operator's built-in defaults.
maxProperties: 200
type: object
postgresConfigRef:
description: |-
PostgresConfigRef references a ConfigMap containing extra postgresql.conf
lines appended to pgctld's auto-tuned defaults. The ConfigMap must exist in
the same namespace. When set, the operator mounts it and sets
POSTGRES_INITDB_EXTRA_CONF on pgctld.
PostgresConfigRef references a ConfigMap whose postgresql.conf lines are
merged into the operator-rendered config for this shard's pools. This field
is deprecated in favor of the inline PostgresConfig map; it remains
supported for backward compatibility and will be removed in a future
version.
properties:
key:
description: Key is the key within the ConfigMap's
Expand Down
Loading
Loading