Skip to content

Commit

Permalink
allow set tolerate failed pods for each step
Browse files Browse the repository at this point in the history
Signed-off-by: mingzhou.swx <[email protected]>
  • Loading branch information
mingzhou.swx committed Nov 2, 2022
1 parent 5924c72 commit bbfbd4e
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 1 deletion.
14 changes: 14 additions & 0 deletions api/v1alpha1/batchrelease_plan_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ type ReleasePlan struct {
BatchPartition *int32 `json:"batchPartition,omitempty"`
// RolloutID indicates an id for each rollout progress
RolloutID string `json:"rolloutID,omitempty"`
// MaxUnavailableOnComplete indicates the tolerated failed replicas before entering
// Completed State. If MaxUnavailableWhenComplete is nil, will use MaxUnavailable
// filed in workload.
// Default to nil.
// +optional
MaxUnavailableOnComplete *intstr.IntOrString `json:"maxUnavailableWhenComplete,omitempty"`
}

// ReleaseBatch is used to describe how each batch release should be
Expand All @@ -52,6 +58,14 @@ type ReleaseBatch struct {
// it can be an absolute number (ex: 5) or a percentage of workload replicas.
// batches[i].canaryReplicas should less than or equal to batches[j].canaryReplicas if i < j.
CanaryReplicas intstr.IntOrString `json:"canaryReplicas"`
// MaxUnavailable indicates the tolerated failed replicas in current batch.
// For example, assume that 10 pods are upgraded in this batch, and MaxUnavailable=20%,
// this batch will be ready if at latest 8 pods are ready.
// If this MaxUnavailable field is nil, we will calculate the toleration according to
// all upgraded pods and the MaxUnavailable in workload.
// Default to nil.
// +optional
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
}

// BatchReleaseStatus defines the observed state of a release plan
Expand Down
6 changes: 6 additions & 0 deletions api/v1alpha1/rollout_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ const (

// CanaryStrategy defines parameters for a Replica Based Canary
type CanaryStrategy struct {
// MaxUnavailableOnComplete indicates the tolerated failed replicas before entering
// Completed State. If MaxUnavailableWhenComplete is nil, will use MaxUnavailable
// filed in workload.
// Default to nil.
// +optional
MaxUnavailableOnComplete *intstr.IntOrString `json:"maxUnavailableWhenComplete,omitempty"`
// Steps define the order of phases to execute release in batches(20%, 40%, 60%, 80%, 100%)
// +optional
Steps []CanaryStep `json:"steps,omitempty"`
Expand Down
19 changes: 18 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

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

21 changes: 21 additions & 0 deletions config/crd/bases/rollouts.kruise.io_batchreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,31 @@ spec:
should less than or equal to batches[j].canaryReplicas
if i < j.'
x-kubernetes-int-or-string: true
maxUnavailable:
anyOf:
- type: integer
- type: string
description: MaxUnavailable indicates the tolerated failed
replicas in current batch. For example, assume that 10
pods are upgraded in this batch, and MaxUnavailable=20%,
this batch will be ready if at latest 8 pods are ready.
If this MaxUnavailable field is nil, we will calculate
the toleration according to all upgraded pods and the
MaxUnavailable in workload. Default to nil.
x-kubernetes-int-or-string: true
required:
- canaryReplicas
type: object
type: array
maxUnavailableWhenComplete:
anyOf:
- type: integer
- type: string
description: MaxUnavailableOnComplete indicates the tolerated
failed replicas before entering Completed State. If MaxUnavailableWhenComplete
is nil, will use MaxUnavailable filed in workload. Default to
nil.
x-kubernetes-int-or-string: true
rolloutID:
description: RolloutID indicates an id for each rollout progress
type: string
Expand Down
9 changes: 9 additions & 0 deletions config/crd/bases/rollouts.kruise.io_rollouts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ spec:
description: CanaryStrategy defines parameters for a Replica Based
Canary
properties:
maxUnavailableWhenComplete:
anyOf:
- type: integer
- type: string
description: MaxUnavailableOnComplete indicates the tolerated
failed replicas before entering Completed State. If MaxUnavailableWhenComplete
is nil, will use MaxUnavailable filed in workload. Default
to nil.
x-kubernetes-int-or-string: true
steps:
description: Steps define the order of phases to execute release
in batches(20%, 40%, 60%, 80%, 100%)
Expand Down

0 comments on commit bbfbd4e

Please sign in to comment.