Skip to content

Commit c4e2de9

Browse files
committed
fix restart after upgrade
1 parent cf5d9c4 commit c4e2de9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

internal/postgres/config.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func WALStorage(instance *v1beta1.PostgresInstanceSetSpec) string {
117117
// Environment returns the environment variables required to invoke PostgreSQL
118118
// utilities.
119119
func Environment(cluster *v1beta1.PostgresCluster) []corev1.EnvVar {
120-
return []corev1.EnvVar{
120+
env := []corev1.EnvVar{
121121
// - https://www.postgresql.org/docs/current/reference-server.html
122122
{
123123
Name: "PGDATA",
@@ -146,6 +146,9 @@ func Environment(cluster *v1beta1.PostgresCluster) []corev1.EnvVar {
146146
Name: "KRB5RCACHEDIR",
147147
Value: "/tmp",
148148
},
149+
}
150+
151+
if cluster.CompareVersion("2.6.0") >= 0 {
149152
// This allows a custom CA certificate to be mounted for Postgres LDAP
150153
// authentication via spec.config.files.
151154
// - https://wiki.postgresql.org/wiki/LDAP_Authentication_against_AD
@@ -155,11 +158,13 @@ func Environment(cluster *v1beta1.PostgresCluster) []corev1.EnvVar {
155158
// - https://www.openldap.org/software/man.cgi?query=ldap.conf
156159
//
157160
// Testing with LDAPTLS_CACERTDIR did not work as expected during testing.
158-
{
161+
env = append(env, corev1.EnvVar{
159162
Name: "LDAPTLS_CACERT",
160163
Value: configMountPath + "/ldap/ca.crt",
161-
},
164+
})
162165
}
166+
167+
return env
163168
}
164169

165170
// reloadCommand returns an entrypoint that convinces PostgreSQL to reload

0 commit comments

Comments
 (0)