@@ -487,15 +487,49 @@ type ClusterSpec struct {
487487// to be injected in the PostgreSQL Pods
488488type ProbesConfiguration struct {
489489 // The startup probe configuration
490- Startup * Probe `json:"startup,omitempty"`
490+ Startup * ProbeWithStrategy `json:"startup,omitempty"`
491491
492492 // The liveness probe configuration
493493 Liveness * Probe `json:"liveness,omitempty"`
494494
495495 // The readiness probe configuration
496- Readiness * Probe `json:"readiness,omitempty"`
496+ Readiness * ProbeWithStrategy `json:"readiness,omitempty"`
497497}
498498
499+ // ProbeWithStrategy is the configuration of the startup probe
500+ type ProbeWithStrategy struct {
501+ // Probe is the standard probe configuration
502+ Probe `json:",inline"`
503+
504+ // The probe strategy
505+ // +kubebuilder:validation:Enum=pg_isready;streaming;query
506+ // +optional
507+ Type ProbeStrategyType `json:"type,omitempty"`
508+
509+ // Lag limit. Used only for `streaming` strategy
510+ // +optional
511+ MaximumLag * resource.Quantity `json:"maximumLag,omitempty"`
512+ }
513+
514+ // ProbeStrategyType is the type of the strategy used to declare a PostgreSQL instance
515+ // ready
516+ type ProbeStrategyType string
517+
518+ const (
519+ // ProbeStrategyPgIsReady means that the pg_isready tool is used to determine
520+ // whether PostgreSQL is started up
521+ ProbeStrategyPgIsReady ProbeStrategyType = "pg_isready"
522+
523+ // ProbeStrategyStreaming means that pg_isready is positive and the replica is
524+ // connected via streaming replication to the current primary and the lag is, if specified,
525+ // within the limit.
526+ ProbeStrategyStreaming ProbeStrategyType = "streaming"
527+
528+ // ProbeStrategyQuery means that the server is able to connect to the superuser database
529+ // and able to execute a simple query like "-- ping"
530+ ProbeStrategyQuery ProbeStrategyType = "query"
531+ )
532+
499533// Probe describes a health check to be performed against a container to determine whether it is
500534// alive or ready to receive traffic.
501535type Probe struct {
0 commit comments