Skip to content

Commit

Permalink
Uses '=' for assignment of tags and traffic
Browse files Browse the repository at this point in the history
 replaces using ':' for same
  • Loading branch information
navidshaikh committed Aug 8, 2019
1 parent 50a08fb commit 81e11b6
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions docs/TrafficSplitting.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ For example, you might want to carefully roll out 10% of traffic to your new Rev

Updating the traffic is performed by `kn service update` with the `--traffic` and `--traffic-latest` flags.

- **`--traffic RevisionName:Percent`**
- **`--traffic RevisionName=Percent`**
- `--traffic` flag requires two values separated by a colon
- `RevisionName` string refers to name of Revision and `Percent` integer denotes the traffic portion to assign for this Revision
- `--traffic` flag can be specified multiple times and is valid only if the sum of `Percent` values in all flags add up to 100
Expand All @@ -33,7 +33,7 @@ A tag in traffic block of Service creates a custom URL, which points to the refe
A user can define a unique tag for an available Revision of the Service thereby generating a custom URL of format `http(s)://TAG-SERVICE.DOMAIN`.
A given tag must be unique in traffic block of the Service. `kn` supports assigning and unassigning custom tags for revisions of the Service as part of `kn service update` command as follow:

- **`--tag-revision RevisionName:Tag`**
- **`--tag-revision RevisionName=Tag`**
- `--tag-revision` flag requires two values separated by a colon
- `RevisionName` string refers to name of the `Revision`
- `Tag` string denotes the custom tag to be given for this target
Expand All @@ -47,9 +47,9 @@ A given tag must be unique in traffic block of the Service. `kn` supports assign
- `--tag-latest` flag can be specified only once in a `kn service update` command

*Note*:
- If you have assigned a tag to a particular Revision, a user can reference the Revision by its tag in `--traffic` flag as `--traffic Tag:Percent`.
- If you have assigned a tag to a particular Revision, a user can reference the Revision by its tag in `--traffic` flag as `--traffic Tag=Percent`.
- User can specify `--traffic` and `--tag-revision` flags in same `service update` command and allowed to use the new tag for Revision reference
for eg: `kn service update svc --tag-revision echo-abcde:stable --traffic stable:100`.
for eg: `kn service update svc --tag-revision echo-abcde=stable --traffic stable=100`.

### 3. Untag Revisions:
Assigned tags to revisions in traffic block can be unassigned, thereby removing any custom URLs. A user can unassign the tags for revisions as part of `kn service update` command as follow:
Expand All @@ -61,7 +61,7 @@ Assigned tags to revisions in traffic block can be unassigned, thereby removing

*Note*:
- `--untag-revision` flag's action takes first precedence. If `--untag-revision` and `--tag-revision` flags specified together for revisions, all the mentioned tags will be unassigned from revisions first followed by tagging them.
- Using `--untag-revision` with `--tag-revision` can be used to *update* tag for a particular Revision, for eg: to update tag from `current` to `stable` for a Revision `echo-v3`, do `kn service update svc --untag-revision current --tag-revision echo-v3:stable`
- Using `--untag-revision` with `--tag-revision` can be used to *update* tag for a particular Revision, for eg: to update tag from `current` to `stable` for a Revision `echo-v3`, do `kn service update svc --untag-revision current --tag-revision echo-v3=stable`
- If a Revision is untagged and it is assigned 0% of the traffic, its removed from the traffic block entirely.

## Flag operation precedence
Expand All @@ -75,7 +75,7 @@ Assigned tags to revisions in traffic block can be unassigned, thereby removing

Thus, if a user wants to update tag for revision `echo-v2` from `new` to `old` with `50%` traffic while adjusting rest to latest revision, will do
```
kn service update svc --untag-revision new --tag-revision echo-v2:old --traffic old:50 --traffic-latest 50
kn service update svc --untag-revision new --tag-revision echo-v2=old --traffic old=50 --traffic-latest 50
```

