Skip to content

Commit

Permalink
Merge pull request #190 from catpineapple/tadd_start_timeout
Browse files Browse the repository at this point in the history
add_pod_start_timeout
  • Loading branch information
intelligentfu authored Jul 10, 2024
2 parents bdfea3f + ff3b9ab commit cc1851f
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
4 changes: 4 additions & 0 deletions api/doris/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ type BrokerSpec struct {

// BaseSpec describe the foundation spec of pod about doris components.
type BaseSpec struct {

// pod start timeout, unit is second
StartTimeout int32 `json:"startTimeout,omitempty"`

//annotation for fe pods. user can config monitor annotation for collect to monitor system.
Annotations map[string]string `json:"annotations,omitempty"`

Expand Down
16 changes: 16 additions & 0 deletions config/crd/bases/doris.selectdb.com_dorisclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,10 @@ spec:
serviceAccount:
description: serviceAccount for cn access cloud service.
type: string
startTimeout:
description: pod start timeout, unit is second
format: int32
type: integer
systemInitialization:
description: SystemInitialization for fe, be and cn setting system
parameters.
Expand Down Expand Up @@ -3732,6 +3736,10 @@ spec:
serviceAccount:
description: serviceAccount for cn access cloud service.
type: string
startTimeout:
description: pod start timeout, unit is second
format: int32
type: integer
systemInitialization:
description: SystemInitialization for fe, be and cn setting system
parameters.
Expand Down Expand Up @@ -6271,6 +6279,10 @@ spec:
serviceAccount:
description: serviceAccount for cn access cloud service.
type: string
startTimeout:
description: pod start timeout, unit is second
format: int32
type: integer
systemInitialization:
description: SystemInitialization for fe, be and cn setting system
parameters.
Expand Down Expand Up @@ -8137,6 +8149,10 @@ spec:
serviceAccount:
description: serviceAccount for cn access cloud service.
type: string
startTimeout:
description: pod start timeout, unit is second
format: int32
type: integer
systemInitialization:
description: SystemInitialization for fe, be and cn setting system
parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,10 @@ spec:
serviceAccount:
description: serviceAccount for cn access cloud service.
type: string
startTimeout:
description: pod start timeout, unit is second
format: int32
type: integer
systemInitialization:
description: SystemInitialization for fe, be and cn setting system
parameters.
Expand Down Expand Up @@ -3732,6 +3736,10 @@ spec:
serviceAccount:
description: serviceAccount for cn access cloud service.
type: string
startTimeout:
description: pod start timeout, unit is second
format: int32
type: integer
systemInitialization:
description: SystemInitialization for fe, be and cn setting system
parameters.
Expand Down Expand Up @@ -6271,6 +6279,10 @@ spec:
serviceAccount:
description: serviceAccount for cn access cloud service.
type: string
startTimeout:
description: pod start timeout, unit is second
format: int32
type: integer
systemInitialization:
description: SystemInitialization for fe, be and cn setting system
parameters.
Expand Down Expand Up @@ -8137,6 +8149,10 @@ spec:
serviceAccount:
description: serviceAccount for cn access cloud service.
type: string
startTimeout:
description: pod start timeout, unit is second
format: int32
type: integer
systemInitialization:
description: SystemInitialization for fe, be and cn setting system
parameters.
Expand Down
16 changes: 12 additions & 4 deletions pkg/common/utils/resource/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func NewBaseMainContainer(dcr *v1.DorisCluster, config map[string]interface{}, c
c.LivenessProbe = livenessProbe(livenessPort, "")
// use liveness as startup, when in debugging mode will not be killed
//c.StartupProbe = startupProbe(readnessPort, health_api_path)
c.StartupProbe = startupProbe(livenessPort, "")
c.StartupProbe = startupProbe(livenessPort, spec.StartTimeout, "")
c.ReadinessProbe = readinessProbe(readnessPort, health_api_path)
c.Lifecycle = lifeCycle(prestopScript)

Expand Down Expand Up @@ -565,17 +565,25 @@ func getMultiConfigVolumeAndVolumeMount(cmInfo *v1.ConfigMapInfo, componentType
}

// StartupProbe returns a startup probe.
func startupProbe(port int32, path string) *corev1.Probe {
func startupProbe(port, timeout int32, path string) *corev1.Probe {

var failurethreshold int32
if timeout < 180 {
timeout = 180
}

failurethreshold = timeout / 5

if path == "" {
return &corev1.Probe{
FailureThreshold: 60,
FailureThreshold: failurethreshold,
PeriodSeconds: 5,
ProbeHandler: getProbe(port, path, tcpSocket),
}
}

return &corev1.Probe{
FailureThreshold: 60,
FailureThreshold: failurethreshold,
PeriodSeconds: 5,
ProbeHandler: getProbe(port, path, httpGet),
}
Expand Down

0 comments on commit cc1851f

Please sign in to comment.