Skip to content

Commit

Permalink
feat: Multiple VirtualService objects support for canary strategy of …
Browse files Browse the repository at this point in the history
…Argo Rollouts. Addressed few minor review comments fixes #1100

Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
  • Loading branch information
darshanhs09 committed Aug 12, 2021
1 parent 58d3595 commit 2222dc8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
23 changes: 9 additions & 14 deletions rollout/trafficrouting/istio/istio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,17 +855,12 @@ func TestMultipleVirtualServiceReconcileInferredSingleRoute(t *testing.T) {
assert.Equal(t, "update", actions[1].GetVerb())

// Verify we actually made the correct change
vsvcUn1, err := client.Resource(istioutil.GetIstioVirtualServiceGVR()).Namespace(ro.Namespace).Get(context.TODO(), "vsvc1", metav1.GetOptions{})
assert.NoError(t, err)
routes1, _, _ := unstructured.NestedSlice(vsvcUn1.Object, "spec", "http")
route1 := routes1[0].(map[string]interface{})
checkDestination(t, route1, "stable", 90)
checkDestination(t, route1, "canary", 10)

vsvcUn2, err := client.Resource(istioutil.GetIstioVirtualServiceGVR()).Namespace(ro.Namespace).Get(context.TODO(), "vsvc2", metav1.GetOptions{})
assert.NoError(t, err)
routes2, _, _ := unstructured.NestedSlice(vsvcUn2.Object, "spec", "http")
route2 := routes2[0].(map[string]interface{})
checkDestination(t, route2, "stable", 90)
checkDestination(t, route2, "canary", 10)
}
for _, vsvName := range []string{"vsvc1", "vsvc2"} {
vsvcUn, err := client.Resource(istioutil.GetIstioVirtualServiceGVR()).Namespace(ro.Namespace).Get(context.TODO(), vsvName, metav1.GetOptions{})
assert.NoError(t, err)
routes, _, _ := unstructured.NestedSlice(vsvcUn.Object, "spec", "http")
route := routes[0].(map[string]interface{})
checkDestination(t, route, "stable", 90)
checkDestination(t, route, "canary", 10)
}
}
3 changes: 0 additions & 3 deletions utils/istio/istio.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ func GetRolloutVirtualServiceKeys(ro *v1alpha1.Rollout) []string {
}

if MultipleVirtualServiceConfigured(ro) {
if canary.TrafficRouting.Istio.VirtualService.Name != "" {
return []string{}
}
virtualServices = ro.Spec.Strategy.Canary.TrafficRouting.Istio.VirtualServices
} else {
virtualServices = []v1alpha1.IstioVirtualService{ro.Spec.Strategy.Canary.TrafficRouting.Istio.VirtualService}
Expand Down

0 comments on commit 2222dc8

Please sign in to comment.