synchronous_node_count support (#1484)
* synchronous_node_count support * notification about Patroni image version * default synchronous_node_count to 1 Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
This commit is contained in:
parent
46547c4088
commit
06c28da97d
|
|
@ -343,6 +343,8 @@ spec:
|
||||||
type: boolean
|
type: boolean
|
||||||
synchronous_mode_strict:
|
synchronous_mode_strict:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
synchronous_node_count:
|
||||||
|
type: integer
|
||||||
ttl:
|
ttl:
|
||||||
type: integer
|
type: integer
|
||||||
podAnnotations:
|
podAnnotations:
|
||||||
|
|
|
||||||
|
|
@ -303,6 +303,9 @@ explanation of `ttl` and `loop_wait` parameters.
|
||||||
* **synchronous_mode_strict**
|
* **synchronous_mode_strict**
|
||||||
Patroni `synchronous_mode_strict` parameter value. Can be used in addition to `synchronous_mode`. The default is set to `false`. Optional.
|
Patroni `synchronous_mode_strict` parameter value. Can be used in addition to `synchronous_mode`. The default is set to `false`. Optional.
|
||||||
|
|
||||||
|
* **synchronous_node_count**
|
||||||
|
Patroni `synchronous_node_count` parameter value. Note, this option is only available for Spilo images with Patroni 2.0+. The default is set to `1`. Optional.
|
||||||
|
|
||||||
## Postgres container resources
|
## Postgres container resources
|
||||||
|
|
||||||
Those parameters define [CPU and memory requests and limits](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/)
|
Those parameters define [CPU and memory requests and limits](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/)
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ spec:
|
||||||
retry_timeout: 10
|
retry_timeout: 10
|
||||||
synchronous_mode: false
|
synchronous_mode: false
|
||||||
synchronous_mode_strict: false
|
synchronous_mode_strict: false
|
||||||
|
synchronous_node_count: 1
|
||||||
maximum_lag_on_failover: 33554432
|
maximum_lag_on_failover: 33554432
|
||||||
|
|
||||||
# restore a Postgres DB with point-in-time-recovery
|
# restore a Postgres DB with point-in-time-recovery
|
||||||
|
|
|
||||||
|
|
@ -341,6 +341,8 @@ spec:
|
||||||
type: boolean
|
type: boolean
|
||||||
synchronous_mode_strict:
|
synchronous_mode_strict:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
synchronous_node_count:
|
||||||
|
type: integer
|
||||||
ttl:
|
ttl:
|
||||||
type: integer
|
type: integer
|
||||||
podAnnotations:
|
podAnnotations:
|
||||||
|
|
|
||||||
|
|
@ -534,6 +534,9 @@ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
|
||||||
"synchronous_mode_strict": {
|
"synchronous_mode_strict": {
|
||||||
Type: "boolean",
|
Type: "boolean",
|
||||||
},
|
},
|
||||||
|
"synchronous_node_count": {
|
||||||
|
Type: "integer",
|
||||||
|
},
|
||||||
"ttl": {
|
"ttl": {
|
||||||
Type: "integer",
|
Type: "integer",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,7 @@ type Patroni struct {
|
||||||
Slots map[string]map[string]string `json:"slots,omitempty"`
|
Slots map[string]map[string]string `json:"slots,omitempty"`
|
||||||
SynchronousMode bool `json:"synchronous_mode,omitempty"`
|
SynchronousMode bool `json:"synchronous_mode,omitempty"`
|
||||||
SynchronousModeStrict bool `json:"synchronous_mode_strict,omitempty"`
|
SynchronousModeStrict bool `json:"synchronous_mode_strict,omitempty"`
|
||||||
|
SynchronousNodeCount uint32 `json:"synchronous_node_count,omitempty" defaults:1`
|
||||||
}
|
}
|
||||||
|
|
||||||
// StandbyDescription contains s3 wal path
|
// StandbyDescription contains s3 wal path
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ type patroniDCS struct {
|
||||||
MaximumLagOnFailover float32 `json:"maximum_lag_on_failover,omitempty"`
|
MaximumLagOnFailover float32 `json:"maximum_lag_on_failover,omitempty"`
|
||||||
SynchronousMode bool `json:"synchronous_mode,omitempty"`
|
SynchronousMode bool `json:"synchronous_mode,omitempty"`
|
||||||
SynchronousModeStrict bool `json:"synchronous_mode_strict,omitempty"`
|
SynchronousModeStrict bool `json:"synchronous_mode_strict,omitempty"`
|
||||||
|
SynchronousNodeCount uint32 `json:"synchronous_node_count,omitempty"`
|
||||||
PGBootstrapConfiguration map[string]interface{} `json:"postgresql,omitempty"`
|
PGBootstrapConfiguration map[string]interface{} `json:"postgresql,omitempty"`
|
||||||
Slots map[string]map[string]string `json:"slots,omitempty"`
|
Slots map[string]map[string]string `json:"slots,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
@ -262,6 +263,9 @@ PatroniInitDBParams:
|
||||||
if patroni.SynchronousModeStrict {
|
if patroni.SynchronousModeStrict {
|
||||||
config.Bootstrap.DCS.SynchronousModeStrict = patroni.SynchronousModeStrict
|
config.Bootstrap.DCS.SynchronousModeStrict = patroni.SynchronousModeStrict
|
||||||
}
|
}
|
||||||
|
if patroni.SynchronousNodeCount >= 1 {
|
||||||
|
config.Bootstrap.DCS.SynchronousNodeCount = patroni.SynchronousNodeCount
|
||||||
|
}
|
||||||
|
|
||||||
config.PgLocalConfiguration = make(map[string]interface{})
|
config.PgLocalConfiguration = make(map[string]interface{})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,11 +91,12 @@ func TestGenerateSpiloJSONConfiguration(t *testing.T) {
|
||||||
MaximumLagOnFailover: 33554432,
|
MaximumLagOnFailover: 33554432,
|
||||||
SynchronousMode: true,
|
SynchronousMode: true,
|
||||||
SynchronousModeStrict: true,
|
SynchronousModeStrict: true,
|
||||||
|
SynchronousNodeCount: 1,
|
||||||
Slots: map[string]map[string]string{"permanent_logical_1": {"type": "logical", "database": "foo", "plugin": "pgoutput"}},
|
Slots: map[string]map[string]string{"permanent_logical_1": {"type": "logical", "database": "foo", "plugin": "pgoutput"}},
|
||||||
},
|
},
|
||||||
role: "zalandos",
|
role: "zalandos",
|
||||||
opConfig: config.Config{},
|
opConfig: config.Config{},
|
||||||
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/11/bin","pg_hba":["hostssl all all 0.0.0.0/0 md5","host all all 0.0.0.0/0 md5"]},"bootstrap":{"initdb":[{"auth-host":"md5"},{"auth-local":"trust"},"data-checksums",{"encoding":"UTF8"},{"locale":"en_US.UTF-8"}],"users":{"zalandos":{"password":"","options":["CREATEDB","NOLOGIN"]}},"dcs":{"ttl":30,"loop_wait":10,"retry_timeout":10,"maximum_lag_on_failover":33554432,"synchronous_mode":true,"synchronous_mode_strict":true,"slots":{"permanent_logical_1":{"database":"foo","plugin":"pgoutput","type":"logical"}}}}}`,
|
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/11/bin","pg_hba":["hostssl all all 0.0.0.0/0 md5","host all all 0.0.0.0/0 md5"]},"bootstrap":{"initdb":[{"auth-host":"md5"},{"auth-local":"trust"},"data-checksums",{"encoding":"UTF8"},{"locale":"en_US.UTF-8"}],"users":{"zalandos":{"password":"","options":["CREATEDB","NOLOGIN"]}},"dcs":{"ttl":30,"loop_wait":10,"retry_timeout":10,"maximum_lag_on_failover":33554432,"synchronous_mode":true,"synchronous_mode_strict":true,"synchronous_node_count":1,"slots":{"permanent_logical_1":{"database":"foo","plugin":"pgoutput","type":"logical"}}}}}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue