|
1 | 1 | # Advanced Deployment methods |
2 | 2 |
|
3 | 3 | Once you have the basic canary deployment in place, you can explore |
4 | | -several other deployment scenarios with more flexible routing options |
| 4 | +several other deployment scenarios with more flexible routing options. |
5 | 5 |
|
6 | | -## Pinning clients to a specific version |
| 6 | +## Scenario - pinning clients to a specific version |
7 | 7 |
|
8 | 8 | Sometimes you have some special clients (either humans or other services) which you consider critical and want to stay in the stable version as long as possible even if a canary is in progress. |
9 | 9 |
|
@@ -91,9 +91,53 @@ This defines the following routes |
91 | 91 | 1. `always-old-version` at host `old.example.com` sees always old/stable version (1 backing service) |
92 | 92 | 1. `always-new-version` at new `app.example.com` sees always new/unstable version (1 backing service) |
93 | 93 |
|
| 94 | +Then in your Rollout manifest you only mention the "canary-route" HTTPRoute. This is the only route that Argo Rollouts will manage. The other 2 routes will always stay the same (always old or always new version) regardless of what the canary is doing. |
| 95 | + |
| 96 | +```yaml |
| 97 | +apiVersion: argoproj.io/v1alpha1 |
| 98 | +kind: Rollout |
| 99 | +metadata: |
| 100 | + name: static-rollouts-demo |
| 101 | +spec: |
| 102 | + replicas: 5 |
| 103 | + strategy: |
| 104 | + canary: |
| 105 | + canaryService: argo-rollouts-canary-service |
| 106 | + stableService: argo-rollouts-stable-service |
| 107 | + trafficRouting: |
| 108 | + plugins: |
| 109 | + argoproj-labs/gatewayAPI: |
| 110 | + # only the canary route is managed by Argo rollouts |
| 111 | + httpRoute: canary-route |
| 112 | + namespace: default # namespace where this rollout resides |
| 113 | + steps: |
| 114 | + - setWeight: 10 |
| 115 | + - pause: {} |
| 116 | + - setWeight: 50 |
| 117 | + - pause: { duration: 10 } |
| 118 | + revisionHistoryLimit: 2 |
| 119 | + selector: |
| 120 | + matchLabels: |
| 121 | + app: static-rollouts-demo |
| 122 | + template: |
| 123 | + metadata: |
| 124 | + labels: |
| 125 | + app: static-rollouts-demo |
| 126 | + spec: |
| 127 | + containers: |
| 128 | + - name: static-rollouts-demo |
| 129 | + image: kostiscodefresh/summer-of-k8s-app:v1 |
| 130 | + ports: |
| 131 | + - name: http |
| 132 | + containerPort: 8080 |
| 133 | + protocol: TCP |
| 134 | +
|
| 135 | +``` |
94 | 136 | When a canary is not in progress then all clients see the same/active version without any further changes. |
95 | 137 |
|
96 | | -## Making applications "canary-aware" |
| 138 | +## Scenario - making applications "canary-aware" |
| 139 | + |
| 140 | +Another advanced use case is when you want smarter applications that act differently depending on the current state of the rollout process. |
97 | 141 |
|
98 | 142 | Under normal circumstances an application doesn't know if it is part of canary or not. This is normally not a problem when all your applications are stateless and communicate via HTTP calls. |
99 | 143 |
|
@@ -196,6 +240,17 @@ spec: |
196 | 240 | fieldRef: |
197 | 241 | fieldPath: metadata.labels |
198 | 242 | ``` |
| 243 | + |
199 | 244 | This Rollout passes different RabbitMQ settings to the canary application. |
200 | 245 | The settings will be available to the pod in a file at `/etc/podinfo/labels` where the source code will need to read them. |
201 | 246 |
|
| 247 | +The file will contain the labels in the following format |
| 248 | + |
| 249 | +``` |
| 250 | +role="preview" |
| 251 | +rabbitHost=localhost |
| 252 | +rabbitPort=5672 |
| 253 | +rabbitQueue=myProductionQueue |
| 254 | +``` |
| 255 | +
|
| 256 | +You can easily read this file with your favorite programming language into a settings object. |
0 commit comments