From fd0f1c41862877fd0613fb4c3958fb124f9bc955 Mon Sep 17 00:00:00 2001 From: youngLiuHY Date: Tue, 18 Nov 2025 17:09:15 +0800 Subject: [PATCH 1/2] feat: rollout webhook status add exec time --- .../rollout.kusionstack.io_rolloutruns.yaml | 16 ++++++++++++++++ .../rollout.kusionstack.io_scaleruns.yaml | 18 ++++++++++++++++++ rollout/v1alpha1/rolloutrun_types.go | 6 ++++++ rollout/v1alpha1/zz_generated.deepcopy.go | 16 ++++++++++++++-- 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml b/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml index 25cc6f5..4bbf87d 100644 --- a/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml +++ b/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml @@ -4719,6 +4719,10 @@ spec: description: Failure count format: int32 type: integer + finishTime: + description: FinishTime is the time when the hook finished + format: date-time + type: string hookType: description: Webhook Type type: string @@ -4731,6 +4735,10 @@ spec: reason: description: A human-readable short word type: string + startTime: + description: StartTime is the time when the hook started + format: date-time + type: string state: description: Current webhook worker state type: string @@ -4822,6 +4830,10 @@ spec: description: Failure count format: int32 type: integer + finishTime: + description: FinishTime is the time when the hook finished + format: date-time + type: string hookType: description: Webhook Type type: string @@ -4834,6 +4846,10 @@ spec: reason: description: A human-readable short word type: string + startTime: + description: StartTime is the time when the hook started + format: date-time + type: string state: description: Current webhook worker state type: string diff --git a/config/crd/rollout/rollout.kusionstack.io_scaleruns.yaml b/config/crd/rollout/rollout.kusionstack.io_scaleruns.yaml index 2b8b3ab..f239b4f 100644 --- a/config/crd/rollout/rollout.kusionstack.io_scaleruns.yaml +++ b/config/crd/rollout/rollout.kusionstack.io_scaleruns.yaml @@ -354,6 +354,11 @@ spec: description: Failure count format: int32 type: integer + finishTime: + description: FinishTime is the time when the hook + finished + format: date-time + type: string hookType: description: Webhook Type type: string @@ -367,6 +372,10 @@ spec: reason: description: A human-readable short word type: string + startTime: + description: StartTime is the time when the hook started + format: date-time + type: string state: description: Current webhook worker state type: string @@ -524,6 +533,11 @@ spec: description: Failure count format: int32 type: integer + finishTime: + description: FinishTime is the time when the hook + finished + format: date-time + type: string hookType: description: Webhook Type type: string @@ -537,6 +551,10 @@ spec: reason: description: A human-readable short word type: string + startTime: + description: StartTime is the time when the hook started + format: date-time + type: string state: description: Current webhook worker state type: string diff --git a/rollout/v1alpha1/rolloutrun_types.go b/rollout/v1alpha1/rolloutrun_types.go index b9cf496..c85aa05 100644 --- a/rollout/v1alpha1/rolloutrun_types.go +++ b/rollout/v1alpha1/rolloutrun_types.go @@ -207,6 +207,12 @@ type RolloutWebhookStatus struct { HookType HookType `json:"hookType,omitempty"` // Webhook Name Name string `json:"name,omitempty"` + // StartTime is the time when the hook started + // +optional + StartTime *metav1.Time `json:"startTime,omitempty"` + // FinishTime is the time when the hook finished + // +optional + FinishTime *metav1.Time `json:"finishTime,omitempty"` // Webhook result CodeReasonMessage `json:",inline"` // Failure count diff --git a/rollout/v1alpha1/zz_generated.deepcopy.go b/rollout/v1alpha1/zz_generated.deepcopy.go index 13f7eb6..1630d99 100644 --- a/rollout/v1alpha1/zz_generated.deepcopy.go +++ b/rollout/v1alpha1/zz_generated.deepcopy.go @@ -1245,7 +1245,9 @@ func (in *RolloutRunStepStatus) DeepCopyInto(out *RolloutRunStepStatus) { if in.Webhooks != nil { in, out := &in.Webhooks, &out.Webhooks *out = make([]RolloutWebhookStatus, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } return } @@ -1628,6 +1630,14 @@ func (in *RolloutWebhookReviewStatus) DeepCopy() *RolloutWebhookReviewStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RolloutWebhookStatus) DeepCopyInto(out *RolloutWebhookStatus) { *out = *in + if in.StartTime != nil { + in, out := &in.StartTime, &out.StartTime + *out = (*in).DeepCopy() + } + if in.FinishTime != nil { + in, out := &in.FinishTime, &out.FinishTime + *out = (*in).DeepCopy() + } out.CodeReasonMessage = in.CodeReasonMessage return } @@ -1921,7 +1931,9 @@ func (in *ScaleRunStepStatus) DeepCopyInto(out *ScaleRunStepStatus) { if in.Webhooks != nil { in, out := &in.Webhooks, &out.Webhooks *out = make([]RolloutWebhookStatus, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } return } From e8ff1aa6bee3a4f975e956cdf4bd9f2b18abb994 Mon Sep 17 00:00:00 2001 From: youngLiuHY Date: Wed, 26 Nov 2025 18:47:44 +0800 Subject: [PATCH 2/2] fix: update workload status field && set AvailableReplicas to optional --- config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml | 3 --- rollout/v1alpha1/rollout_types.go | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml b/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml index 4bbf87d..b580d4e 100644 --- a/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml +++ b/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml @@ -4701,7 +4701,6 @@ spec: description: UpdatedRevision is the updated template revision used to generate pods. type: string required: - - availableReplicas - replicas - updatedAvailableReplicas - updatedReadyReplicas @@ -4812,7 +4811,6 @@ spec: description: UpdatedRevision is the updated template revision used to generate pods. type: string required: - - availableReplicas - replicas - updatedAvailableReplicas - updatedReadyReplicas @@ -4959,7 +4957,6 @@ spec: description: UpdatedRevision is the updated template revision used to generate pods. type: string required: - - availableReplicas - replicas - updatedAvailableReplicas - updatedReadyReplicas diff --git a/rollout/v1alpha1/rollout_types.go b/rollout/v1alpha1/rollout_types.go index db11463..bc08ed0 100644 --- a/rollout/v1alpha1/rollout_types.go +++ b/rollout/v1alpha1/rollout_types.go @@ -179,6 +179,7 @@ type RolloutReplicasSummary struct { // Replicas is the desired number of pods targeted by workload Replicas int32 `json:"replicas"` // AvailableReplicas is the number of service available pods targeted by workload. + // +optional AvailableReplicas int32 `json:"availableReplicas"` // UpdatedReplicas is the number of pods targeted by workload that have the updated template spec. UpdatedReplicas int32 `json:"updatedReplicas"`