Skip to content

Commit c3e305d

Browse files
authored
feat: rollback windows. Fixes argoproj#574 (argoproj#2394)
* feature: introduce rollback windows fixes: argoproj#574 Signed-off-by: Alex Eftimie <[email protected]> * feature: introduce rollback windows - generated files fixes: argoproj#574 Signed-off-by: Alex Eftimie <[email protected]> * ran codegen again Signed-off-by: Alex Eftimie <[email protected]> * More unit tests. New e2e Signed-off-by: Alex Eftimie <[email protected]> * More tests to make codecov happy Signed-off-by: Alex Eftimie <[email protected]> * increas lint timeout Signed-off-by: Alex Eftimie <[email protected]> * Exclude Experiment RS when computing rollback window Signed-off-by: Alex Eftimie <[email protected]> * Add documentation around new feature rollbackWindow Signed-off-by: Alex Eftimie <[email protected]> * Fix rollback window; cancel pauses and abort and skip to the end of analysis when the window is detected Signed-off-by: Alex Eftimie <[email protected]> Signed-off-by: Alex Eftimie <[email protected]>
1 parent 8c162e9 commit c3e305d

File tree

21 files changed

+1244
-513
lines changed

21 files changed

+1244
-513
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
uses: golangci/golangci-lint-action@v3
4646
with:
4747
version: v1.49.0
48-
args: --timeout 5m
48+
args: --timeout 6m
4949
build:
5050
name: Build
5151
runs-on: ubuntu-latest

docs/features/specification.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ spec:
7878
# than or equal to this value.
7979
restartAt: "2020-03-30T21:19:35Z"
8080

81+
# The rollback window provides a way to fast track deployments to
82+
# previously deployed versions.
83+
# Optional, and by default is not set.
84+
rollbackWindow:
85+
revisions: 3
86+
8187
strategy:
8288

8389
# Blue-green update strategy

docs/rollback.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Rollback Windows
2+
3+
!!! important
4+
5+
Available for blue-green and canary rollouts since v1.4
6+
7+
By default, when an older Rollout manifest is re-applied, the controller treats it the same as a spec change, and will execute the full list of steps, and perform analysis too. There are two exceptions to this rule:
8+
1. the controller detects if it is moving back to a blue-green ReplicaSet which exists and is still scaled up (within its `scaleDownDelay`)
9+
2. the controller detects it is moving back to the canary's "stable" ReplicaSet, and the upgrade had not yet completed.
10+
11+
It is often undesirable to re-run analysis and steps for a rollout, when the desired behavior is to rollback as soon as possible. To help with this, a rollback window feature allows users to indicate that the promotion to the ReplicaSet within the window will skip all steps.
12+
13+
Example:
14+
15+
```yaml
16+
spec:
17+
rollbackWindow:
18+
revisions: 3
19+
20+
revisionHistoryLimit: 5
21+
```
22+
23+
Assume a linear revision history: `1`, `2`, `3`, `4`, `5 (current)`. A rollback from revision 5 back to 4 or 3 will fall within the window, so it will be fast tracked.

manifests/crds/rollout-crd.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ spec:
7979
revisionHistoryLimit:
8080
format: int32
8181
type: integer
82+
rollbackWindow:
83+
properties:
84+
revisions:
85+
format: int32
86+
type: integer
87+
type: object
8288
selector:
8389
properties:
8490
matchExpressions:

manifests/install.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11089,6 +11089,12 @@ spec:
1108911089
revisionHistoryLimit:
1109011090
format: int32
1109111091
type: integer
11092+
rollbackWindow:
11093+
properties:
11094+
revisions:
11095+
format: int32
11096+
type: integer
11097+
type: object
1109211098
selector:
1109311099
properties:
1109411100
matchExpressions:

manifests/namespace-install.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11089,6 +11089,12 @@ spec:
1108911089
revisionHistoryLimit:
1109011090
format: int32
1109111091
type: integer
11092+
rollbackWindow:
11093+
properties:
11094+
revisions:
11095+
format: int32
11096+
type: integer
11097+
type: object
1109211098
selector:
1109311099
properties:
1109411100
matchExpressions:

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ nav:
3737
- Ephemeral Metadata: features/ephemeral-metadata.md
3838
- Restarting Rollouts: features/restart.md
3939
- Scaledown Aborted Rollouts: features/scaledown-aborted-rs.md
40+
- Rollback Window: features/rollback.md
4041
- Anti Affinity: features/anti-affinity/anti-affinity.md
4142
- Helm: features/helm.md
4243
- Kustomize: features/kustomize.md

pkg/apiclient/rollout/rollout.swagger.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,15 @@
11291129
"type": "object",
11301130
"title": "RequiredDuringSchedulingIgnoredDuringExecution defines inter-pod scheduling rule to be RequiredDuringSchedulingIgnoredDuringExecution"
11311131
},
1132+
"github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.RollbackWindowSpec": {
1133+
"type": "object",
1134+
"properties": {
1135+
"revisions": {
1136+
"type": "integer",
1137+
"format": "int32"
1138+
}
1139+
}
1140+
},
11321141
"github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.Rollout": {
11331142
"type": "object",
11341143
"properties": {
@@ -1368,6 +1377,10 @@
13681377
"format": "int32",
13691378
"title": "Minimum number of seconds for which a newly created pod should be ready\nwithout any of its container crashing, for it to be considered available.\nDefaults to 0 (pod will be considered available as soon as it is ready)\n+optional"
13701379
},
1380+
"rollbackWindow": {
1381+
"$ref": "#/definitions/github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.RollbackWindowSpec",
1382+
"title": "The window in which a rollback will be fast tracked (fully promoted)\n+optional"
1383+
},
13711384
"strategy": {
13721385
"$ref": "#/definitions/github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.RolloutStrategy",
13731386
"title": "The deployment strategy to use to replace existing pods with new ones.\n+optional"

0 commit comments

Comments
 (0)