Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/github.com/prometheus/…
Browse files Browse the repository at this point in the history
…common-0.61.0
  • Loading branch information
zirain authored Dec 11, 2024
2 parents a3be343 + 2385672 commit 587588d
Show file tree
Hide file tree
Showing 176 changed files with 450 additions and 467 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ jobs:
- uses: ./tools/github-actions/setup-deps

- name: Initialize CodeQL
uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
uses: github/codeql-action/init@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
uses: github/codeql-action/autobuild@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
uses: github/codeql-action/analyze@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ jobs:
retention-days: 5

- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion examples/extension-server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/envoyproxy/gateway v1.0.2
github.com/envoyproxy/go-control-plane v0.13.1
github.com/urfave/cli/v2 v2.27.5
google.golang.org/grpc v1.68.0
google.golang.org/grpc v1.68.1
google.golang.org/protobuf v1.35.2
k8s.io/apimachinery v0.31.3
sigs.k8s.io/controller-runtime v0.19.2
Expand Down
4 changes: 2 additions & 2 deletions examples/extension-server/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0=
google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA=
google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0=
google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ require (
github.com/docker/docker v27.3.1+incompatible
github.com/replicatedhq/troubleshoot v0.107.5
github.com/tetratelabs/func-e v1.1.5-0.20240822223546-c85a098d5bf0
google.golang.org/grpc v1.68.0
google.golang.org/grpc v1.68.1
sigs.k8s.io/kubectl-validate v0.0.5-0.20240827210056-ce13d95db263
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1101,8 +1101,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0=
google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA=
google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0=
google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: httproute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- cluster:
Expand All @@ -801,7 +800,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: grpcroute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
typedExtensionProtocolOptions:
Expand All @@ -828,7 +826,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: tcproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- cluster:
Expand All @@ -848,7 +845,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: tlsroute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- cluster:
Expand All @@ -868,7 +864,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: udproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- '@type': type.googleapis.com/envoy.admin.v3.ListenersConfigDump
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,5 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: httproute/envoy-gateway-system/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@
"ignoreHealthOnHostRemoval": true,
"lbPolicy": "LEAST_REQUEST",
"name": "httproute/default/backend/rule/0",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
"type": "EDS"
}
Expand Down Expand Up @@ -499,7 +498,6 @@
"ignoreHealthOnHostRemoval": true,
"lbPolicy": "LEAST_REQUEST",
"name": "grpcroute/default/backend/rule/0",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
"type": "EDS",
"typedExtensionProtocolOptions": {
Expand Down Expand Up @@ -540,7 +538,6 @@
"ignoreHealthOnHostRemoval": true,
"lbPolicy": "LEAST_REQUEST",
"name": "tcproute/default/backend/rule/-1",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
"type": "EDS"
}
Expand Down Expand Up @@ -570,7 +567,6 @@
"ignoreHealthOnHostRemoval": true,
"lbPolicy": "LEAST_REQUEST",
"name": "tlsroute/default/backend/rule/-1",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
"type": "EDS"
}
Expand Down Expand Up @@ -600,7 +596,6 @@
"ignoreHealthOnHostRemoval": true,
"lbPolicy": "LEAST_REQUEST",
"name": "udproute/default/backend/rule/-1",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
"type": "EDS"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: httproute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- cluster:
Expand All @@ -280,7 +279,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: grpcroute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
typedExtensionProtocolOptions:
Expand All @@ -307,7 +305,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: tcproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- cluster:
Expand All @@ -327,7 +324,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: tlsroute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- cluster:
Expand All @@ -347,7 +343,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: udproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- '@type': type.googleapis.com/envoy.admin.v3.ListenersConfigDump
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: httproute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- cluster:
Expand All @@ -39,7 +38,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: grpcroute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
typedExtensionProtocolOptions:
Expand All @@ -66,7 +64,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: tcproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- cluster:
Expand All @@ -86,7 +83,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: tlsroute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- cluster:
Expand All @@ -106,6 +102,5 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: udproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@
"ignoreHealthOnHostRemoval": true,
"lbPolicy": "LEAST_REQUEST",
"name": "httproute/envoy-gateway-system/backend/rule/0",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
"type": "EDS"
}
Expand Down Expand Up @@ -408,7 +407,6 @@
]
},
"name": "raw_githubusercontent_com_443",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
"respectDnsTtl": true,
"transportSocket": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: httproute/envoy-gateway-system/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- cluster:
Expand Down Expand Up @@ -232,7 +231,6 @@ xds:
locality:
region: raw_githubusercontent_com_443/backend/0
name: raw_githubusercontent_com_443
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
respectDnsTtl: true
transportSocket:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: httproute/envoy-gateway-system/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- cluster:
Expand Down Expand Up @@ -47,7 +46,6 @@ xds:
locality:
region: raw_githubusercontent_com_443/backend/0
name: raw_githubusercontent_com_443
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
respectDnsTtl: true
transportSocket:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ xds:
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: httproute/envoy-gateway-system/routes/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- '@type': type.googleapis.com/envoy.admin.v3.ListenersConfigDump
Expand Down
9 changes: 4 additions & 5 deletions internal/gatewayapi/backendtrafficpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func (t *Translator) translateBackendTrafficPolicyForRoute(
if policy.Spec.Retry != nil {
rt = buildRetry(policy.Spec.Retry)
}
if to, err = buildClusterSettingsTimeout(policy.Spec.ClusterSettings, nil); err != nil {
if to, err = buildClusterSettingsTimeout(policy.Spec.ClusterSettings); err != nil {
err = perr.WithMessage(err, "Timeout")
errs = errors.Join(errs, err)
}
Expand Down Expand Up @@ -399,8 +399,7 @@ func (t *Translator) translateBackendTrafficPolicyForRoute(
continue
}

// Some timeout setting originate from the route.
if localTo, err := buildClusterSettingsTimeout(policy.Spec.ClusterSettings, r.Traffic); err == nil {
if localTo, err := buildClusterSettingsTimeout(policy.Spec.ClusterSettings); err == nil {
to = localTo
}

Expand Down Expand Up @@ -484,7 +483,7 @@ func (t *Translator) translateBackendTrafficPolicyForGateway(
if policy.Spec.Retry != nil {
rt = buildRetry(policy.Spec.Retry)
}
if ct, err = buildClusterSettingsTimeout(policy.Spec.ClusterSettings, nil); err != nil {
if ct, err = buildClusterSettingsTimeout(policy.Spec.ClusterSettings); err != nil {
err = perr.WithMessage(err, "Timeout")
errs = errors.Join(errs, err)
}
Expand Down Expand Up @@ -585,7 +584,7 @@ func (t *Translator) translateBackendTrafficPolicyForGateway(
// Update the Host field in HealthCheck, now that we have access to the Route Hostname.
r.Traffic.HealthCheck.SetHTTPHostIfAbsent(r.Hostname)

if ct, err = buildClusterSettingsTimeout(policy.Spec.ClusterSettings, r.Traffic); err == nil {
if ct, err = buildClusterSettingsTimeout(policy.Spec.ClusterSettings); err == nil {
r.Traffic.Timeout = ct
}

Expand Down
40 changes: 3 additions & 37 deletions internal/gatewayapi/clustersettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func translateTrafficFeatures(policy *egv1a1.ClusterSettings) (*ir.TrafficFeatur
}
ret := &ir.TrafficFeatures{}

if timeout, err := buildClusterSettingsTimeout(*policy, nil); err != nil {
if timeout, err := buildClusterSettingsTimeout(*policy); err != nil {
return nil, err
} else {
ret.Timeout = timeout
Expand Down Expand Up @@ -83,14 +83,11 @@ func translateTrafficFeatures(policy *egv1a1.ClusterSettings) (*ir.TrafficFeatur
return ret, nil
}

func buildClusterSettingsTimeout(policy egv1a1.ClusterSettings, routeTrafficFeatures *ir.TrafficFeatures) (*ir.Timeout, error) {
func buildClusterSettingsTimeout(policy egv1a1.ClusterSettings) (*ir.Timeout, error) {
if policy.Timeout == nil {
if routeTrafficFeatures != nil {
// Don't lose any existing timeout definitions.
return mergeTimeoutSettings(nil, routeTrafficFeatures.Timeout), nil
}
return nil, nil
}

var (
errs error
to = &ir.Timeout{}
Expand Down Expand Up @@ -146,40 +143,9 @@ func buildClusterSettingsTimeout(policy egv1a1.ClusterSettings, routeTrafficFeat
RequestTimeout: rt,
}
}

// The timeout from route's TrafficFeatures takes precedence over the timeout in BTP
if routeTrafficFeatures != nil {
to = mergeTimeoutSettings(routeTrafficFeatures.Timeout, to)
}

return to, errs
}

// merge secondary into main if both are not nil, otherwise return the
// one that is not nil. If both are nil, returns nil
func mergeTimeoutSettings(main, secondary *ir.Timeout) *ir.Timeout {
switch {
case main == nil && secondary == nil:
return nil
case main == nil:
return secondary.DeepCopy()
case secondary == nil:
return main
default: // Neither main nor secondary are nil here
if secondary.HTTP != nil {
setIfNil(&main.HTTP, &ir.HTTPTimeout{})
setIfNil(&main.HTTP.RequestTimeout, secondary.HTTP.RequestTimeout)
setIfNil(&main.HTTP.ConnectionIdleTimeout, secondary.HTTP.ConnectionIdleTimeout)
setIfNil(&main.HTTP.MaxConnectionDuration, secondary.HTTP.MaxConnectionDuration)
}
if secondary.TCP != nil {
setIfNil(&main.TCP, &ir.TCPTimeout{})
setIfNil(&main.TCP.ConnectTimeout, secondary.TCP.ConnectTimeout)
}
return main
}
}

func buildBackendConnection(policy egv1a1.ClusterSettings) (*ir.BackendConnection, error) {
if policy.Connection == nil {
return nil, nil
Expand Down
Loading

0 comments on commit 587588d

Please sign in to comment.