Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api): move Error to the top level of rolloutRun status #30

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apis/rollout/v1alpha1/rolloutrun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ type RolloutRunStatus struct {
// The last time this status was updated.
// +optional
LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`
// Error indicates the error info of progressing
Error *CodeReasonMessage `json:"error,omitempty"`
// CanaryStatus describes the state of the active canary release
// +optional
CanaryStatus *RolloutRunStepStatus `json:"canaryStatus,omitempty"`
Expand Down Expand Up @@ -151,8 +153,6 @@ type RolloutRunStepStatus struct {
type RolloutRunBatchStatus struct {
// RolloutBatchStatus contains status of current batch
RolloutBatchStatus `json:",inline"`
// Error indicates the error info of progressing
Error *CodeReasonMessage `json:"error,omitempty"`
// Context contains current state context data.
Context map[string]string `json:"context,omitempty"`
// Records contains all batches status details.
Expand Down
10 changes: 5 additions & 5 deletions apis/rollout/v1alpha1/zz_generated.deepcopy.go

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

26 changes: 13 additions & 13 deletions config/crd/bases/rollout.kusionstack.io_rolloutruns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -512,19 +512,6 @@ spec:
currentBatchState:
description: CurrentBatchState indicates the current batch state.
type: string
error:
description: Error indicates the error info of progressing
properties:
code:
description: Code is a globally unique identifier
type: string
message:
description: A human-readable message indicating details about the transition.
type: string
reason:
description: A human-readable short word
type: string
type: object
records:
description: Records contains all batches status details.
items:
Expand Down Expand Up @@ -768,6 +755,19 @@ spec:
- type
type: object
type: array
error:
description: Error indicates the error info of progressing
properties:
code:
description: Code is a globally unique identifier
type: string
message:
description: A human-readable message indicating details about the transition.
type: string
reason:
description: A human-readable short word
type: string
type: object
lastUpdateTime:
description: The last time this status was updated.
format: date-time
Expand Down
3 changes: 1 addition & 2 deletions pkg/controllers/rolloutrun/executor/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func (r *Executor) Do(ctx context.Context, executorContext *ExecutorContext) (bo
}

prePhase := newStatus.Phase
newBatchStatus := newStatus.BatchStatus
r.logger.Info("DefaultExecutor start to process")
defer func() {
r.logger.Info("DefaultExecutor process finished", "phaseFrom", prePhase, "phaseTo", newStatus.Phase)
Expand All @@ -80,7 +79,7 @@ func (r *Executor) Do(ctx context.Context, executorContext *ExecutorContext) (bo
}

// if batchError exist, do nothing
progressingError := newBatchStatus.Error
progressingError := newStatus.Error
if progressingError != nil {
r.logger.Info("DefaultExecutor will terminate since err exist", "batchError", progressingError)
return false, ctrl.Result{}, nil
Expand Down
Loading