@@ -150,6 +150,8 @@ func instanceProbes(cluster *v1beta1.PostgresCluster, container *corev1.Containe
150150 // TODO(cbandy): Consider if a PreStop hook is necessary.
151151 container .LivenessProbe = probeTiming (cluster .Spec .Patroni )
152152 container .LivenessProbe .InitialDelaySeconds = 3
153+ // Create the probe handler through a constructor for the liveness probe.
154+ // Introduced with K8SPG-708.
153155 container .LivenessProbe .ProbeHandler = livenessProbe (cluster )
154156
155157 // Readiness is reflected in the controlling object's status (e.g. ReadyReplicas)
@@ -159,9 +161,15 @@ func instanceProbes(cluster *v1beta1.PostgresCluster, container *corev1.Containe
159161 // of the leader Pod in the leader Service.
160162 container .ReadinessProbe = probeTiming (cluster .Spec .Patroni )
161163 container .ReadinessProbe .InitialDelaySeconds = 3
164+ // Create the probe handler through a constructor for the readiness probe.
165+ // Introduced with K8SPG-708.
162166 container .ReadinessProbe .ProbeHandler = readinessProbe (cluster )
163167}
164168
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.
165173func livenessProbe (cluster * v1beta1.PostgresCluster ) corev1.ProbeHandler {
166174 if cluster .CompareVersion ("2.7.0" ) >= 0 {
167175 return corev1.ProbeHandler {
@@ -179,6 +187,10 @@ func livenessProbe(cluster *v1beta1.PostgresCluster) corev1.ProbeHandler {
179187 }
180188}
181189
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.
182194func readinessProbe (cluster * v1beta1.PostgresCluster ) corev1.ProbeHandler {
183195 if cluster .CompareVersion ("2.7.0" ) >= 0 {
184196 return corev1.ProbeHandler {
0 commit comments