-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
K8SPG-704: Allow configuring create_replica_methods #1110
Conversation
// K8SPG-704: Allow overriding create replica methods list | ||
if cluster.Spec.Patroni != nil && len(cluster.Spec.Patroni.CreateReplicaMethods) > 0 { | ||
methods = []string{} | ||
for _, m := range cluster.Spec.Patroni.CreateReplicaMethods { | ||
methods = append(methods, string(m)) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend unit testing this function. In order to better manage the test in future upstream merges, maybe we can just add the following in
cluster.Spec.Patroni.CreateReplicaMethods = []v1beta1.CreateReplicaMethod{"custom1", "custom2"}
dataWithCustomMethods, err := instanceYAML(cluster, instance, nil)
assert.NilError(t, err)
assert.Equal(t, dataWithCustomMethods, strings.Trim(`
# Generated by postgres-operator. DO NOT EDIT.
# Your changes will not be saved.
bootstrap:
initdb:
- data-checksums
- encoding=UTF8
- waldir=/pgdata/pg12_wal
- encryption-key-command=echo test
method: initdb
kubernetes: {}
postgresql:
basebackup:
- waldir=/pgdata/pg12_wal
create_replica_methods:
- custom1
- custom2
pgpass: /tmp/.pgpass
use_unix_socket: true
restapi: {}
tags: {}
`, "\t\n")+"\n")
In func TestInstanceYAML(t *testing.T)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commit: e7feb65 |
CHANGE DESCRIPTION
Even though we are adding a way to override Patroni configuration in #1108, support team requests a way to permanently configure
create_replica_methods
through cr.yaml. This PR adds a new field calledcreateReplicaMethods
underpatroni
:Once user applies this configuration, ConfigMaps that store Patroni instance configuration (
<pod-name>-config
) will be updated by operator but operator won't actually apply the new config to Patroni. It's up to you to runpatronictl reload
.Helm PR: percona/percona-helm-charts#510
CHECKLIST
Jira
Needs Doc
) and QA (Needs QA
)?Tests
Config/Logging/Testability