Skip to content

Commit cc1851f

Browse files
Merge pull request #190 from catpineapple/tadd_start_timeout
add_pod_start_timeout
2 parents bdfea3f + ff3b9ab commit cc1851f

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

api/doris/v1/types.go

+4
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ type BrokerSpec struct {
114114

115115
// BaseSpec describe the foundation spec of pod about doris components.
116116
type BaseSpec struct {
117+
118+
// pod start timeout, unit is second
119+
StartTimeout int32 `json:"startTimeout,omitempty"`
120+
117121
//annotation for fe pods. user can config monitor annotation for collect to monitor system.
118122
Annotations map[string]string `json:"annotations,omitempty"`
119123

config/crd/bases/doris.selectdb.com_dorisclusters.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -1866,6 +1866,10 @@ spec:
18661866
serviceAccount:
18671867
description: serviceAccount for cn access cloud service.
18681868
type: string
1869+
startTimeout:
1870+
description: pod start timeout, unit is second
1871+
format: int32
1872+
type: integer
18691873
systemInitialization:
18701874
description: SystemInitialization for fe, be and cn setting system
18711875
parameters.
@@ -3732,6 +3736,10 @@ spec:
37323736
serviceAccount:
37333737
description: serviceAccount for cn access cloud service.
37343738
type: string
3739+
startTimeout:
3740+
description: pod start timeout, unit is second
3741+
format: int32
3742+
type: integer
37353743
systemInitialization:
37363744
description: SystemInitialization for fe, be and cn setting system
37373745
parameters.
@@ -6271,6 +6279,10 @@ spec:
62716279
serviceAccount:
62726280
description: serviceAccount for cn access cloud service.
62736281
type: string
6282+
startTimeout:
6283+
description: pod start timeout, unit is second
6284+
format: int32
6285+
type: integer
62746286
systemInitialization:
62756287
description: SystemInitialization for fe, be and cn setting system
62766288
parameters.
@@ -8137,6 +8149,10 @@ spec:
81378149
serviceAccount:
81388150
description: serviceAccount for cn access cloud service.
81398151
type: string
8152+
startTimeout:
8153+
description: pod start timeout, unit is second
8154+
format: int32
8155+
type: integer
81408156
systemInitialization:
81418157
description: SystemInitialization for fe, be and cn setting system
81428158
parameters.

helm-charts/doris-operator/crds/doris.selectdb.com_dorisclusters.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -1866,6 +1866,10 @@ spec:
18661866
serviceAccount:
18671867
description: serviceAccount for cn access cloud service.
18681868
type: string
1869+
startTimeout:
1870+
description: pod start timeout, unit is second
1871+
format: int32
1872+
type: integer
18691873
systemInitialization:
18701874
description: SystemInitialization for fe, be and cn setting system
18711875
parameters.
@@ -3732,6 +3736,10 @@ spec:
37323736
serviceAccount:
37333737
description: serviceAccount for cn access cloud service.
37343738
type: string
3739+
startTimeout:
3740+
description: pod start timeout, unit is second
3741+
format: int32
3742+
type: integer
37353743
systemInitialization:
37363744
description: SystemInitialization for fe, be and cn setting system
37373745
parameters.
@@ -6271,6 +6279,10 @@ spec:
62716279
serviceAccount:
62726280
description: serviceAccount for cn access cloud service.
62736281
type: string
6282+
startTimeout:
6283+
description: pod start timeout, unit is second
6284+
format: int32
6285+
type: integer
62746286
systemInitialization:
62756287
description: SystemInitialization for fe, be and cn setting system
62766288
parameters.
@@ -8137,6 +8149,10 @@ spec:
81378149
serviceAccount:
81388150
description: serviceAccount for cn access cloud service.
81398151
type: string
8152+
startTimeout:
8153+
description: pod start timeout, unit is second
8154+
format: int32
8155+
type: integer
81408156
systemInitialization:
81418157
description: SystemInitialization for fe, be and cn setting system
81428158
parameters.

pkg/common/utils/resource/pod.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ func NewBaseMainContainer(dcr *v1.DorisCluster, config map[string]interface{}, c
316316
c.LivenessProbe = livenessProbe(livenessPort, "")
317317
// use liveness as startup, when in debugging mode will not be killed
318318
//c.StartupProbe = startupProbe(readnessPort, health_api_path)
319-
c.StartupProbe = startupProbe(livenessPort, "")
319+
c.StartupProbe = startupProbe(livenessPort, spec.StartTimeout, "")
320320
c.ReadinessProbe = readinessProbe(readnessPort, health_api_path)
321321
c.Lifecycle = lifeCycle(prestopScript)
322322

@@ -565,17 +565,25 @@ func getMultiConfigVolumeAndVolumeMount(cmInfo *v1.ConfigMapInfo, componentType
565565
}
566566

567567
// StartupProbe returns a startup probe.
568-
func startupProbe(port int32, path string) *corev1.Probe {
568+
func startupProbe(port, timeout int32, path string) *corev1.Probe {
569+
570+
var failurethreshold int32
571+
if timeout < 180 {
572+
timeout = 180
573+
}
574+
575+
failurethreshold = timeout / 5
576+
569577
if path == "" {
570578
return &corev1.Probe{
571-
FailureThreshold: 60,
579+
FailureThreshold: failurethreshold,
572580
PeriodSeconds: 5,
573581
ProbeHandler: getProbe(port, path, tcpSocket),
574582
}
575583
}
576584

577585
return &corev1.Probe{
578-
FailureThreshold: 60,
586+
FailureThreshold: failurethreshold,
579587
PeriodSeconds: 5,
580588
ProbeHandler: getProbe(port, path, httpGet),
581589
}

0 commit comments

Comments
 (0)