Skip to content

Commit

Permalink
e2e comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubdyszkiewicz committed Jun 13, 2020
1 parent ee848b1 commit 1d5c921
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
16 changes: 4 additions & 12 deletions Makefile.e2e.mk
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,7 @@ wait/traffic-routing/docker-compose/web-to-backend-route: ## Docker Compose: Wai
@echo
@echo "Waiting until custom 'web-to-backend' TrafficRoute is applied ..."
@echo
sleep 10
#$(call docker_compose) exec kuma-example-web sh -c 'for i in `seq 1 10`; do echo -n "try #$$i: " ; if [[ $$( $(call envoy_active_routing_listeners_count,outbound,5000,kuma-example-backend{version=v2}) ) -eq 1 ]]; then echo "listener is now configured for subset routing "; exit 0; fi; sleep 1; done; echo -e "\nError: listener has not been configured for subset routing" ; exit 1'
#$(call docker_compose) exec kuma-example-web sh -c 'for i in `seq 1 10`; do echo -n "try #$$i: " ; if [[ $$( $(call envoy_active_routing_clusters_count,kuma-example-backend{version=v2}) ) -eq 1 ]]; then echo "cluster is now configured for subset routing "; exit 0; fi; sleep 1; done; echo -e "\nError: cluster has not been configured for subset routing" ; exit 1'
sleep 10 # todo(jakubdyszkiewicz) I don't want to build a logic of detecting lb split in cluster since this test will be soon rewritten to E2E Go Framework

verify/traffic-routing/docker-compose/web-to-backend-route: ## Docker Compose: Make sample requests to example setup for TrafficRoute
@echo
Expand All @@ -301,9 +299,7 @@ wait/traffic-routing/docker-compose/no-web-to-backend-route: ## Docker Compose:
@echo
@echo "Waiting until custom 'web-to-backend' TrafficRoute is removed ..."
@echo
sleep 10
#$(call docker_compose) exec kuma-example-web sh -c 'for i in `seq 1 10`; do echo -n "try #$$i: " ; if [[ $$( $(call envoy_active_routing_listeners_count,outbound,5000,kuma-example-backend{version=v2}) ) -eq 0 ]]; then echo "listener is no longer configured for subset routing "; exit 0; fi; sleep 1; done; echo -e "\nError: listener is still configured for subset routing" ; exit 1'
#$(call docker_compose) exec kuma-example-web sh -c 'for i in `seq 1 10`; do echo -n "try #$$i: " ; if [[ $$( $(call envoy_active_routing_clusters_count,kuma-example-backend{version=v2}) ) -eq 0 ]]; then echo "cluster is no longer configured for subset routing "; exit 0; fi; sleep 1; done; echo -e "\nError: cluster is still configured for subset routing" ; exit 1'
sleep 10 # todo(jakubdyszkiewicz) I don't want to build a logic of detecting lb split in cluster since this test will be soon rewritten to E2E Go Framework

#
# Minikube setup
Expand Down Expand Up @@ -451,9 +447,7 @@ wait/traffic-routing/minikube/web-to-backend-route: ## Minikube: Wait until cust
@echo
@echo "Waiting until custom 'web-to-backend' TrafficRoute is applied ..."
@echo
sleep 10
#$(call kubectl_exec,kuma-example,kuma-example-web,kuma-example-web) sh -c 'for i in `seq 1 10`; do echo -n "try #$$i: " ; if [[ $$( $(call envoy_active_routing_listeners_count,outbound,7070,kuma-example-backend.kuma-example.svc:7070{version=v2}) ) -eq 1 ]]; then echo "listener is now configured for subset routing "; exit 0; fi; sleep 1; done; echo -e "\nError: listener has not been configured for subset routing" ; exit 1'
#$(call kubectl_exec,kuma-example,kuma-example-web,kuma-example-web) sh -c 'for i in `seq 1 10`; do echo -n "try #$$i: " ; if [[ $$( $(call envoy_active_routing_clusters_count,kuma-example-backend.kuma-example.svc:7070{version=v2}) ) -eq 1 ]]; then echo "cluster is now configured for subset routing "; exit 0; fi; sleep 1; done; echo -e "\nError: cluster has not been configured for subset routing" ; exit 1'
sleep 10 # todo(jakubdyszkiewicz) I don't want to build a logic of detecting lb split in cluster since this test will be soon rewritten to E2E Go Framework

