From ff3abc0b51138d2fb12ae60e8dfe9b9ac5e132da Mon Sep 17 00:00:00 2001 From: Rodrigo Chacon Date: Mon, 29 Jul 2019 03:13:45 -0300 Subject: [PATCH 1/3] internal/envoy: allow access to /ready on admin listener Signed-off-by: Rodrigo Chacon --- internal/envoy/stats.go | 34 +++++++++++++++++++++++++--------- internal/envoy/stats_test.go | 34 +++++++++++++++++++++++++--------- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/internal/envoy/stats.go b/internal/envoy/stats.go index edeb2b9048d..73801863ab8 100644 --- a/internal/envoy/stats.go +++ b/internal/envoy/stats.go @@ -40,20 +40,36 @@ func StatsListener(address string, port int) *v2.Listener { VirtualHosts: []*route.VirtualHost{{ Name: "backend", Domains: []string{"*"}, - Routes: []*route.Route{{ - Match: &route.RouteMatch{ - PathSpecifier: &route.RouteMatch_Prefix{ - Prefix: "/stats", + Routes: []*route.Route{ + { + Match: &route.RouteMatch{ + PathSpecifier: &route.RouteMatch_Prefix{ + Prefix: "/ready", + }, + }, + Action: &route.Route_Route{ + Route: &route.RouteAction{ + ClusterSpecifier: &route.RouteAction_Cluster{ + Cluster: "service-stats", + }, + }, }, }, - Action: &route.Route_Route{ - Route: &route.RouteAction{ - ClusterSpecifier: &route.RouteAction_Cluster{ - Cluster: "service-stats", + { + Match: &route.RouteMatch{ + PathSpecifier: &route.RouteMatch_Prefix{ + Prefix: "/stats", + }, + }, + Action: &route.Route_Route{ + Route: &route.RouteAction{ + ClusterSpecifier: &route.RouteAction_Cluster{ + Cluster: "service-stats", + }, }, }, }, - }}, + }, }}, }, }, diff --git a/internal/envoy/stats_test.go b/internal/envoy/stats_test.go index 68bc416c026..b6ec046c085 100644 --- a/internal/envoy/stats_test.go +++ b/internal/envoy/stats_test.go @@ -49,20 +49,36 @@ func TestStatsListener(t *testing.T) { VirtualHosts: []*route.VirtualHost{{ Name: "backend", Domains: []string{"*"}, - Routes: []*route.Route{{ - Match: &route.RouteMatch{ - PathSpecifier: &route.RouteMatch_Prefix{ - Prefix: "/stats", + Routes: []*route.Route{ + { + Match: &route.RouteMatch{ + PathSpecifier: &route.RouteMatch_Prefix{ + Prefix: "/ready", + }, + }, + Action: &route.Route_Route{ + Route: &route.RouteAction{ + ClusterSpecifier: &route.RouteAction_Cluster{ + Cluster: "service-stats", + }, + }, }, }, - Action: &route.Route_Route{ - Route: &route.RouteAction{ - ClusterSpecifier: &route.RouteAction_Cluster{ - Cluster: "service-stats", + { + Match: &route.RouteMatch{ + PathSpecifier: &route.RouteMatch_Prefix{ + Prefix: "/stats", + }, + }, + Action: &route.Route_Route{ + Route: &route.RouteAction{ + ClusterSpecifier: &route.RouteAction_Cluster{ + Cluster: "service-stats", + }, }, }, }, - }}, + }, }}, }, }, From 43e64228a1187ef690d70bfde4e1ee9fbf7098ac Mon Sep 17 00:00:00 2001 From: Rodrigo Chacon Date: Mon, 2 Sep 2019 10:05:59 -0300 Subject: [PATCH 2/3] examples: use Envoy /ready for readiness probes Signed-off-by: Rodrigo Chacon --- examples/contour/03-envoy.yaml | 2 +- examples/deployment-grpc-v2/02-contour.yaml | 2 +- examples/ds-grpc-v2/02-contour.yaml | 2 +- examples/ds-hostnet-split-httploadbalancer/03-envoy.yaml | 2 +- examples/ds-hostnet-split/03-envoy.yaml | 2 +- examples/ds-hostnet/02-contour.yaml | 2 +- examples/render/contour.yaml | 2 +- examples/render/daemonset-rbac.yaml | 2 +- examples/render/deployment-rbac.yaml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/contour/03-envoy.yaml b/examples/contour/03-envoy.yaml index 3692069651c..ebfef11cc5a 100644 --- a/examples/contour/03-envoy.yaml +++ b/examples/contour/03-envoy.yaml @@ -56,7 +56,7 @@ spec: protocol: TCP readinessProbe: httpGet: - path: /healthz + path: /ready port: 8002 initialDelaySeconds: 3 periodSeconds: 3 diff --git a/examples/deployment-grpc-v2/02-contour.yaml b/examples/deployment-grpc-v2/02-contour.yaml index b4d870a3244..b1e9dc85ef2 100644 --- a/examples/deployment-grpc-v2/02-contour.yaml +++ b/examples/deployment-grpc-v2/02-contour.yaml @@ -69,7 +69,7 @@ spec: fieldPath: metadata.name readinessProbe: httpGet: - path: /healthz + path: /ready port: 8002 initialDelaySeconds: 3 periodSeconds: 3 diff --git a/examples/ds-grpc-v2/02-contour.yaml b/examples/ds-grpc-v2/02-contour.yaml index f210ebb819a..b46731dfb05 100644 --- a/examples/ds-grpc-v2/02-contour.yaml +++ b/examples/ds-grpc-v2/02-contour.yaml @@ -70,7 +70,7 @@ spec: fieldPath: metadata.name readinessProbe: httpGet: - path: /healthz + path: /ready port: 8002 initialDelaySeconds: 3 periodSeconds: 3 diff --git a/examples/ds-hostnet-split-httploadbalancer/03-envoy.yaml b/examples/ds-hostnet-split-httploadbalancer/03-envoy.yaml index a1fed256ad7..7a3cb16cdfe 100644 --- a/examples/ds-hostnet-split-httploadbalancer/03-envoy.yaml +++ b/examples/ds-hostnet-split-httploadbalancer/03-envoy.yaml @@ -56,7 +56,7 @@ spec: protocol: TCP readinessProbe: httpGet: - path: /healthz + path: /ready port: 8002 initialDelaySeconds: 3 periodSeconds: 3 diff --git a/examples/ds-hostnet-split/03-envoy.yaml b/examples/ds-hostnet-split/03-envoy.yaml index a1fed256ad7..7a3cb16cdfe 100644 --- a/examples/ds-hostnet-split/03-envoy.yaml +++ b/examples/ds-hostnet-split/03-envoy.yaml @@ -56,7 +56,7 @@ spec: protocol: TCP readinessProbe: httpGet: - path: /healthz + path: /ready port: 8002 initialDelaySeconds: 3 periodSeconds: 3 diff --git a/examples/ds-hostnet/02-contour.yaml b/examples/ds-hostnet/02-contour.yaml index b67c1ac21b7..54033e4835f 100644 --- a/examples/ds-hostnet/02-contour.yaml +++ b/examples/ds-hostnet/02-contour.yaml @@ -74,7 +74,7 @@ spec: fieldPath: metadata.name readinessProbe: httpGet: - path: /healthz + path: /ready port: 8002 initialDelaySeconds: 3 periodSeconds: 3 diff --git a/examples/render/contour.yaml b/examples/render/contour.yaml index f083464e40f..57ba64a0791 100644 --- a/examples/render/contour.yaml +++ b/examples/render/contour.yaml @@ -715,7 +715,7 @@ spec: protocol: TCP readinessProbe: httpGet: - path: /healthz + path: /ready port: 8002 initialDelaySeconds: 3 periodSeconds: 3 diff --git a/examples/render/daemonset-rbac.yaml b/examples/render/daemonset-rbac.yaml index 0fa2b2f87e8..775edaecdf1 100644 --- a/examples/render/daemonset-rbac.yaml +++ b/examples/render/daemonset-rbac.yaml @@ -419,7 +419,7 @@ spec: fieldPath: metadata.name readinessProbe: httpGet: - path: /healthz + path: /ready port: 8002 initialDelaySeconds: 3 periodSeconds: 3 diff --git a/examples/render/deployment-rbac.yaml b/examples/render/deployment-rbac.yaml index 7ac093e6ea7..7e364438cad 100644 --- a/examples/render/deployment-rbac.yaml +++ b/examples/render/deployment-rbac.yaml @@ -418,7 +418,7 @@ spec: fieldPath: metadata.name readinessProbe: httpGet: - path: /healthz + path: /ready port: 8002 initialDelaySeconds: 3 periodSeconds: 3 From 23e8d265b76bd34876ec6f975d32c54ccde928e9 Mon Sep 17 00:00:00 2001 From: Rodrigo Chacon Date: Fri, 6 Sep 2019 04:18:32 -0300 Subject: [PATCH 3/3] internal/envoy: remove health check filter from stats listener Signed-off-by: Rodrigo Chacon --- internal/envoy/stats.go | 14 -------------- internal/envoy/stats_test.go | 14 -------------- 2 files changed, 28 deletions(-) diff --git a/internal/envoy/stats.go b/internal/envoy/stats.go index 73801863ab8..af54c815b8e 100644 --- a/internal/envoy/stats.go +++ b/internal/envoy/stats.go @@ -17,7 +17,6 @@ import ( v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" "github.com/envoyproxy/go-control-plane/envoy/api/v2/listener" "github.com/envoyproxy/go-control-plane/envoy/api/v2/route" - health_check "github.com/envoyproxy/go-control-plane/envoy/config/filter/http/health_check/v2" http "github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2" "github.com/envoyproxy/go-control-plane/pkg/util" "github.com/gogo/protobuf/types" @@ -74,19 +73,6 @@ func StatsListener(address string, port int) *v2.Listener { }, }, HttpFilters: []*http.HttpFilter{{ - Name: util.HealthCheck, - ConfigType: &http.HttpFilter_TypedConfig{ - TypedConfig: any(&health_check.HealthCheck{ - PassThroughMode: &types.BoolValue{Value: false}, - Headers: []*route.HeaderMatcher{{ - Name: ":path", - HeaderMatchSpecifier: &route.HeaderMatcher_ExactMatch{ - ExactMatch: "/healthz", - }, - }}, - }), - }, - }, { Name: util.Router, }}, NormalizePath: &types.BoolValue{Value: true}, diff --git a/internal/envoy/stats_test.go b/internal/envoy/stats_test.go index b6ec046c085..6019246c5ec 100644 --- a/internal/envoy/stats_test.go +++ b/internal/envoy/stats_test.go @@ -19,7 +19,6 @@ import ( v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" "github.com/envoyproxy/go-control-plane/envoy/api/v2/listener" "github.com/envoyproxy/go-control-plane/envoy/api/v2/route" - health_check "github.com/envoyproxy/go-control-plane/envoy/config/filter/http/health_check/v2" http "github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2" "github.com/envoyproxy/go-control-plane/pkg/util" "github.com/gogo/protobuf/types" @@ -83,19 +82,6 @@ func TestStatsListener(t *testing.T) { }, }, HttpFilters: []*http.HttpFilter{{ - Name: util.HealthCheck, - ConfigType: &http.HttpFilter_TypedConfig{ - TypedConfig: any(&health_check.HealthCheck{ - PassThroughMode: &types.BoolValue{Value: false}, - Headers: []*route.HeaderMatcher{{ - Name: ":path", - HeaderMatchSpecifier: &route.HeaderMatcher_ExactMatch{ - ExactMatch: "/healthz", - }, - }}, - }), - }, - }, { Name: util.Router, }}, NormalizePath: &types.BoolValue{Value: true},