Skip to content

Commit 548df2b

Browse files
leon-apeapecloud-bot
authored andcommitted
chore: fix the initial run of probe in kbagent (#9511)
(cherry picked from commit e3c72bb)
1 parent 6cb7214 commit 548df2b

5 files changed

Lines changed: 15 additions & 12 deletions

File tree

apis/apps/v1/componentdefinition_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,7 +1903,7 @@ type Probe struct {
19031903
InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`
19041904

19051905
// Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
1906-
// Default to 10 seconds. Minimum value is 1.
1906+
// Default to 60 seconds. Minimum value is 1.
19071907
//
19081908
// +optional
19091909
PeriodSeconds int32 `json:"periodSeconds,omitempty"`

config/crd/bases/apps.kubeblocks.io_componentdefinitions.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4912,7 +4912,7 @@ spec:
49124912
periodSeconds:
49134913
description: |-
49144914
Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
4915-
Default to 10 seconds. Minimum value is 1.
4915+
Default to 60 seconds. Minimum value is 1.
49164916
format: int32
49174917
type: integer
49184918
preCondition:
@@ -7793,7 +7793,7 @@ spec:
77937793
periodSeconds:
77947794
description: |-
77957795
Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
7796-
Default to 10 seconds. Minimum value is 1.
7796+
Default to 60 seconds. Minimum value is 1.
77977797
format: int32
77987798
type: integer
77997799
preCondition:

deploy/helm/crds/apps.kubeblocks.io_componentdefinitions.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4912,7 +4912,7 @@ spec:
49124912
periodSeconds:
49134913
description: |-
49144914
Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
4915-
Default to 10 seconds. Minimum value is 1.
4915+
Default to 60 seconds. Minimum value is 1.
49164916
format: int32
49174917
type: integer
49184918
preCondition:
@@ -7793,7 +7793,7 @@ spec:
77937793
periodSeconds:
77947794
description: |-
77957795
Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
7796-
Default to 10 seconds. Minimum value is 1.
7796+
Default to 60 seconds. Minimum value is 1.
77977797
format: int32
77987798
type: integer
77997799
preCondition:

docs/developer_docs/api-reference/cluster.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8885,7 +8885,7 @@ int32
88858885
<td>
88868886
<em>(Optional)</em>
88878887
<p>Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
8888-
Default to 10 seconds. Minimum value is 1.</p>
8888+
Default to 60 seconds. Minimum value is 1.</p>
88898889
</td>
88908890
</tr>
88918891
<tr>

pkg/kbagent/service/probe.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,8 @@ func (r *probeRunner) launchRunLoop(probe *proto.Probe) {
129129
}
130130

131131
func (r *probeRunner) runLoop(probe *proto.Probe) {
132-
runOnce := func() ([]byte, error) {
133-
return r.actionService.handleRequest(context.Background(), &proto.ActionRequest{Action: probe.Action})
134-
}
135-
136-
for range r.ticker.C {
137-
output, err := runOnce()
132+
once := func() {
133+
output, err := r.actionService.handleRequest(context.Background(), &proto.ActionRequest{Action: probe.Action})
138134
if err == nil {
139135
r.succeedCount++
140136
r.failedCount = 0
@@ -149,6 +145,13 @@ func (r *probeRunner) runLoop(probe *proto.Probe) {
149145
r.latestOutput = output
150146
}
151147
}
148+
149+
// initial run
150+
once()
151+
152+
for range r.ticker.C {
153+
once()
154+
}
152155
}
153156

154157
func (r *probeRunner) launchReportLoop(probe *proto.Probe) {

0 commit comments

Comments
 (0)