verify/traffic-routing/minikube/web-to-backend-route: ## Minikube: Make sample requests to example setup for TrafficRoute
@echo
Expand All @@ -472,9 +466,7 @@ wait/traffic-routing/minikube/no-web-to-backend-route: ## Minikube: Wait until c
@echo
@echo "Waiting until custom 'web-to-backend' TrafficRoute is removed ..."
@echo
sleep 10
#$(call kubectl_exec,kuma-example,kuma-example-web,kuma-example-web) sh -c 'for i in `seq 1 10`; do echo -n "try #$$i: " ; if [[ $$( $(call envoy_active_routing_listeners_count,outbound,7070,kuma-example-backend.kuma-example.svc:7070{version=v2}) ) -eq 0 ]]; then echo "listener is no longer configured for subset routing "; exit 0; fi; sleep 1; done; echo -e "\nError: listener is still configured for subset routing" ; exit 1'
#$(call kubectl_exec,kuma-example,kuma-example-web,kuma-example-web) sh -c 'for i in `seq 1 10`; do echo -n "try #$$i: " ; if [[ $$( $(call envoy_active_routing_clusters_count,kuma-example-backend.kuma-example.svc:7070{version=v2}) ) -eq 0 ]]; then echo "cluster is no longer configured for subset routing "; exit 0; fi; sleep 1; done; echo -e "\nError: cluster is still configured for subset routing" ; exit 1'
sleep 10 # todo(jakubdyszkiewicz) I don't want to build a logic of detecting lb split in cluster since this test will be soon rewritten to E2E Go Framework

undeploy/traffic-routing/minikube: ## Minikube: Undeploy example setup for TrafficRoute
@echo
Expand Down
10 changes: 5 additions & 5 deletions pkg/xds/envoy/clusters/lb_subset_configurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ type lbSubsetConfigurer struct {

func (e *lbSubsetConfigurer) Configure(c *envoy_api.Cluster) error {
var selectors []*envoy_api.Cluster_LbSubsetConfig_LbSubsetSelector
subsetUsed := map[string]bool{}
subsets := map[string]bool{} // we only need unique subsets
for _, tags := range e.tags {
keys := tags.WithoutTag(v1alpha1.ServiceTag).Keys()
keys := tags.WithoutTag(v1alpha1.ServiceTag).Keys() // service tag is not included in metadata
if len(keys) == 0 {
continue
}
joinedTags := strings.Join(keys, ",")
if !subsetUsed[joinedTags] {
if !subsets[joinedTags] {
selectors = append(selectors, &envoy_api.Cluster_LbSubsetConfig_LbSubsetSelector{
Keys: keys,
Keys: keys,
// if there is a split by "version", and there is no endpoint with such version we should not fallback to all endpoints of the service
FallbackPolicy: envoy_api.Cluster_LbSubsetConfig_LbSubsetSelector_NO_FALLBACK,
})
subsetUsed[joinedTags] = true
subsets[joinedTags] = true
}
}
if len(selectors) > 0 {
Expand Down
3 changes: 2 additions & 1 deletion pkg/xds/generator/outbound_proxy_generator.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package generator

import (
envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2"

"github.com/Kong/kuma/pkg/core/validators"
envoy_endpoints "github.com/Kong/kuma/pkg/xds/envoy/endpoints"
envoy_names "github.com/Kong/kuma/pkg/xds/envoy/names"
envoy_routes "github.com/Kong/kuma/pkg/xds/envoy/routes"
envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2"

"github.com/pkg/errors"

Expand Down
4 changes: 2 additions & 2 deletions pkg/xds/generator/outbound_proxy_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ var _ = Describe("OutboundProxyGenerator", func() {
Id: model.ProxyId{Name: "side-car", Mesh: "default"},
Dataplane: &mesh_core.DataplaneResource{
Meta: &test_model.ResourceMeta{
Name: "dp-1",
Mesh: given.ctx.Mesh.Resource.Meta.GetName(),
Name: "dp-1",
Mesh: given.ctx.Mesh.Resource.Meta.GetName(),
Version: "1",
},
Spec: dataplane,
Expand Down

0 comments on commit 1d5c921

Please sign in to comment.