Skip to content

Commit

Permalink
Merge branch 'main' into grafana-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
zirain authored Aug 25, 2024
2 parents cbfc382 + ada279e commit efa81ab
Show file tree
Hide file tree
Showing 37 changed files with 498 additions and 234 deletions.
13 changes: 0 additions & 13 deletions api/v1alpha1/backendtrafficpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package v1alpha1

import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
gwapiv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
)
Expand Down Expand Up @@ -86,18 +85,6 @@ type BackendTrafficPolicyList struct {
Items []BackendTrafficPolicy `json:"items"`
}

// BackendTrafficPolicyConnection allows users to configure connection-level settings of backend
type BackendTrafficPolicyConnection struct {
// BufferLimit Soft limit on size of the cluster’s connections read and write buffers.
// If unspecified, an implementation defined default is applied (32768 bytes).
// For example, 20Mi, 1Gi, 256Ki etc.
// Note: that when the suffix is not provided, the value is interpreted as bytes.
//
// +kubebuilder:validation:XValidation:rule="type(self) == string ? self.matches(r\"^[1-9]+[0-9]*([EPTGMK]i|[EPTGMk])?$\") : type(self) == int",message="BufferLimit must be of the format \"^[1-9]+[0-9]*([EPTGMK]i|[EPTGMk])?$\""
// +optional
BufferLimit *resource.Quantity `json:"bufferLimit,omitempty"`
}

// ClusterSettings provides the various knobs that can be set to control how traffic to a given
// backend will be configured.
type ClusterSettings struct {
Expand Down
20 changes: 0 additions & 20 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/docker/cli v27.1.1+incompatible
github.com/docker/cli v27.1.2+incompatible
github.com/dominikbraun/graph v0.23.0
github.com/envoyproxy/go-control-plane v0.12.1-0.20240612043845-c54ec4ce422d
github.com/envoyproxy/ratelimit v1.4.1-0.20230427142404-e2a87f41d3a7
Expand All @@ -27,7 +27,7 @@ require (
github.com/grafana/tempo v1.5.0
github.com/hashicorp/go-multierror v1.1.1
github.com/miekg/dns v1.1.61
github.com/ohler55/ojg v1.22.1
github.com/ohler55/ojg v1.24.0
github.com/prometheus/client_golang v1.20.0
github.com/prometheus/common v0.55.0
github.com/spf13/cobra v1.8.1
Expand Down Expand Up @@ -64,7 +64,7 @@ require (
)

require (
github.com/docker/docker v27.1.1+incompatible
github.com/docker/docker v27.1.2+incompatible
github.com/replicatedhq/troubleshoot v0.99.0
)

Expand Down Expand Up @@ -169,6 +169,7 @@ require (
github.com/moby/sys/mountinfo v0.7.2 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/user v0.2.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runtime-spec v1.2.0 // indirect
Expand Down
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,13 @@ github.com/distribution/distribution/v3 v3.0.0-beta.1 h1:X+ELTxPuZ1Xe5MsD3kp2wfG
github.com/distribution/distribution/v3 v3.0.0-beta.1/go.mod h1:O9O8uamhHzWWQVTjuQpyYUVm/ShPHPUDgvQMpHGVBDs=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/cli v27.1.1+incompatible h1:goaZxOqs4QKxznZjjBWKONQci/MywhtRv2oNn0GkeZE=
github.com/docker/cli v27.1.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/cli v27.1.2+incompatible h1:nYviRv5Y+YAKx3dFrTvS1ErkyVVunKOhoweCTE1BsnI=
github.com/docker/cli v27.1.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v27.1.1+incompatible h1:hO/M4MtV36kzKldqnA37IWhebRA+LnqqcqDja6kVaKY=
github.com/docker/docker v27.1.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v27.1.2+incompatible h1:AhGzR1xaQIy53qCkxARaFluI00WPGtXn0AJuoQsVYTY=
github.com/docker/docker v27.1.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo=
github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M=
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
Expand Down Expand Up @@ -887,6 +887,8 @@ github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5
github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo=
github.com/moby/sys/user v0.2.0 h1:OnpapJsRp25vkhw8TFG6OLJODNh/3rEwRWtJ3kakwRM=
github.com/moby/sys/user v0.2.0/go.mod h1:RYstrcWOJpVh+6qzUqp2bU3eaRpdiQeKGlKitaH0PM8=
github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g=
github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28=
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand All @@ -911,8 +913,8 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/ohler55/ojg v1.22.1 h1:MvUieaWTwksoYk47GYyP9kzXIAkxHYX6rxeLjUEeq/8=
github.com/ohler55/ojg v1.22.1/go.mod h1:gQhDVpQLqrmnd2eqGAvJtn+NfKoYJbe/A4Sj3/Vro4o=
github.com/ohler55/ojg v1.24.0 h1:y2AVez6fPTszK/jPhaAYMCAzAoSleConMqSDD5wJKJg=
github.com/ohler55/ojg v1.24.0/go.mod h1:gQhDVpQLqrmnd2eqGAvJtn+NfKoYJbe/A4Sj3/Vro4o=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down
3 changes: 0 additions & 3 deletions internal/gatewayapi/backendtrafficpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,6 @@ func (t *Translator) translateBackendTrafficPolicyForRoute(policy *egv1a1.Backen

if strings.HasPrefix(r.Destination.Name, prefix) {
r.LoadBalancer = lb
r.Timeout = to
r.BackendConnection = bc
r.DNS = ds
}
}
Expand Down Expand Up @@ -518,7 +516,6 @@ func (t *Translator) translateBackendTrafficPolicyForGateway(policy *egv1a1.Back
// only set attributes which weren't already set by a more
// specific policy
setIfNil(&route.LoadBalancer, lb)
setIfNil(&route.Timeout, ct)
setIfNil(&route.DNS, ds)
}

Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,3 @@ xdsIR:
consistentHash:
sourceIP: true
name: udproute/default/udp-app-1
timeout:
http:
connectionIdleTimeout: 16s
maxConnectionDuration: 17s
tcp:
connectTimeout: 15s
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,3 @@ xdsIR:
consistentHash:
sourceIP: true
name: udproute/default/udp-app-1
timeout:
http:
connectionIdleTimeout: 16s
maxConnectionDuration: 17s
tcp:
connectTimeout: 15s
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ httpRoutes:
sectionName: empty-hostname
hostnames:
- "bar.com"
- "*.example.com" # request matching is prevented by the isolation wildcard-example-com listener
- "*.example.com" # request matching is prevented by the isolation wildcard-example-com listener
rules:
- matches:
- path:
Expand All @@ -53,7 +53,7 @@ httpRoutes:
namespace: envoy-gateway
sectionName: wildcard-example-com
hostnames:
- "bar.com" # doesn't match wildcard-example-com listener
- "bar.com" # doesn't match wildcard-example-com listener
- "*.example.com"
rules:
- matches:
Expand Down
Loading

0 comments on commit efa81ab

Please sign in to comment.