Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/customize probe settings in pod spec #97

Prev Previous commit
Remove initial delay seconds for probes
  • Loading branch information
ilya-hontarau committed Apr 2, 2024
commit f5b2f67161b32736e66ddc6d910271044f615b3f
4 changes: 2 additions & 2 deletions api/v1alpha1/etcdcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ type PodSpec struct {

// LivenessProbe defines liveness probe check for the pod.
sircthulhu marked this conversation as resolved.
Show resolved Hide resolved
// If not specified, default probe will be used with HTTP probe handler and path /livez on the port 2379,
// with initialDelaySeconds 5 and periodSeconds 5.
// with periodSeconds 5.
// +optional
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty"`

// ReadinessProbe defines readiness probe check for the pod.
// If not specified, default probe will be used with HTTP probe handler and path /readyz on the port 2379,
// with initialDelaySeconds 5 and periodSeconds 5.
// with periodSeconds 5.
// +optional
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty"`

Expand Down
10 changes: 6 additions & 4 deletions config/crd/bases/etcd.aenix.io_etcdclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1278,8 +1278,9 @@ spec:
for this pod.
type: string
readinessProbe:
description: ReadinessProbe defines readiness probe check for
the pod.
description: |-
ReadinessProbe defines readiness probe check for the pod.
If not specified, default probe will be used.
properties:
exec:
description: Exec specifies the action to take.
Expand Down Expand Up @@ -1667,8 +1668,9 @@ spec:
type: object
type: object
startupProbe:
description: StartupProbe defines startup probe check for the
pod.
description: |-
StartupProbe defines startup probe check for the pod.
If not specified, default probe will be used.
properties:
exec:
description: Exec specifies the action to take.
Expand Down
6 changes: 2 additions & 4 deletions internal/controller/factory/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ func getReadinessProbe(probe *corev1.Probe) *corev1.Probe {
Port: intstr.FromInt32(2379),
},
},
InitialDelaySeconds: 5,
PeriodSeconds: 5,
PeriodSeconds: 5,
}
return mergeWithDefaultProbe(probe, defaultProbe)
}
Expand All @@ -230,8 +229,7 @@ func getLivenessProbe(probe *corev1.Probe) *corev1.Probe {
Port: intstr.FromInt32(2379),
},
},
InitialDelaySeconds: 5,
PeriodSeconds: 5,
PeriodSeconds: 5,
}
return mergeWithDefaultProbe(probe, defaultProbe)
}
Expand Down
57 changes: 24 additions & 33 deletions internal/controller/factory/statefulset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,10 @@ var _ = Describe("CreateOrUpdateStatefulSet handler", func() {
Scheme: v1.URISchemeHTTP,
},
},
InitialDelaySeconds: 0,
TimeoutSeconds: 1,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 3,
TimeoutSeconds: 1,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 3,
}))
})

Expand All @@ -156,11 +155,10 @@ var _ = Describe("CreateOrUpdateStatefulSet handler", func() {
Scheme: v1.URISchemeHTTP,
},
},
InitialDelaySeconds: 5,
TimeoutSeconds: 1,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 3,
TimeoutSeconds: 1,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 3,
}))
})

Expand All @@ -173,11 +171,10 @@ var _ = Describe("CreateOrUpdateStatefulSet handler", func() {
Scheme: v1.URISchemeHTTP,
},
},
InitialDelaySeconds: 5,
TimeoutSeconds: 1,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 3,
TimeoutSeconds: 1,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 3,
}))
})

Expand Down Expand Up @@ -223,11 +220,10 @@ var _ = Describe("CreateOrUpdateStatefulSet handler", func() {
Scheme: v1.URISchemeHTTP,
},
},
InitialDelaySeconds: 0,
TimeoutSeconds: 1,
PeriodSeconds: 7,
SuccessThreshold: 1,
FailureThreshold: 3,
TimeoutSeconds: 1,
PeriodSeconds: 7,
SuccessThreshold: 1,
FailureThreshold: 3,
}))
})

Expand All @@ -240,11 +236,10 @@ var _ = Describe("CreateOrUpdateStatefulSet handler", func() {
Scheme: v1.URISchemeHTTP,
},
},
InitialDelaySeconds: 5,
TimeoutSeconds: 1,
PeriodSeconds: 3,
SuccessThreshold: 1,
FailureThreshold: 3,
TimeoutSeconds: 1,
PeriodSeconds: 3,
SuccessThreshold: 1,
FailureThreshold: 3,
}))
})

Expand Down Expand Up @@ -336,8 +331,7 @@ var _ = Describe("CreateOrUpdateStatefulSet handler", func() {
Port: intstr.FromInt32(2379),
},
},
InitialDelaySeconds: 5,
PeriodSeconds: 5,
PeriodSeconds: 5,
}))
})
It("should correctly override all values", func() {
Expand Down Expand Up @@ -390,8 +384,7 @@ var _ = Describe("CreateOrUpdateStatefulSet handler", func() {
Port: intstr.FromInt32(2379),
},
},
InitialDelaySeconds: 0,
PeriodSeconds: 5,
PeriodSeconds: 5,
}))
})
It("should correctly override all values", func() {
Expand Down Expand Up @@ -444,8 +437,7 @@ var _ = Describe("CreateOrUpdateStatefulSet handler", func() {
Port: intstr.FromInt32(2379),
},
},
InitialDelaySeconds: 5,
PeriodSeconds: 5,
PeriodSeconds: 5,
}))
})
It("should correctly override all values", func() {
Expand Down Expand Up @@ -496,8 +488,7 @@ var _ = Describe("CreateOrUpdateStatefulSet handler", func() {
Port: intstr.FromInt32(2379),
},
},
InitialDelaySeconds: 5,
PeriodSeconds: 5,
PeriodSeconds: 5,
}
defaultProbeCopy := defaultProbe.DeepCopy()

Expand Down