Skip to content

Commit

Permalink
fix: opsRequest can not run forcibly after updating spec.force to true (
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei authored Jun 21, 2024
1 parent 8a96fbd commit 41f4074
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 28 deletions.
16 changes: 8 additions & 8 deletions apis/apps/v1alpha1/opsrequest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ type OpsRequestSpec struct {
// +optional
TTLSecondsAfterSucceed int32 `json:"ttlSecondsAfterSucceed,omitempty"`

// Specifies the maximum time in seconds that the OpsRequest will wait for its pre-conditions to be met
// before it aborts the operation.
// If set to 0 (default), pre-conditions must be satisfied immediately for the OpsRequest to proceed.
//
// +kubebuilder:default=0
// +optional
PreConditionDeadlineSeconds *int32 `json:"preConditionDeadlineSeconds,omitempty"`

// Exactly one of its members must be set.
SpecificOpsRequest `json:",inline"`
}
Expand Down Expand Up @@ -168,14 +176,6 @@ type SpecificOpsRequest struct {
// +optional
ExposeList []Expose `json:"expose,omitempty"`

// Specifies the maximum time in seconds that the OpsRequest will wait for its pre-conditions to be met
// before it aborts the operation.
// If set to 0 (default), pre-conditions must be satisfied immediately for the OpsRequest to proceed.
//
// +kubebuilder:default=0
// +optional
PreConditionDeadlineSeconds *int32 `json:"preConditionDeadlineSeconds,omitempty"`

// Specifies the image and scripts for executing engine-specific operations such as creating databases or users.
// It supports limited engines including MySQL, PostgreSQL, Redis, MongoDB.
//
Expand Down
10 changes: 5 additions & 5 deletions apis/apps/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion controllers/apps/operations/queue_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func enqueueOpsRequestToClusterAnnotation(ctx context.Context, cli client.Client
// the opsRequest is already running.
return &opsRecorder, nil
}
if existOtherRunningOps(opsRequestSlice, opsRecorder.Type, opsBehaviour) {
if !opsRes.OpsRequest.Spec.Force && existOtherRunningOps(opsRequestSlice, opsRecorder.Type, opsBehaviour) {
// if exists other running opsRequest, return.
return &opsRecorder, nil
}
Expand Down
42 changes: 28 additions & 14 deletions docs/developer_docs/api-reference/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -2683,6 +2683,20 @@ int32
</tr>
<tr>
<td>
<code>preConditionDeadlineSeconds</code><br/>
<em>
int32
</em>
</td>
<td>
<em>(Optional)</em>
<p>Specifies the maximum time in seconds that the OpsRequest will wait for its pre-conditions to be met
before it aborts the operation.
If set to 0 (default), pre-conditions must be satisfied immediately for the OpsRequest to proceed.</p>
</td>
</tr>
<tr>
<td>
<code>SpecificOpsRequest</code><br/>
<em>
<a href="#apps.kubeblocks.io/v1alpha1.SpecificOpsRequest">
Expand Down Expand Up @@ -14365,6 +14379,20 @@ int32
</tr>
<tr>
<td>
<code>preConditionDeadlineSeconds</code><br/>
<em>
int32
</em>
</td>
<td>
<em>(Optional)</em>
<p>Specifies the maximum time in seconds that the OpsRequest will wait for its pre-conditions to be met
before it aborts the operation.
If set to 0 (default), pre-conditions must be satisfied immediately for the OpsRequest to proceed.</p>
</td>
</tr>
<tr>
<td>
<code>SpecificOpsRequest</code><br/>
<em>
<a href="#apps.kubeblocks.io/v1alpha1.SpecificOpsRequest">
Expand Down Expand Up @@ -19503,20 +19531,6 @@ Reconfigure
</tr>
<tr>
<td>
<code>preConditionDeadlineSeconds</code><br/>
<em>
int32
</em>
</td>
<td>
<em>(Optional)</em>
<p>Specifies the maximum time in seconds that the OpsRequest will wait for its pre-conditions to be met
before it aborts the operation.
If set to 0 (default), pre-conditions must be satisfied immediately for the OpsRequest to proceed.</p>
</td>
</tr>
<tr>
<td>
<code>scriptSpec</code><br/>
<em>
<a href="#apps.kubeblocks.io/v1alpha1.ScriptSpec">
Expand Down

0 comments on commit 41f4074

Please sign in to comment.