Skip to content
Open
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
158 changes: 158 additions & 0 deletions config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4500,6 +4500,55 @@ spec:
required:
- targets
type: object
rollback:
description: Rollback Strategy
properties:
batches:
description: Batches define the order of phases to execute release in rollback release
items:
properties:
breakpoint:
description: If set to true, the rollout will be paused before the step starts.
type: boolean
properties:
additionalProperties:
type: string
description: Properties contains additional information for step.
type: object
targets:
description: desired target replicas
items:
properties:
cluster:
description: Cluster indicates the name of cluster
type: string
name:
description: Name is the resource name
type: string
replicaSlidingWindow:
anyOf:
- type: integer
- type: string
description: |-
ReplicaSlidingWindow used to control the number of pods that are allowed to be upgraded in
a sliding window for progressive rollout smoothly.
x-kubernetes-int-or-string: true
replicas:
anyOf:
- type: integer
- type: string
description: Replicas is the replicas of the rollout task, which represents the number of pods to be upgraded
x-kubernetes-int-or-string: true
required:
- name
- replicas
type: object
type: array
required:
- targets
type: object
type: array
type: object
targetType:
description: TargetType defines the GroupVersionKind of target resource
properties:
Expand Down Expand Up @@ -4888,6 +4937,115 @@ spec:
phase:
description: Phase indecates the current phase of rollout
type: string
rollbackStatus:
description: RollbackStatus describes the state of the active rollback release
properties:
currentBatchIndex:
description: CurrentBatchIndex defines the current batch index of batch release progress.
format: int32
type: integer
currentBatchState:
description: CurrentBatchState indicates the current batch state.
type: string
records:
description: Records contains all batches status details.
items:
properties:
finishTime:
description: FinishTime is the time when the stage finished
format: date-time
type: string
index:
description: Index is the id of the batch
format: int32
type: integer
startTime:
description: StartTime is the time when the stage started
format: date-time
type: string
state:
description: State is Rollout step state
type: string
targets:
description: WorkloadDetails contains release details for each workload
items:
properties:
cluster:
description: Cluster defines which cluster the workload is in.
type: string
generation:
description: Generation is the found in workload metadata.
format: int64
type: integer
name:
description: Name is the workload name
type: string
observedGeneration:
description: ObservedGeneration is the most recent generation observed for this workload.
format: int64
type: integer
replicas:
description: Replicas is the desired number of pods targeted by workload
format: int32
type: integer
stableRevision:
description: StableRevision is the old stable revision used to generate pods.
type: string
updatedAvailableReplicas:
description: UpdatedAvailableReplicas is the number of service available pods targeted by workload that have the updated template spec.
format: int32
type: integer
updatedReadyReplicas:
description: UpdatedReadyReplicas is the number of ready pods targeted by workload that have the updated template spec.
format: int32
type: integer
updatedReplicas:
description: UpdatedReplicas is the number of pods targeted by workload that have the updated template spec.
format: int32
type: integer
updatedRevision:
description: UpdatedRevision is the updated template revision used to generate pods.
type: string
required:
- replicas
- updatedAvailableReplicas
- updatedReadyReplicas
- updatedReplicas
type: object
type: array
webhooks:
description: Webhooks contains webhook status
items:
properties:
code:
description: Code is a globally unique identifier
type: string
failureCount:
description: Failure count
format: int32
type: integer
hookType:
description: Webhook Type
type: string
message:
description: A human-readable message indicating details about the transition.
type: string
name:
description: Webhook Name
type: string
reason:
description: A human-readable short word
type: string
state:
description: Current webhook worker state
type: string
type: object
type: array
type: object
type: array
required:
- currentBatchIndex
type: object
targetStatuses:
description: TargetStatuses describes the referenced workloads status
items:
Expand Down
10 changes: 10 additions & 0 deletions rollout/v1alpha1/rollout_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ const (
RolloutReasonProgressingCompleted = "Completed"
// RolloutReasonProgressingCanceled means the rollout is completed.
RolloutReasonProgressingCanceled = "Canceled"
// RolloutReasonProgressingRollbacked means the rollout is rollbacked.
RolloutReasonProgressingRollbacking = "Rollbacking"
// RolloutReasonProgressingRollbacked means the rollout is rollbacked.
RolloutReasonProgressingRollbacked = "Rollbacked"
// RolloutReasonProgressingError means the rollout is completed.
RolloutReasonProgressingError = "Error"
)
Expand Down Expand Up @@ -219,6 +223,9 @@ const (
// RolloutStepPreBatchStepHook indicates that the step is in the pre-batch hook.
RolloutStepPreBatchStepHook RolloutStepState = RolloutStepState(PreBatchStepHook)

// RolloutStepPreRollbackStepHook indicates that the step is in the pre-rollback hook.
RolloutStepPreRollbackStepHook RolloutStepState = RolloutStepState(PreRollbackStepHook)

// RolloutStepRunning indicates that the step is running.
RolloutStepRunning RolloutStepState = "Running"

Expand All @@ -228,6 +235,9 @@ const (
// RolloutStepPostBatchStepHook indicates that the step is in the post-batch hook.
RolloutStepPostBatchStepHook RolloutStepState = RolloutStepState(PostBatchStepHook)

// RolloutStepPostRollbackStepHook indicates that the step is in the post-rollback hook.
RolloutStepPostRollbackStepHook RolloutStepState = RolloutStepState(PostRollbackStepHook)

// RolloutStepSucceeded indicates that the step is completed.
RolloutStepSucceeded RolloutStepState = "Succeeded"

Expand Down
14 changes: 10 additions & 4 deletions rollout/v1alpha1/rollout_webhook_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ type RolloutWebhookReviewSpec struct {
// Batch defines the batch step webhook review spec
// +optional
Batch *RolloutWebhookReviewBatch `json:"batch,omitempty"`

// Rollback defines the rollback step webhook review spec
// +optional
Rollback *RolloutWebhookReviewBatch `json:"rollback,omitempty"`
}

type RolloutWebhookReviewCanary struct {
Expand All @@ -169,10 +173,12 @@ type RolloutWebhookReviewBatch struct {
type HookType string

const (
PreCanaryStepHook HookType = "PreCanaryStepHook"
PostCanaryStepHook HookType = "PostCanaryStepHook"
PreBatchStepHook HookType = "PreBatchStepHook"
PostBatchStepHook HookType = "PostBatchStepHook"
PreCanaryStepHook HookType = "PreCanaryStepHook"
PostCanaryStepHook HookType = "PostCanaryStepHook"
PreBatchStepHook HookType = "PreBatchStepHook"
PostBatchStepHook HookType = "PostBatchStepHook"
PreRollbackStepHook HookType = "PreRollbackStepHook"
PostRollbackStepHook HookType = "PostRollbackStepHook"
)

type RolloutWebhookReviewStatus struct {
Expand Down
33 changes: 31 additions & 2 deletions rollout/v1alpha1/rolloutrun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ type RolloutRunSpec struct {
// Batch Strategy
// +optional
Batch *RolloutRunBatchStrategy `json:"batch,omitempty"`

// Rollback Strategy
// +optional
Rollback *RolloutRunRollbackStrategy `json:"rollback,omitempty"`
}

type RolloutRunBatchStrategy struct {
Expand All @@ -81,6 +85,11 @@ type RolloutRunBatchStrategy struct {
Toleration *TolerationStrategy `json:"toleration,omitempty"`
}

type RolloutRunRollbackStrategy struct {
// Batches define the order of phases to execute release in rollback release
Batches []RolloutRunRollbackStep `json:"batches,omitempty"`
}

type RolloutRunStep struct {
// desired target replicas
Targets []RolloutRunStepTarget `json:"targets"`
Expand All @@ -98,6 +107,19 @@ type RolloutRunStep struct {
Properties map[string]string `json:"properties,omitempty"`
}

type RolloutRunRollbackStep struct {
// desired target replicas
Targets []RolloutRunStepTarget `json:"targets"`

// If set to true, the rollout will be paused before the step starts.
// +optional
Breakpoint bool `json:"breakpoint,omitempty"`

// Properties contains additional information for step.
// +optional
Properties map[string]string `json:"properties,omitempty"`
}

type RolloutRunCanaryStrategy struct {
// desired target replicas
Targets []RolloutRunStepTarget `json:"targets"`
Expand Down Expand Up @@ -146,6 +168,9 @@ type RolloutRunStatus struct {
// BatchStatus describes the state of the active batch release
// +optional
BatchStatus *RolloutRunBatchStatus `json:"batchStatus,omitempty"`
// RollbackStatus describes the state of the active rollback release
// +optional
RollbackStatus *RolloutRunBatchStatus `json:"rollbackStatus,omitempty"`
// TargetStatuses describes the referenced workloads status
// +optional
TargetStatuses []RolloutWorkloadStatus `json:"targetStatuses,omitempty"`
Expand Down Expand Up @@ -177,7 +202,11 @@ const (
RolloutRunPhaseCanceling RolloutRunPhase = "Canceling"
// RolloutRunPhaseCanceled defines the phase of rolloutRun canceled
RolloutRunPhaseCanceled RolloutRunPhase = "Canceled"
// RolloutRunPhaseFailed defines the phase of rolloutRun succeeded
// RolloutRunPhaseRollbacking defines the phase of rolloutRun rollbacking
RolloutRunPhaseRollbacking RolloutRunPhase = "Rollbacking"
// RolloutRunPhaseRollbacked defines the phase of rolloutRun rollbacked
RolloutRunPhaseRollbacked RolloutRunPhase = "Rollbacked"
// RolloutRunPhaseSucceeded defines the phase of rolloutRun succeeded
RolloutRunPhaseSucceeded RolloutRunPhase = "Succeeded"
)

Expand Down Expand Up @@ -226,5 +255,5 @@ func (r *RolloutRun) IsCompleted() bool {
if r == nil {
return false
}
return r.Status.Phase == RolloutRunPhaseSucceeded || r.Status.Phase == RolloutRunPhaseCanceled
return r.Status.Phase == RolloutRunPhaseSucceeded || r.Status.Phase == RolloutRunPhaseCanceled || r.Status.Phase == RolloutRunPhaseRollbacked
}
1 change: 1 addition & 0 deletions rollout/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ type ProgressingInfo struct {
RolloutID string `json:"rolloutID,omitempty"`
Canary *CanaryProgressingInfo `json:"canary,omitempty"`
Batch *BatchProgressingInfo `json:"batch,omitempty"`
Rollback *BatchProgressingInfo `json:"rollback,omitempty"`
}

type CanaryProgressingInfo struct{}
Expand Down
Loading
Loading