Skip to content
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
31 changes: 23 additions & 8 deletions apps/v1alpha1/operationjob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package v1alpha1

import (
"fmt"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -35,11 +37,10 @@ const (
type OperationProgress string

const (
OperationProgressPending OperationProgress = "Pending"
OperationProgressProcessing OperationProgress = "Processing"
OperationProgressFinishingOpsLifecycle OperationProgress = "FinishingOpsLifecycle"
OperationProgressFailed OperationProgress = "Failed"
OperationProgressSucceeded OperationProgress = "Succeeded"
OperationProgressPending OperationProgress = "Pending"
OperationProgressProcessing OperationProgress = "Processing"
OperationProgressFailed OperationProgress = "Failed"
OperationProgressSucceeded OperationProgress = "Succeeded"
)

// OperationJobSpec defines the desired state of OperationJob
Expand Down Expand Up @@ -127,15 +128,29 @@ type OpsStatus struct {
// +optional
Progress OperationProgress `json:"progress,omitempty"`

// reason for current operation progress
// extra info of the target operating progress
// +optional
Reason string `json:"reason,omitempty"`
ExtraInfo map[string]string `json:"extraInfo,omitempty"`

// error indicates the error info of progressing
// +optional
Error *CodeReasonMessage `json:"error,omitempty"`
}

// message displays detail of reason
type CodeReasonMessage struct {
// A human-readable short word
// +optional
Reason string `json:"reason,omitempty"`
// A human-readable message indicating details about the transition.
// +optional
Message string `json:"message,omitempty"`
}

// Error implements error.
func (c *CodeReasonMessage) Error() string {
return fmt.Sprintf("err: reason=%q, message=%q", c.Reason, c.Message)
}

// +k8s:openapi-gen=true
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
32 changes: 31 additions & 1 deletion apps/v1alpha1/zz_generated.deepcopy.go

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

25 changes: 19 additions & 6 deletions config/crd/apps/apps.kusionstack.io_operationjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,31 @@ spec:
description: Operation details of the target pods
items:
properties:
message:
description: message displays detail of reason
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
extraInfo:
additionalProperties:
type: string
description: extra info of the target operating progress
type: object
name:
description: name of the target pod
type: string
progress:
description: operation progress of target pod
type: string
reason:
description: reason for current operation progress
type: string
type: object
type: array
totalPodCount:
Expand Down