Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: active http healthcheck documents a default for expected status, but doesn't use it #4090

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions internal/gatewayapi/clustersettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"math"
"math/big"
"net/http"
"strings"
"time"

Expand Down Expand Up @@ -453,6 +454,10 @@ func buildHTTPActiveHealthChecker(h *egv1a1.HTTPActiveHealthChecker) *ir.HTTPHea
for _, r := range h.ExpectedStatuses {
statusSet.Insert(int(r))
}
// If no ExpectedStatus was set, use the default value (200)
if statusSet.Len() == 0 {
statusSet.Insert(http.StatusOK)
}
irStatuses := make([]ir.HTTPStatus, 0, statusSet.Len())

for _, r := range statusSet.List() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,25 @@ httpRoutes:
backendRefs:
- name: service-3
port: 8080
- apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
namespace: default
name: httproute-4
spec:
hostnames:
- gateway.envoyproxy.io
parentRefs:
- namespace: envoy-gateway
name: gateway-2
sectionName: http
rules:
- matches:
- path:
value: "/v2"
backendRefs:
- name: service-2
port: 8080
backendTrafficPolicies:
- apiVersion: gateway.envoyproxy.io/v1alpha1
kind: BackendTrafficPolicy
Expand Down Expand Up @@ -197,6 +216,29 @@ backendTrafficPolicies:
consecutiveGatewayErrors: 0
consecutiveLocalOriginFailures: 5
splitExternalLocalOriginErrors: false
- apiVersion: gateway.envoyproxy.io/v1alpha1
kind: BackendTrafficPolicy
metadata:
namespace: default
name: policy-for-route-4
spec:
targetRef:
group: gateway.networking.k8s.io
kind: HTTPRoute
name: httproute-4
healthCheck:
active:
timeout: "1s"
interval: "5s"
unhealthyThreshold: 3
healthyThreshold: 3
type: HTTP
http:
path: "/healthz"
method: "GET"
expectedResponse:
type: Text
text: pong
- apiVersion: gateway.envoyproxy.io/v1alpha1
kind: BackendTrafficPolicy
metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,45 @@ backendTrafficPolicies:
status: "True"
type: Accepted
controllerName: gateway.envoyproxy.io/gatewayclass-controller
- apiVersion: gateway.envoyproxy.io/v1alpha1
kind: BackendTrafficPolicy
metadata:
creationTimestamp: null
name: policy-for-route-4
namespace: default
spec:
healthCheck:
active:
healthyThreshold: 3
http:
expectedResponse:
text: pong
type: Text
method: GET
path: /healthz
interval: 5s
timeout: 1s
type: HTTP
unhealthyThreshold: 3
targetRef:
group: gateway.networking.k8s.io
kind: HTTPRoute
name: httproute-4
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: gateway-2
namespace: envoy-gateway
sectionName: http
conditions:
- lastTransitionTime: null
message: Policy has been accepted.
reason: Accepted
status: "True"
type: Accepted
controllerName: gateway.envoyproxy.io/gatewayclass-controller
- apiVersion: gateway.envoyproxy.io/v1alpha1
kind: BackendTrafficPolicy
metadata:
Expand Down Expand Up @@ -326,7 +365,7 @@ gateways:
protocol: HTTP
status:
listeners:
- attachedRoutes: 3
- attachedRoutes: 4
conditions:
- lastTransitionTime: null
message: Sending translated listener configuration to the data plane
Expand Down Expand Up @@ -564,6 +603,44 @@ httpRoutes:
name: gateway-2
namespace: envoy-gateway
sectionName: http
- apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
creationTimestamp: null
name: httproute-4
namespace: default
spec:
hostnames:
- gateway.envoyproxy.io
parentRefs:
- name: gateway-2
namespace: envoy-gateway
sectionName: http
rules:
- backendRefs:
- name: service-2
port: 8080
matches:
- path:
value: /v2
status:
parents:
- conditions:
- lastTransitionTime: null
message: Route is accepted
reason: Accepted
status: "True"
type: Accepted
- lastTransitionTime: null
message: Resolved all the Object references for the Route
reason: ResolvedRefs
status: "True"
type: ResolvedRefs
controllerName: gateway.envoyproxy.io/gatewayclass-controller
parentRef:
name: gateway-2
namespace: envoy-gateway
sectionName: http
infraIR:
envoy-gateway/gateway-1:
proxy:
Expand Down Expand Up @@ -805,6 +882,41 @@ xdsIR:
interval: 8ms
maxEjectionPercent: 11
splitExternalLocalOriginErrors: false
- destination:
name: httproute/default/httproute-4/rule/0
settings:
- addressType: IP
endpoints:
- host: 7.7.7.7
port: 8080
protocol: HTTP
weight: 1
hostname: gateway.envoyproxy.io
isHTTP2: false
metadata:
kind: HTTPRoute
name: httproute-4
namespace: default
name: httproute/default/httproute-4/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
name: ""
prefix: /v2
traffic:
healthCheck:
active:
healthyThreshold: 3
http:
expectedResponse:
text: pong
expectedStatuses:
- 200
host: gateway.envoyproxy.io
method: GET
path: /healthz
interval: 5s
timeout: 1s
unhealthyThreshold: 3
- destination:
name: httproute/default/httproute-1/rule/0
settings:
Expand Down