Skip to content

Commit d2b35a6

Browse files
‹refactor-opj-opsStatus› (#17)
* ‹refactor-opj-opsStatus› * remove code
1 parent e7c84ff commit d2b35a6

File tree

3 files changed

+73
-15
lines changed

3 files changed

+73
-15
lines changed

apps/v1alpha1/operationjob_types.go

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20+
"fmt"
21+
2022
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2123
)
2224

@@ -35,11 +37,10 @@ const (
3537
type OperationProgress string
3638

3739
const (
38-
OperationProgressPending OperationProgress = "Pending"
39-
OperationProgressProcessing OperationProgress = "Processing"
40-
OperationProgressFinishingOpsLifecycle OperationProgress = "FinishingOpsLifecycle"
41-
OperationProgressFailed OperationProgress = "Failed"
42-
OperationProgressSucceeded OperationProgress = "Succeeded"
40+
OperationProgressPending OperationProgress = "Pending"
41+
OperationProgressProcessing OperationProgress = "Processing"
42+
OperationProgressFailed OperationProgress = "Failed"
43+
OperationProgressSucceeded OperationProgress = "Succeeded"
4344
)
4445

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

130-
// reason for current operation progress
131+
// extra info of the target operating progress
131132
// +optional
132-
Reason string `json:"reason,omitempty"`
133+
ExtraInfo map[string]string `json:"extraInfo,omitempty"`
134+
135+
// error indicates the error info of progressing
136+
// +optional
137+
Error *CodeReasonMessage `json:"error,omitempty"`
138+
}
133139

134-
// message displays detail of reason
140+
type CodeReasonMessage struct {
141+
// A human-readable short word
142+
// +optional
143+
Reason string `json:"reason,omitempty"`
144+
// A human-readable message indicating details about the transition.
135145
// +optional
136146
Message string `json:"message,omitempty"`
137147
}
138148

149+
// Error implements error.
150+
func (c *CodeReasonMessage) Error() string {
151+
return fmt.Sprintf("err: reason=%q, message=%q", c.Reason, c.Message)
152+
}
153+
139154
// +k8s:openapi-gen=true
140155
// +genclient
141156
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

apps/v1alpha1/zz_generated.deepcopy.go

Lines changed: 31 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/apps/apps.kusionstack.io_operationjobs.yaml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,31 @@ spec:
121121
description: Operation details of the target pods
122122
items:
123123
properties:
124-
message:
125-
description: message displays detail of reason
126-
type: string
124+
error:
125+
description: error indicates the error info of progressing
126+
properties:
127+
code:
128+
description: Code is a globally unique identifier
129+
type: string
130+
message:
131+
description: A human-readable message indicating details
132+
about the transition.
133+
type: string
134+
reason:
135+
description: A human-readable short word
136+
type: string
137+
type: object
138+
extraInfo:
139+
additionalProperties:
140+
type: string
141+
description: extra info of the target operating progress
142+
type: object
127143
name:
128144
description: name of the target pod
129145
type: string
130146
progress:
131147
description: operation progress of target pod
132148
type: string
133-
reason:
134-
description: reason for current operation progress
135-
type: string
136149
type: object
137150
type: array
138151
totalPodCount:

0 commit comments

Comments
 (0)