MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / setProbes

Method setProbes

api/v1/cluster_defaults.go:291–318  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

289)
290
291func (r *Cluster) setProbes() {
292 if r.Spec.Probes == nil {
293 r.Spec.Probes = &ProbesConfiguration{}
294 }
295
296 if r.Spec.Probes.Liveness == nil {
297 r.Spec.Probes.Liveness = &LivenessProbe{}
298 }
299
300 // we don't override the isolation check if it is already set
301 if r.Spec.Probes.Liveness.IsolationCheck != nil {
302 return
303 }
304
305 // STEP 1: check if the alpha annotation is present, in that case convert it to spec
306 r.tryConvertAlphaLivenessPinger()
307
308 if r.Spec.Probes.Liveness.IsolationCheck != nil {
309 return
310 }
311
312 // STEP 2: set defaults.
313 r.Spec.Probes.Liveness.IsolationCheck = &IsolationCheckConfiguration{
314 Enabled: ptr.To(true),
315 RequestTimeout: defaultRequestTimeout,
316 ConnectionTimeout: defaultConnectionTimeout,
317 }
318}
319
320func (r *Cluster) tryConvertAlphaLivenessPinger() {
321 if _, ok := r.Annotations[utils.LivenessPingerAnnotationName]; !ok {

Callers 1

setDefaultsMethod · 0.95

Calls 1

Tested by

no test coverage detected