## Summary
Expand All @@ -84,38 +84,38 @@ Following table shows quick summary for traffic splitting flags, their value for

Flag | Value(s) | Operation | Repetition
:--- | :---: | :--- | :---:
`--traffic` | `RevisionName:Percent` | Give `Percent` traffic to `RevisionName` | :heavy_check_mark:
`--traffic` | `Tag:Percent` | Give `Percent` traffic to the Revision having `Tag` | :heavy_check_mark:
`--traffic` | `RevisionName=Percent` | Give `Percent` traffic to `RevisionName` | :heavy_check_mark:
`--traffic` | `Tag=Percent` | Give `Percent` traffic to the Revision having `Tag` | :heavy_check_mark:
`--traffic-latest` | `Percent` | Give `Percent` traffic to the latest ready Revision | :heavy_multiplication_x:
`--tag-revision` | `RevisionName:Tag` | Give `Tag` to `RevisionName` | :heavy_check_mark:
`--tag-revision` | `RevisionName=Tag` | Give `Tag` to `RevisionName` | :heavy_check_mark:
`--tag-latest` | `Tag` | Give `Tag` to the latest ready Revision | :heavy_multiplication_x:
`--untag-revision` | `Tag` | Remove `Tag` from Revision | :heavy_check_mark:


## Examples
1. Tag revisions `echo-v1` and `echo-v2` as `stable` and `staging` respectively:
```
kn service update svc --tag-revision echo-v1:stable --tag-revision echo-v2:staging
kn service update svc --tag-revision echo-v1=stable --tag-revision echo-v2=staging
```

2. Ramp up/down revision `echo-v3` to `20%`, adjusting other traffic to accommodate:
```
kn service update svc --traffic echo-v3:20 --traffic echo-v2:80
kn service update svc --traffic echo-v3=20 --traffic echo-v2=80
```

3. Give revision `echo-v3` the tag `candidate`, without otherwise changing any traffic split:
```
kn service update svc --tag-revision echo-v3:candidate
kn service update svc --tag-revision echo-v3=candidate
```

4. Give `echo-v3` the tag `candidate`, and `2%` of traffic adjusting other traffic to go to revision `echo-v2`:
```
kn service update svc --tag-revision echo-v3:candidate --traffic candidate:2 --traffic echo-v2:98
kn service update svc --tag-revision echo-v3=candidate --traffic candidate=2 --traffic echo-v2=98
```

6. Update the tag for `echo-v3` from `candidate` to `current`:
```
kn service update svc --untag-revision echo-v3 --tag-revision echo-v3:current
kn service update svc --untag-revision echo-v3 --tag-revision echo-v3=current
```

7. Remove the tag `current` from `echo-v3`:
Expand All @@ -125,17 +125,17 @@ kn service update svc --untag-revision current

8. Remove `echo-v3` having no tag(s) entirely, adjusting `echo-v2` to fill up:
```
kn service update svc --traffic echo-v2:100
kn service update svc --traffic echo-v2=100
```

9. Remove `echo-v1` and its tag `old` from the traffic assignments entirely:
```
kn service update svc --untag-revision old --traffic echo-v1:0
kn service update svc --untag-revision old --traffic echo-v1=0
```

10. Tag revision `echo-v1` with `stable` as well as `current`, and `50-50%` traffic split to each:
```
kn service update svc --tag-revision echo-v1:stable --tag-revision echo-v2:current --traffic stable:50 --traffic current:50
kn service update svc --tag-revision echo-v1=stable --tag-revision echo-v2=current --traffic stable=50 --traffic current=50
```

11. Revert all the traffic to the latest ready revision of service:
Expand All @@ -150,5 +150,5 @@ kn service update svc --tag-latest current

13. Update tag for `echo-v4` from `current` to `testing` and assign all the traffic to it:
```
kn service update svc --untag-revision current --tag-revision echo-v4:testing --traffic testing:100
kn service update svc --untag-revision current --tag-revision echo-v4=testing --traffic testing=100
```

0 comments on commit 81e11b6

Please sign in to comment.