From f5b2f67161b32736e66ddc6d910271044f615b3f Mon Sep 17 00:00:00 2001 From: hontarau Date: Tue, 2 Apr 2024 16:26:41 +0200 Subject: [PATCH] Remove initial delay seconds for probes --- api/v1alpha1/etcdcluster_types.go | 4 +- .../crd/bases/etcd.aenix.io_etcdclusters.yaml | 10 ++-- internal/controller/factory/statefulset.go | 6 +- .../controller/factory/statefulset_test.go | 57 ++++++++----------- 4 files changed, 34 insertions(+), 43 deletions(-) diff --git a/api/v1alpha1/etcdcluster_types.go b/api/v1alpha1/etcdcluster_types.go index 517e382c..ae14352a 100644 --- a/api/v1alpha1/etcdcluster_types.go +++ b/api/v1alpha1/etcdcluster_types.go @@ -167,13 +167,13 @@ type PodSpec struct { // LivenessProbe defines liveness probe check for the pod. // 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"` diff --git a/config/crd/bases/etcd.aenix.io_etcdclusters.yaml b/config/crd/bases/etcd.aenix.io_etcdclusters.yaml index f4e89f5c..1f388cb5 100644 --- a/config/crd/bases/etcd.aenix.io_etcdclusters.yaml +++ b/config/crd/bases/etcd.aenix.io_etcdclusters.yaml @@ -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. @@ -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. diff --git a/internal/controller/factory/statefulset.go b/internal/controller/factory/statefulset.go index 0d40c3f4..4cf61d66 100644 --- a/internal/controller/factory/statefulset.go +++ b/internal/controller/factory/statefulset.go @@ -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) } @@ -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) } diff --git a/internal/controller/factory/statefulset_test.go b/internal/controller/factory/statefulset_test.go index 82c0c972..2dba02cf 100644 --- a/internal/controller/factory/statefulset_test.go +++ b/internal/controller/factory/statefulset_test.go @@ -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, })) }) @@ -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, })) }) @@ -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, })) }) @@ -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, })) }) @@ -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, })) }) @@ -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() { @@ -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() { @@ -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() { @@ -496,8 +488,7 @@ var _ = Describe("CreateOrUpdateStatefulSet handler", func() { Port: intstr.FromInt32(2379), }, }, - InitialDelaySeconds: 5, - PeriodSeconds: 5, + PeriodSeconds: 5, } defaultProbeCopy := defaultProbe.DeepCopy()