Skip to content

Commit

Permalink
Merge pull request #1433 from rochacon/enable-ready-endpoint
Browse files Browse the repository at this point in the history
Use Envoy's /ready endpoint for readiness probes
  • Loading branch information
Nick Young authored Sep 10, 2019
2 parents 870ce5f + bc94632 commit 23ba737
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 55 deletions.
2 changes: 1 addition & 1 deletion examples/contour/03-envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
protocol: TCP
readinessProbe:
httpGet:
path: /healthz
path: /ready
port: 8002
initialDelaySeconds: 3
periodSeconds: 3
Expand Down
2 changes: 1 addition & 1 deletion examples/deployment-grpc-v2/02-contour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ spec:
fieldPath: metadata.name
readinessProbe:
httpGet:
path: /healthz
path: /ready
port: 8002
initialDelaySeconds: 3
periodSeconds: 3
Expand Down
2 changes: 1 addition & 1 deletion examples/ds-grpc-v2/02-contour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ spec:
fieldPath: metadata.name
readinessProbe:
httpGet:
path: /healthz
path: /ready
port: 8002
initialDelaySeconds: 3
periodSeconds: 3
Expand Down
2 changes: 1 addition & 1 deletion examples/ds-hostnet-split-httploadbalancer/03-envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
protocol: TCP
readinessProbe:
httpGet:
path: /healthz
path: /ready
port: 8002
initialDelaySeconds: 3
periodSeconds: 3
Expand Down
2 changes: 1 addition & 1 deletion examples/ds-hostnet-split/03-envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
protocol: TCP
readinessProbe:
httpGet:
path: /healthz
path: /ready
port: 8002
initialDelaySeconds: 3
periodSeconds: 3
Expand Down
2 changes: 1 addition & 1 deletion examples/ds-hostnet/02-contour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ spec:
fieldPath: metadata.name
readinessProbe:
httpGet:
path: /healthz
path: /ready
port: 8002
initialDelaySeconds: 3
periodSeconds: 3
Expand Down
2 changes: 1 addition & 1 deletion examples/render/contour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ spec:
protocol: TCP
readinessProbe:
httpGet:
path: /healthz
path: /ready
port: 8002
initialDelaySeconds: 3
periodSeconds: 3
Expand Down
2 changes: 1 addition & 1 deletion examples/render/daemonset-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ spec:
fieldPath: metadata.name
readinessProbe:
httpGet:
path: /healthz
path: /ready
port: 8002
initialDelaySeconds: 3
periodSeconds: 3
Expand Down
2 changes: 1 addition & 1 deletion examples/render/deployment-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ spec:
fieldPath: metadata.name
readinessProbe:
httpGet:
path: /healthz
path: /ready
port: 8002
initialDelaySeconds: 3
periodSeconds: 3
Expand Down
48 changes: 25 additions & 23 deletions internal/envoy/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -40,37 +39,40 @@ 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",
},
},
},
},
}},
},
}},
},
},
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},
Expand Down
48 changes: 25 additions & 23 deletions internal/envoy/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -49,37 +48,40 @@ 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",
},
},
},
},
}},
},
}},
},
},
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},
Expand Down

0 comments on commit 23ba737

Please sign in to comment.