@@ -30,10 +30,11 @@ type pgUser struct {
3030}
3131
3232type patroniDCS struct {
33- TTL uint32 `json:"ttl,omitempty"`
34- LoopWait uint32 `json:"loop_wait,omitempty"`
35- RetryTimeout uint32 `json:"retry_timeout,omitempty"`
36- MaximumLagOnFailover float32 `json:"maximum_lag_on_failover,omitempty"`
33+ TTL uint32 `json:"ttl,omitempty"`
34+ LoopWait uint32 `json:"loop_wait,omitempty"`
35+ RetryTimeout uint32 `json:"retry_timeout,omitempty"`
36+ MaximumLagOnFailover float32 `json:"maximum_lag_on_failover,omitempty"`
37+ PGBootstrapConfiguration map [string ]interface {} `json:"postgresql,omitempty"`
3738}
3839
3940type pgBootstrap struct {
@@ -221,7 +222,22 @@ PatroniInitDBParams:
221222 config .PgLocalConfiguration = make (map [string ]interface {})
222223 config .PgLocalConfiguration [patroniPGBinariesParameterName ] = fmt .Sprintf (pgBinariesLocationTemplate , pg .PgVersion )
223224 if len (pg .Parameters ) > 0 {
224- config .PgLocalConfiguration [patroniPGParametersParameterName ] = pg .Parameters
225+ localParameters := make (map [string ]string )
226+ bootstrapParameters := make (map [string ]string )
227+ for param , val := range pg .Parameters {
228+ if ! isBootstrapOnlyParameter (param ) {
229+ localParameters [param ] = val
230+ } else {
231+ bootstrapParameters [param ] = val
232+ }
233+ }
234+ if len (localParameters ) > 0 {
235+ config .PgLocalConfiguration [patroniPGParametersParameterName ] = localParameters
236+ }
237+ if len (bootstrapParameters ) > 0 {
238+ config .Bootstrap .DCS .PGBootstrapConfiguration = make (map [string ]interface {})
239+ config .Bootstrap .DCS .PGBootstrapConfiguration [patroniPGParametersParameterName ] = bootstrapParameters
240+ }
225241 }
226242 config .Bootstrap .Users = map [string ]pgUser {
227243 c .OpConfig .PamRoleName : {
@@ -280,6 +296,16 @@ func (c *Cluster) tolerations(tolerationsSpec *[]v1.Toleration) []v1.Toleration
280296 return []v1.Toleration {}
281297}
282298
299+ func isBootstrapOnlyParameter (param string ) bool {
300+ return param == "max_connections" ||
301+ param == "max_locks_per_transaction" ||
302+ param == "max_worker_processes" ||
303+ param == "max_prepared_transactions" ||
304+ param == "wal_level" ||
305+ param == "wal_log_hints" ||
306+ param == "track_commit_timestamp"
307+ }
308+
283309func (c * Cluster ) generatePodTemplate (
284310 uid types.UID ,
285311 resourceRequirements * v1.ResourceRequirements ,
0 commit comments