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 1671970
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 3 deletions.
10 changes: 10 additions & 0 deletions api/v1alpha1/batchrelease_plan_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ 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 how many failed replicas can be tolerated in current batch.
// For example, assume that 10 pods are upgraded in this batch, and MaxUnavailable=20%,
// this batch can enter ready state if at latest 8 upgraded pods are ready.
// Specifically, Rollout will also calculate a global toleration according to all the upgraded
// pods and the MaxUnavailable in workload. The batch should satisfy both of them before enter
// the next batch.
// MaxUnavailable will take effect only when RolloutID is set.
// Default to nil.
// +optional
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
}

// BatchReleaseStatus defines the observed state of a release plan
Expand Down
13 changes: 11 additions & 2 deletions api/v1alpha1/rollout_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ type CanaryStrategy struct {

// CanaryStep defines a step of a canary workload.
type CanaryStep struct {
// SetWeight sets what percentage of the canary pods should receive

// Weight indicate how many percentage of traffic the canary pods should receive
// +optional
Weight *int32 `json:"weight,omitempty"`
// Replicas is the number of expected canary pods in this batch
Expand All @@ -111,6 +110,16 @@ type CanaryStep struct {
// Pause defines a pause stage for a rollout, manual or auto
// +optional
Pause RolloutPause `json:"pause,omitempty"`
// MaxUnavailable indicates how many failed replicas can be tolerated in current batch.
// For example, assume that 10 pods are upgraded in this batch, and MaxUnavailable=20%,
// this batch can enter ready state if at latest 8 upgraded pods are ready.
// Specifically, Rollout will also calculate a global toleration according to all the upgraded
// pods and the MaxUnavailable in workload. The batch should satisfy both of them before enter
// the next batch.
// MaxUnavailable will take effect only when RolloutID is set.
// Default to nil.
// +optional
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
// MetricsAnalysis *RolloutAnalysis `json:"metricsAnalysis,omitempty"`
}

Expand Down
14 changes: 13 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.

15 changes: 15 additions & 0 deletions config/crd/bases/rollouts.kruise.io_batchreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@ 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 how many failed replicas
can be tolerated in current batch. For example, assume
that 10 pods are upgraded in this batch, and MaxUnavailable=20%,
this batch can enter ready state if at latest 8 upgraded
pods are ready. Specifically, Rollout will also calculate
a global toleration according to all the upgraded pods
and the MaxUnavailable in workload. The batch should satisfy
both of them before enter the next batch. MaxUnavailable
will take effect only when RolloutID is set. Default to
nil.
x-kubernetes-int-or-string: true
required:
- canaryReplicas
type: object
Expand Down
17 changes: 17 additions & 0 deletions config/crd/bases/rollouts.kruise.io_rollouts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ spec:
items:
description: CanaryStep defines a step of a canary workload.
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: MaxUnavailable indicates how many failed
replicas can be tolerated in current batch. For example,
assume that 10 pods are upgraded in this batch, and
MaxUnavailable=20%, this batch can enter ready state
if at latest 8 upgraded pods are ready. Specifically,
Rollout will also calculate a global toleration according
to all the upgraded pods and the MaxUnavailable in
workload. The batch should satisfy both of them before
enter the next batch. MaxUnavailable will take effect
only when RolloutID is set. Default to nil.
x-kubernetes-int-or-string: true
pause:
description: Pause defines a pause stage for a rollout,
manual or auto
Expand All @@ -117,6 +132,8 @@ spec:
5) or a percentage of total pods.'
x-kubernetes-int-or-string: true
weight:
description: Weight indicate how many percentage of
traffic the canary pods should receive
format: int32
type: integer
type: object
Expand Down

0 comments on commit 1671970

Please sign in to comment.