Skip to content

Commit

Permalink
[addon istio] Modify the workflow of canary-rollback (#570)
Browse files Browse the repository at this point in the history
Signed-off-by: suwanliang_yewu <[email protected]>

Signed-off-by: suwanliang_yewu <[email protected]>
  • Loading branch information
suwliang3 authored Dec 27, 2022
1 parent e7ae082 commit 8338a1f
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,21 @@ spec:
template: |-
import ("vela/op")
parameter: {...}
parameter: {
rollbackVersion: string
}
comps: op.#Load
compNames: [ for name, c in comps.value {name}]
firstcomp: compNames[0]
rolloutObj: op.#Read & {
value: {
apiVersion: "standard.oam.dev/v1alpha1"
kind: "Rollout"
metadata: {
name: firstcomp
namespace: context.namespace
}
}
}
_sourceRevision: rolloutObj.value.status.LastSourceRevision
apply: op.#ApplyComponent & {
value: comps.value[firstcomp]
patch: {
traits: "rollout": {
spec: {
targetRevisionName: _sourceRevision
// +patchStrategy=retainKeys
targetRevisionName: parameter.rollbackVersion
}
}
Expand All @@ -45,7 +35,7 @@ spec:
route: [{
destination: {
host: firstcomp
subset: _sourceRevision
subset: parameter.rollbackVersion
}
weight: 100
}]
Expand All @@ -59,8 +49,8 @@ spec:
host: firstcomp
subsets: [
{
name: _sourceRevision
labels: {"service.istio.io/canonical-name": _sourceRevision}
name: parameter.rollbackVersion
labels: {"service.istio.io/canonical-name": parameter.rollbackVersion}
},
]
}
Expand Down
18 changes: 18 additions & 0 deletions experimental/addons/canary-rollout-istio/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: canary-rollout-istio
version: 1.0.2
description: Enable service mash and managing triffic shiffting in workflow.
icon: https://github.com/istio/istio/raw/master/logo/istio-bluelogo-whitebackground-unframed.svg
url: https://istio.io/

tags:
- service-mesh
- rollout

deployTo:
control_plane: true
runtime_cluster: true

dependencies:
- name: istio
- name: rollout

56 changes: 56 additions & 0 deletions experimental/addons/canary-rollout-istio/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Canary Rollout with Istio

This addon provides istio support for vela rollout, it just adds two definitions and depends on vela-rollout and istio addons.

## Directory Structure
```shell
.
├── definitions // contains the X-Definition yaml/cue files. These file will be rendered as KubeVela Component in `template.yaml`
├── metadata.yaml // addon metadata information.
├── readme.md
```

## Quick start
### Install vela canary-rollout-istio addon
```shell
vela addon enable canary-rollout-istio
```
For offline install please use
```shell
cd ~/experimental/addons
vela addon enable canary-rollout-istio/
```
### Verify installs
Check the deployment status of the application through `vela status <application name>:`
```shell
$ vela status addon-canary-rollout-istio -n vela-system
About:

Name: addon-canary-rollout-istio
Namespace: vela-system
Created at: 2022-12-26 15:34:28 +0800 CST
Status: running

Workflow:

mode: DAG-DAG
finished: true
Suspend: false
Terminated: false
Steps
- id: yisdqy3lx7
name: deploy-deploy-addon-to-all-clusters
type: deploy
phase: succeeded
```
When we see that the `finished` field in Workflow is `true` and the Status is `running`, it means that the entire application is delivered successfully.

If status shows as rendering or healthy as false, it means that the application has either failed to deploy or is still being deployed. Please proceed according to the information returned in `kubectl get application <application name> -o yaml`.

You can also view WorkflowStepDefinition list by using the following command:
```shell
$ vela def list |& grep canary-roll
canary-rollback WorkflowStepDefinition vela-system canary-rollout-istio
canary-rollout WorkflowStepDefinition vela-system canary-rollout-istio
```

3 changes: 1 addition & 2 deletions experimental/addons/istio/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: istio
version: 1.0.1
version: 1.0.2
description: Enable service mash and managing triffic shiffting in workflow.
icon: https://github.com/istio/istio/raw/master/logo/istio-bluelogo-whitebackground-unframed.svg
url: https://istio.io/

tags:
- service-mesh
- rollout

deployTo:
control_plane: true
Expand Down
2 changes: 1 addition & 1 deletion experimental/addons/istio/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Istio

This addon provides istio support for vela rollout.
This addon provides istio for service mesh.

## Directory Structure
```shell
Expand Down

0 comments on commit 8338a1f

Please sign in to comment.