@@ -150,6 +150,8 @@ func instanceProbes(cluster *v1beta1.PostgresCluster, container *corev1.Containe
150
150
// TODO(cbandy): Consider if a PreStop hook is necessary.
151
151
container .LivenessProbe = probeTiming (cluster .Spec .Patroni )
152
152
container .LivenessProbe .InitialDelaySeconds = 3
153
+ // Create the probe handler through a constructor for the liveness probe.
154
+ // Introduced with K8SPG-708.
153
155
container .LivenessProbe .ProbeHandler = livenessProbe (cluster )
154
156
155
157
// Readiness is reflected in the controlling object's status (e.g. ReadyReplicas)
@@ -159,9 +161,15 @@ func instanceProbes(cluster *v1beta1.PostgresCluster, container *corev1.Containe
159
161
// of the leader Pod in the leader Service.
160
162
container .ReadinessProbe = probeTiming (cluster .Spec .Patroni )
161
163
container .ReadinessProbe .InitialDelaySeconds = 3
164
+ // Create the probe handler through a constructor for the readiness probe.
165
+ // Introduced with K8SPG-708.
162
166
container .ReadinessProbe .ProbeHandler = readinessProbe (cluster )
163
167
}
164
168
169
+ // livenessProbe is a custom constructor for the liveness probe.
170
+ // This allows for more sophisticated logic to determine whether
171
+ // the database container is considered "alive" beyond basic checks.
172
+ // Introduced with K8SPG-708.
165
173
func livenessProbe (cluster * v1beta1.PostgresCluster ) corev1.ProbeHandler {
166
174
if cluster .CompareVersion ("2.7.0" ) >= 0 {
167
175
return corev1.ProbeHandler {
@@ -179,6 +187,10 @@ func livenessProbe(cluster *v1beta1.PostgresCluster) corev1.ProbeHandler {
179
187
}
180
188
}
181
189
190
+ // readinessProbe is a custom constructor for the liveness probe.
191
+ // This allows for more sophisticated logic to determine whether
192
+ // the database container is considered "alive" beyond basic checks.
193
+ // Introduced with K8SPG-708.
182
194
func readinessProbe (cluster * v1beta1.PostgresCluster ) corev1.ProbeHandler {
183
195
if cluster .CompareVersion ("2.7.0" ) >= 0 {
184
196
return corev1.ProbeHandler {
0 commit comments