From 1fbb912d2dedc07f89b0902882c6c8e3d346143c Mon Sep 17 00:00:00 2001 From: lemonlinger Date: Mon, 27 Nov 2023 15:54:26 +0800 Subject: [PATCH] fix missing required changes Signed-off-by: lemonlinger --- ...endtrafficpolicy-with-healthcheck.out.yaml | 130 ++++++++--------- site/content/en/latest/api/extension_types.md | 138 ++++++++++++++++++ 2 files changed, 203 insertions(+), 65 deletions(-) diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-healthcheck.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-healthcheck.out.yaml index 91b58d16ec85..96b8630c316c 100755 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-healthcheck.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-healthcheck.out.yaml @@ -7,17 +7,17 @@ backendTrafficPolicies: namespace: default spec: healthCheck: - timeout: "1s" - interval: "5s" - unhealthyThreshold: 3 - healthyThreshold: 3 healthChecker: - type: GRPC grpc: - serviceName: "service" - Authority: "foo" + authority: foo metadata: - x-source: "gateway" + x-source: gateway + serviceName: service + type: GRPC + healthyThreshold: 3 + interval: 5s + timeout: 1s + unhealthyThreshold: 3 targetRef: group: gateway.networking.k8s.io kind: HTTPRoute @@ -38,19 +38,19 @@ backendTrafficPolicies: namespace: default spec: healthCheck: - timeout: "1s" - interval: "5s" - unhealthyThreshold: 3 - healthyThreshold: 3 healthChecker: - type: TCP tcp: + receive: + - text: pong + type: Text send: + text: ping type: Text - text: "ping" - receive: - - type: Text - text: "pong" + type: TCP + healthyThreshold: 3 + interval: 5s + timeout: 1s + unhealthyThreshold: 3 targetRef: group: gateway.networking.k8s.io kind: HTTPRoute @@ -71,22 +71,22 @@ backendTrafficPolicies: namespace: envoy-gateway spec: healthCheck: - timeout: "500ms" - interval: "3s" - unhealthyThreshold: 3 - healthyThreshold: 1 healthChecker: - type: HTTP http: - path: "/healthz" - expectedStatuses: - - start: 200 - end: 300 - - start: 300 - end: 400 expectedResponses: - - type: Text - text: "ok" + - text: ok + type: Text + expectedStatuses: + - end: 300 + start: 200 + - end: 400 + start: 300 + path: /healthz + type: HTTP + healthyThreshold: 1 + interval: 3s + timeout: 500ms + unhealthyThreshold: 3 targetRef: group: gateway.networking.k8s.io kind: Gateway @@ -344,21 +344,21 @@ xdsIR: port: 8080 protocol: GRPC weight: 1 - hostname: '*' healthCheck: - timeout: "500ms" - interval: "3s" - unhealthyThreshold: 3 healthyThreshold: 1 http: - path: "/healthz" - expectedStatuses: - - start: 200 - end: 300 - - start: 300 - end: 400 expectedResponses: - - text: "ok" + - text: ok + expectedStatuses: + - end: 300 + start: 200 + - end: 400 + start: 300 + path: /healthz + interval: 3s + timeout: 500ms + unhealthyThreshold: 3 + hostname: '*' name: grpcroute/default/grpcroute-1/rule/0/match/-1/* envoy-gateway/gateway-2: accessLog: @@ -376,53 +376,53 @@ xdsIR: invalid: 0 valid: 0 destination: - name: httproute/default/httproute-1/rule/0 + name: httproute/default/httproute-2/rule/0 settings: - endpoints: - host: 7.7.7.7 port: 8080 protocol: HTTP weight: 1 - hostname: gateway.envoyproxy.io healthCheck: - timeout: "1s" - interval: "5s" - unhealthyThreshold: 3 healthyThreshold: 3 - grpc: - serviceName: "service" - Authority: "foo" - metadata: - x-source: "gateway" - name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io + interval: 5s + tcp: + receive: + - text: pong + send: + text: ping + timeout: 1s + unhealthyThreshold: 3 + hostname: gateway.envoyproxy.io + name: httproute/default/httproute-2/rule/0/match/0/gateway_envoyproxy_io pathMatch: distinct: false name: "" - prefix: / + prefix: /v2 - backendWeights: invalid: 0 valid: 0 destination: - name: httproute/default/httproute-2/rule/0 + name: httproute/default/httproute-1/rule/0 settings: - endpoints: - host: 7.7.7.7 port: 8080 protocol: HTTP weight: 1 - hostname: gateway.envoyproxy.io healthCheck: - timeout: "1s" - interval: "5s" - unhealthyThreshold: 3 + grpc: + authority: foo + metadata: + x-source: gateway + serviceName: service healthyThreshold: 3 - tcp: - send: - text: "ping" - receive: - - text: "pong" - name: httproute/default/httproute-2/rule/0/match/0/gateway_envoyproxy_io + interval: 5s + timeout: 1s + unhealthyThreshold: 3 + hostname: gateway.envoyproxy.io + name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io pathMatch: distinct: false name: "" - prefix: /v2 + prefix: / diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index 7379bf3cef7d..42bf3cf6a351 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -76,6 +76,7 @@ _Appears in:_ | `loadBalancer` _[LoadBalancer](#loadbalancer)_ | LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints | | `proxyProtocol` _[ProxyProtocol](#proxyprotocol)_ | ProxyProtocol enables the Proxy Protocol when communicating with the backend. | | `tcpKeepalive` _[TCPKeepalive](#tcpkeepalive)_ | TcpKeepalive settings associated with the upstream client connection. Disabled by default. | +| `healthCheck` _[HealthCheck](#healthcheck)_ | HealthCheck allows gateway to perform active health checking on backends. | @@ -787,6 +788,22 @@ _Appears in:_ | `path` _string_ | Path defines the file path used to expose envoy access log(e.g. /dev/stdout). | +#### GRPCHealthChecker + + + +GRPCHealthChecker defines the settings of grpc health check. + +_Appears in:_ +- [HealthChecker](#healthchecker) + +| Field | Description | +| --- | --- | +| `serviceName` _string_ | ServiceName defines the value of parameter service in the gRPC health check request. | +| `authority` _string_ | Authority defines the value of :authority header in the gRPC health check request. | +| `metadata` _object (keys:string, values:string)_ | Refer to Kubernetes API documentation for fields of `metadata`. | + + #### Gateway @@ -832,6 +849,23 @@ _Appears in:_ | `kind` _string_ | | +#### HTTPHealthChecker + + + +HTTPHealthChecker defines the settings of http health check. + +_Appears in:_ +- [HealthChecker](#healthchecker) + +| Field | Description | +| --- | --- | +| `path` _string_ | Path defines the HTTP path that will be requested during health checking. | +| `method` _string_ | Method defines the HTTP method used for health checking. | +| `expectedStatuses` _[Int64Range](#int64range) array_ | ExpectedStatuses defines a list of HTTP response statuses considered healthy. | +| `expectedResponses` _[HealthCheckPayload](#healthcheckpayload) array_ | ExpectedResponses defines a list of HTTP expected responses to match. | + + #### HeaderMatch @@ -843,6 +877,80 @@ _Appears in:_ +#### HealthCheck + + + +HealthCheck defines the health check configuration. + +_Appears in:_ +- [BackendTrafficPolicySpec](#backendtrafficpolicyspec) + +| Field | Description | +| --- | --- | +| `timeout` _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#duration-v1-meta)_ | Timeout defines the time to wait for a health check response. | +| `interval` _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#duration-v1-meta)_ | Interval defines the time between health checks. | +| `unhealthyThreshold` _integer_ | UnhealthyThreshold defines the number of unhealthy health checks required before a backend host is marked unhealthy. | +| `healthyThreshold` _integer_ | HealthyThreshold defines the number of healthy health checks required before a backend host is marked healthy. | +| `healthChecker` _[HealthChecker](#healthchecker)_ | HealthChecker defines the concrete health checker to do health checking. | + + +#### HealthCheckPayload + + + +HealthCheckPayload defines the encoding of the payload bytes in the payload. + +_Appears in:_ +- [HTTPHealthChecker](#httphealthchecker) +- [TCPHealthChecker](#tcphealthchecker) + +| Field | Description | +| --- | --- | +| `type` _[HealthCheckPayloadType](#healthcheckpayloadtype)_ | Type defines the type of the payload. | +| `text` _string_ | Text payload | +| `binary` _integer array_ | Binary payload | + + +#### HealthCheckPayloadType + +_Underlying type:_ `string` + +HealthCheckPayloadType is the type of the payload. + +_Appears in:_ +- [HealthCheckPayload](#healthcheckpayload) + + + +#### HealthChecker + + + +HealthChecker defines the configuration of concrete health checker. EG supports various types of health checking including HTTP, GRPC, TCP. + +_Appears in:_ +- [HealthCheck](#healthcheck) + +| Field | Description | +| --- | --- | +| `type` _[HealthCheckerType](#healthcheckertype)_ | Type defines the type of health checker. | +| `http` _[HTTPHealthChecker](#httphealthchecker)_ | HTTP defines the configuration of http health checker. It's required while the health checker type is HTTP. | +| `grpc` _[GRPCHealthChecker](#grpchealthchecker)_ | GRPC defines the configuration of grpc health checker. It's required while the health checker type is GRPC. | +| `tcp` _[TCPHealthChecker](#tcphealthchecker)_ | TCP defines the configuration of tcp health checker. It's required while the health checker type is TCP. | + + +#### HealthCheckerType + +_Underlying type:_ `string` + +HealthCheckerType is the type of health checker. + +_Appears in:_ +- [HealthChecker](#healthchecker) + + + #### InfrastructureProviderType _Underlying type:_ `string` @@ -854,6 +962,21 @@ _Appears in:_ +#### Int64Range + + + +Int64Range defines the int64 start and end of the range using half-open interval semantics [start, end). + +_Appears in:_ +- [HTTPHealthChecker](#httphealthchecker) + +| Field | Description | +| --- | --- | +| `start` _integer_ | Start defines start of the range (inclusive) | +| `end` _integer_ | End defines end of the range (exclusive) | + + #### JSONPatchOperation @@ -1723,6 +1846,21 @@ _Appears in:_ +#### TCPHealthChecker + + + +TCPHealthChecker defines the settings of tcp health check. + +_Appears in:_ +- [HealthChecker](#healthchecker) + +| Field | Description | +| --- | --- | +| `send` _[HealthCheckPayload](#healthcheckpayload)_ | Send defines the request payload. | +| `receive` _[HealthCheckPayload](#healthcheckpayload) array_ | Receive defines the expected response payloads. | + + #### TCPKeepalive