Skip to content

Commit e3c72bb

Browse files
authored
chore: fix the initial run of probe in kbagent (#9511)
1 parent 7cab771 commit e3c72bb

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
@@ -1911,7 +1911,7 @@ type Probe struct {
19111911
InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`
19121912

19131913
// Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
1914-
// Default to 10 seconds. Minimum value is 1.
1914+
// Default to 60 seconds. Minimum value is 1.
19151915
//
19161916
// +optional
19171917
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
@@ -4920,7 +4920,7 @@ spec:
49204920
periodSeconds:
49214921
description: |-
49224922
Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
4923-
Default to 10 seconds. Minimum value is 1.
4923+
Default to 60 seconds. Minimum value is 1.
49244924
format: int32
49254925
type: integer
49264926
preCondition:
@@ -7801,7 +7801,7 @@ spec:
78017801
periodSeconds:
78027802
description: |-
78037803
Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
7804-
Default to 10 seconds. Minimum value is 1.
7804+
Default to 60 seconds. Minimum value is 1.
78057805
format: int32
78067806
type: integer
78077807
preCondition:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4920,7 +4920,7 @@ spec:
49204920
periodSeconds:
49214921
description: |-
49224922
Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
4923-
Default to 10 seconds. Minimum value is 1.
4923+
Default to 60 seconds. Minimum value is 1.
49244924
format: int32
49254925
type: integer
49264926
preCondition:
@@ -7801,7 +7801,7 @@ spec:
78017801
periodSeconds:
78027802
description: |-
78037803
Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
7804-
Default to 10 seconds. Minimum value is 1.
7804+
Default to 60 seconds. Minimum value is 1.
78057805
format: int32
78067806
type: integer
78077807
preCondition:

docs/developer_docs/api-reference/cluster.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9151,7 +9151,7 @@ int32
91519151
<td>
91529152
<em>(Optional)</em>
91539153
<p>Specifies the frequency at which the probe is conducted. This value is expressed in seconds.
9154-
Default to 10 seconds. Minimum value is 1.</p>
9154+
Default to 60 seconds. Minimum value is 1.</p>
91559155
</td>
91569156
</tr>
91579157
<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)