Setting Rollout Strategy

The rollout section is used to configure Canary strategy to release your app.

Add rollout config under express-server along with a route.

  1. name: testapp
  2. services:
  3. express-server:
  4. type: webservice
  5. image: oamdev/testapp:rolling01
  6. port: 80
  7. rollout:
  8. replicas: 5
  9. stepWeight: 20
  10. interval: "30s"
  11. route:
  12. domain: "example.com"

The full specification of rollout could be found here

Apply this appfile.yaml:

  1. $ vela up

You could check the status by:

  1. $ vela status testapp
  2. About:
  3. Name: testapp
  4. Namespace: myenv
  5. Created at: 2020-11-09 17:34:38.064006 +0800 CST
  6. Updated at: 2020-11-10 17:05:53.903168 +0800 CST
  7. Services:
  8. - Name: testapp
  9. Type: webservice
  10. HEALTHY Ready: 5/5
  11. Traits:
  12. - rollout: interval=5s
  13. replicas=5
  14. stepWeight=20
  15. - route: Visiting URL: http://example.com IP: <your-ingress-IP-address>
  16. Last Deployment:
  17. Created at: 2020-11-09 17:34:38 +0800 CST
  18. Updated at: 2020-11-10T17:05:53+08:00

Visiting this app by:

  1. $ curl -H "Host:example.com" http://<your-ingress-IP-address>/
  2. Hello World -- Rolling 01

In day 2, assuming we have make some changes on our app and build the new image and name it by oamdev/testapp:v2.

Let’s update the appfile by:

  1. name: testapp
  2. services:
  3. express-server:
  4. type: webservice
  5. - image: oamdev/testapp:rolling01
  6. + image: oamdev/testapp:rolling02
  7. port: 80
  8. rollout:
  9. replicas: 5
  10. stepWeight: 20
  11. interval: "30s"
  12. route:
  13. domain: example.com

Apply this appfile.yaml again:

  1. $ vela up

You could run vela status several times to see the instance rolling:

  1. $ vela status testapp
  2. About:
  3. Name: testapp
  4. Namespace: myenv
  5. Created at: 2020-11-12 19:02:40.353693 +0800 CST
  6. Updated at: 2020-11-12 19:02:40.353693 +0800 CST
  7. Services:
  8. - Name: express-server
  9. Type: webservice
  10. HEALTHY express-server-v2:Ready: 1/1 express-server-v1:Ready: 4/4
  11. Traits:
  12. - rollout: interval=30s
  13. replicas=5
  14. stepWeight=20
  15. - route: Visiting by using 'vela port-forward testapp --route'
  16. Last Deployment:
  17. Created at: 2020-11-12 17:20:46 +0800 CST
  18. Updated at: 2020-11-12T19:02:40+08:00

You could then try to curl your app multiple times and and see how the app being rollout following Canary strategy:

  1. $ curl -H "Host:example.com" http://<your-ingress-ip-address>/
  2. Hello World -- This is rolling 02
  3. $ curl -H "Host:example.com" http://<your-ingress-ip-address>/
  4. Hello World -- Rolling 01
  5. $ curl -H "Host:example.com" http://<your-ingress-ip-address>/
  6. Hello World -- Rolling 01
  7. $ curl -H "Host:example.com" http://<your-ingress-ip-address>/
  8. Hello World -- This is rolling 02
  9. $ curl -H "Host:example.com" http://<your-ingress-ip-address>/
  10. Hello World -- Rolling 01
  11. $ curl -H "Host:example.com" http://<your-ingress-ip-address>/
  12. Hello World -- This is rolling 02

NOTE: please check the detailed documentation for Rollout trait to fully understand how canary release strategy works in KubeVela.