Skip to content

Commit 7a23fe5

Browse files
authored
feat: allow VirtualService HTTPRoute to be inferred if there is single route (argoproj#1273)
Signed-off-by: Jesse Suen <[email protected]>
1 parent fe4bb1b commit 7a23fe5

File tree

16 files changed

+263
-64
lines changed

16 files changed

+263
-64
lines changed

docs/features/specification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ spec:
274274
virtualService:
275275
name: rollout-vsvc # required
276276
routes:
277-
- primary # At least one route is required
277+
- primary # optional if there is a single route in VirtualService, required otherwise
278278

279279
# NGINX Ingress Controller routing configuration
280280
nginx:

docs/features/traffic-management/istio.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ stable ReplicaSet. Istio provides two approaches for weighted traffic splitting,
1717
are available as options in Argo Rollouts:
1818

1919
1. [Host-level traffic splitting](#host-level-traffic-splitting)
20-
2. [Subset-lvel traffic splitting](#subset-level-traffic-splitting)
20+
2. [Subset-level traffic splitting](#subset-level-traffic-splitting)
2121

2222
## Host-level Traffic Splitting
2323

@@ -49,7 +49,7 @@ spec:
4949
virtualService:
5050
name: rollout-vsvc # required
5151
routes:
52-
- primary # required
52+
- primary # optional if there is a single route in VirtualService, required otherwise
5353
steps:
5454
- setWeight: 5
5555
- pause:
@@ -60,7 +60,7 @@ The VirtualService must contain an HTTP route with a name referenced in the Roll
6060
two route destinations with `host` values that match the `canaryService` and `stableService`
6161
referenced in the Rollout. If the VirtualService is defined in a different namespace than the rollout,
6262
its name should be `rollout-vsvc.<vsvc namespace name>`. Note that Istio requires that all weights add to
63-
100, so the initial weights can be be 100% to stable, and 0% to canary.
63+
100, so the initial weights can be 100% to stable, and 0% to canary.
6464

6565
```yaml
6666
apiVersion: networking.istio.io/v1alpha3
@@ -85,7 +85,7 @@ spec:
8585

8686
Finally, a canary and stable Service should be deployed. The selector of these Services will be
8787
modified by the Rollout during an update to target the canary and stable ReplicaSet pods.
88-
Note that if virtualservice and destionation host reside in different namespaces (e.g., virtualservice and rollout are not in the same namespace), we should use FQDN as the destination host like `stable-svc.<namespace>`.
88+
Note that if the VirtualService and destination host resides in different namespaces (e.g., VirtualService and Rollout are not in the same namespace), the namespace should be included in the destination host (e.g. `stable-svc.<namespace>`).
8989

9090
```yaml
9191
apiVersion: v1
@@ -127,7 +127,7 @@ During the lifecycle of a Rollout update, Argo Rollouts will continuously:
127127

128128
!!! note
129129

130-
Rollout does not make any other assumptions about the fields within the Virtual Service or the Istio mesh. The user could specify additional configurations for the virtual service like URI rewrite rules on the primary route or any other route if desired. The user can also create specific destination rules for each of the services.
130+
Rollout does not make any other assumptions about the fields within the VirtualService or the Istio mesh. The user could specify additional configurations for the VirtualService like URI rewrite rules on the primary route or any other route if desired. The user can also create specific DestinationRules for each of the services.
131131

132132

133133
## Subset-level Traffic Splitting
@@ -162,7 +162,7 @@ spec:
162162
virtualService:
163163
name: rollout-vsvc # required
164164
routes:
165-
- primary # required
165+
- primary # optional if there is a single route in VirtualService, required otherwise
166166
destinationRule:
167167
name: rollout-destrule # required
168168
canarySubsetName: canary # required
@@ -173,7 +173,7 @@ spec:
173173
duration: 10m
174174
```
175175

176-
A single service should be defined, which target the Rollout pods. Note that unlike the first
176+
A single service should be defined, which targets the Rollout pods. Note that unlike the first
177177
approach, where traffic splitting is against multiple Services which are modified to contain the
178178
rollout-pod-template-hash of the canary/stable ReplicaSets, this Service is not modified by
179179
the rollout controller.
@@ -195,8 +195,8 @@ spec:
195195

196196
The VirtualService must contain an HTTP route with a name referenced in the Rollout, containing
197197
two route destinations with `subset` values that match the `canarySubsetName` and `stableSubsetName`
198-
referenced in the Rollout. Note that Istio require that all weights add to 100, so the initial
199-
weights can be be 100% to stable, and 0% to canary.
198+
referenced in the Rollout. Note that Istio requires that all weights add to 100, so the initial
199+
weights can be 100% to stable, and 0% to canary.
200200

201201
```yaml
202202
apiVersion: networking.istio.io/v1alpha3
@@ -254,11 +254,11 @@ splitting.
254254
### DNS requirements
255255

256256
With host-level splitting, the VirtualService requires different `host` values to split among the
257-
two destinations. However, using two host values implies that there are different DNS names. For
258-
north-south traffic, which reach the service through the Istio Gateway, having multiple DNS names to
259-
reach the canary vs. stable pods may not matter. However, for east-west traffic that happen inside
260-
the cluster, it forces microservice-to-microservice communication to choose whether to hit the
261-
stable or the canary DNS name, go through the gateway, or add DNS entries for the virtualservices.
257+
two destinations. However, using two host values implies the use of different DNS names (one for
258+
the canary, the other for the stable). For north-south traffic, which reaches the Service through
259+
the Istio Gateway, having multiple DNS names to reach the canary vs. stable pods may not matter.
260+
However, for east-west or intra-cluster traffic, it forces microservice-to-microservice communication to choose whether to hit the
261+
stable or the canary DNS name, go through the gateway, or add DNS entries for the VirtualServices.
262262
In this situation, the DestinationRule subset traffic splitting would be a better option for
263263
intra-cluster canarying.
264264

@@ -358,7 +358,7 @@ other controllers (e.g. Argo Rollouts) controller manage them instead.
358358

359359
An early design alternative was that instead of the controller modifying a referenced VirtualService, the Rollout controller would create, manage, and own a Virtual Service. While this approach is GitOps friendly, it introduces other issues:
360360

361-
* To provide the same flexibility as referencing VirtualService within a Rollout, the Rollout needs to inline a large portion of the Istio spec. However, networking is outside the responsibility of the Rollout and makes the Rollout spec unnecessary complicated.
361+
* To provide the same flexibility as referencing VirtualService within a Rollout, the Rollout needs to inline a large portion of the Istio spec. However, networking is outside the responsibility of the Rollout and makes the Rollout spec unnecessarily complicated.
362362
* If Istio introduces a feature, that feature will not be available in Argo Rollouts until implemented within Argo Rollouts.
363363

364364
Both of these issues adds more complexity to the users and Argo Rollouts developers compared to referencing a Virtual Service.

docs/getting-started/istio/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
# Reference to a VirtualService which the controller updates with canary weights
3535
name: rollouts-demo-vsvc
3636
routes:
37-
- primary # At least one route is required
37+
- primary # optional if there is a single route in VirtualService, required otherwise
3838
...
3939
```
4040

manifests/crds/rollout-crd.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ spec:
525525
type: array
526526
required:
527527
- name
528-
- routes
529528
type: object
530529
required:
531530
- virtualService

manifests/install.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10214,7 +10214,6 @@ spec:
1021410214
type: array
1021510215
required:
1021610216
- name
10217-
- routes
1021810217
type: object
1021910218
required:
1022010219
- virtualService

manifests/namespace-install.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10214,7 +10214,6 @@ spec:
1021410214
type: array
1021510215
required:
1021610216
- name
10217-
- routes
1021810217
type: object
1021910218
required:
1022010219
- virtualService

pkg/apiclient/rollout/rollout.swagger.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@
823823
"items": {
824824
"type": "string"
825825
},
826-
"title": "Routes list of routes within VirtualService to edit"
826+
"title": "Routes are list of routes within VirtualService to edit. If omitted, VirtualService must have a single route"
827827
}
828828
},
829829
"title": "IstioVirtualService holds information on the virtual service the rollout needs to modify"

pkg/apis/rollouts/v1alpha1/generated.proto

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/rollouts/v1alpha1/openapi_generated.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/rollouts/v1alpha1/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ type IstioTrafficRouting struct {
352352
type IstioVirtualService struct {
353353
// Name holds the name of the VirtualService
354354
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
355-
// Routes list of routes within VirtualService to edit
356-
Routes []string `json:"routes" protobuf:"bytes,2,rep,name=routes"`
355+
// Routes are list of routes within VirtualService to edit. If omitted, VirtualService must have a single route
356+
Routes []string `json:"routes,omitempty" protobuf:"bytes,2,rep,name=routes"`
357357
}
358358

359359
// IstioDestinationRule is a reference to an Istio DestinationRule to modify and shape traffic

0 commit comments

Comments
 (0)