#3935: Move subroutes docs to traffic mgmt section (#4005)

* Move docs to dev guide

* fix link
This commit is contained in:
Ashleigh Brennan 2021-07-13 14:03:50 -05:00 committed by GitHub
parent 2170987992
commit ff985f4224
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 35 deletions

View File

@ -114,7 +114,6 @@ nav:
- Knative Serving:
- Overview: serving/README.md
- Developer Topics:
- Creating and using Subroutes: serving/using-subroutes.md
- Load balancing:
- Overview: serving/load-balancing/README.md
- Configuring target burst capacity: serving/load-balancing/target-burst-capacity.md

View File

@ -1,6 +1,7 @@
plugins:
redirects:
redirect_maps:
serving/using-subroutes.md: developer/serving/traffic-management.md
serving/rolling-out-latest-revision.md: developer/serving/rolling-out-latest-revision.md
serving/tag-resolution.md: developer/serving/tag-resolution.md
serving/deploying-from-private-registry.md: developer/serving/deploying-from-private-registry.md

View File

@ -4,6 +4,34 @@ You can manage traffic routing to different Revisions of a Knative Service by mo
When you create a Knative Service, it does not have any default `traffic` spec settings. By setting the `traffic` spec, you can split traffic over any number of fixed Revisions, or send traffic to the latest Revision by setting `latestRevision: true` in the spec for a Service.
## Using tags to create target URLs
In the following example, the spec defines an attribute called `tag`:
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: example-service
namespace: default
spec:
...
traffic:
- percent: 0
revisionName: example-service-1
tag: staging
- percent: 40
revisionName: example-service-2
- percent: 60
revisionName: example-service-3
```
When a `tag` attribute is applied to a Route, an address for the specific traffic target is created.
In the above example, you can access the staging target by accessing `staging-<route name>.<namespace>.<domain>`. The targets for `example-service-2` and `example-service-3` can only be accessed using the main route, `<route name>.<namespace>.<domain>`.
When a traffic target is tagged, a new Kubernetes Service is created for that Service, so that other Services can access it within the cluster. From the previous example, a new Kubernetes Service called `staging-<route name>` will be created in the same namespace. This Service has the ability to override the visibility of this specific Route by applying the label `networking.knative.dev/visibility` with value `cluster-local`. See the documentation on [private services](../../developer/serving/services/private-services) for more information about how to restrict visibility on specific Routes.
## Traffic routing examples
The following example shows a `traffic` spec where 100% of traffic is routed to the `latestRevision` of the Service. Under `status` you can see the name of the latest Revision that `latestRevision` was resolved to:

View File

@ -1,34 +0,0 @@
# Creating and using Subroutes
Subroutes are most effective when used with multiple revisions. When defining a Knative service/route, the traffic section of the spec can split between the different revisions. For example:
```yaml
traffic:
- percent: 0
revisionName: foo
- percent: 40
revisionName: bar
- percent: 60
revisionName: baz
```
This allows anyone targeting the main route to have a 0% chance of hitting revision `foo`, 40% chance of hitting revision `bar` and 60% chance of hitting revision `baz`.
## Using tags to create target URLs
The spec defines an attribute called `tag`. When a `tag` is applied to a route, an address for the specific traffic target is created.
```yaml
traffic:
- percent: 0
revisionName: foo
tag: staging
- percent: 40
revisionName: bar
- percent: 60
revisionName: baz
```
In the above example, you can access the staging target by accessing `staging-<route name>.<namespace>.<domain>`. The targets for `bar` and `baz` can only be accessed using the main route, `<route name>.<namespace>.<domain>`.
When a traffic target gets tagged, a new Kubernetes service is created for it so that other services can also access it within the cluster. From the above example, a new Kubernetes service called `staging-<route name>` will be created in the same namespace. This service has the ability to override the visibility of this specific route by applying the label `networking.knative.dev/visibility` with value `cluster-local`. See the documentation on [private services](../developer/serving/services/private-services.md) for more information about how to restrict visibility on the specific route.