diff --git a/api/doris/v1/types.go b/api/doris/v1/types.go index bc2a2538..ccc24715 100644 --- a/api/doris/v1/types.go +++ b/api/doris/v1/types.go @@ -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"` diff --git a/config/crd/bases/doris.selectdb.com_dorisclusters.yaml b/config/crd/bases/doris.selectdb.com_dorisclusters.yaml index f21a2617..d1d42e86 100644 --- a/config/crd/bases/doris.selectdb.com_dorisclusters.yaml +++ b/config/crd/bases/doris.selectdb.com_dorisclusters.yaml @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/helm-charts/doris-operator/crds/doris.selectdb.com_dorisclusters.yaml b/helm-charts/doris-operator/crds/doris.selectdb.com_dorisclusters.yaml index f21a2617..d1d42e86 100644 --- a/helm-charts/doris-operator/crds/doris.selectdb.com_dorisclusters.yaml +++ b/helm-charts/doris-operator/crds/doris.selectdb.com_dorisclusters.yaml @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/pkg/common/utils/resource/pod.go b/pkg/common/utils/resource/pod.go index 59066219..6a69492d 100644 --- a/pkg/common/utils/resource/pod.go +++ b/pkg/common/utils/resource/pod.go @@ -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) @@ -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), }