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

add external traffic policy for gw2 gw params #10420

Merged
merged 59 commits into from
Dec 31, 2024

Conversation

kevin-shelaga
Copy link

@kevin-shelaga kevin-shelaga commented Dec 2, 2024

Description

When using the Kubernetes Gateway API, the provisioned proxy service external traffic policy is now configurable via the GatewayParameters fields spec.kube.service.externalTrafficPolicy

This values can also be set on the default GatewayParameters during install/upgrade using the Helm value kubeGateway.gatewayParameters.glooGateway.service.externalTrafficPolicy

API changes

Added fields to GatewayParameters:

spec.kube.service.externalTrafficPolicy

Code changes

Update gw params to expose external traffic policy
Add test

Context

Fixes kgateway-dev#9879

Users need to be able to change the external traffic policy so that source client IPs are preserved for features like WAF and ext auth.

Testing steps

helm unit tests
deployer unit tests
deployer e2e test

Checklist:

@kevin-shelaga kevin-shelaga requested a review from a team as a code owner December 2, 2024 12:15
@solo-changelog-bot
Copy link

Issues linked to changelog:
kgateway-dev#9879

Copy link

github-actions bot commented Dec 2, 2024

Visit the preview URL for this PR (updated for commit d946524):

https://gloo-edge--pr10420-gw2-externaltrafficp-9joq07l1.web.app

(expires Sat, 04 Jan 2025 12:20:15 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 77c2b86e287749579b7ff9cadb81e099042ef677

@danehans
Copy link

The Kubernetes Tests / End-to-End (cluster-two) job is failing due to:

=== RUN   TestK8sGateway/RouteOptions/TestConfigureInvalidRouteOptionsWithTargetRef
httproute.gateway.networking.k8s.io/httproute1 created
routeoption.gateway.solo.io/bad-rto-targetref created
=== NAME  TestK8sGateway
    status.go:73: 
        Timed out after 20.000s.
        The function passed to Eventually failed at /home/runner/work/gloo/gloo/test/kubernetes/testutils/assertions/status.go:72 with:
        have matcher for namespace k8s-gw-test which is not found

Rerunning job.

@kevin-shelaga
Copy link
Author

Those 2 failures look like a flake @jenshu @danehans

@danehans
Copy link

The following e2e is related to this PR is failing:

=== RUN   TestK8sGatewayAws/Deployer/TestConfigureProxiesFromGatewayParameters
namespace/nginx created
service/nginx created
configmap/nginx-conf created
pod/nginx created
gatewayparameters.gateway.gloo.solo.io/gw-params-custom created
gateway.gateway.networking.k8s.io/gw created
httproute.gateway.networking.k8s.io/example-route created
gatewayparameters.gateway.gloo.solo.io/gw-params created
=== NAME  TestK8sGatewayAws
    suite.go:145: 
        Expected
            <v1.ServiceExternalTrafficPolicy>: Cluster
        to equal
            <v1.ServiceExternalTrafficPolicy>: Local
namespace "nginx" deleted
service "nginx" deleted
configmap "nginx-conf" deleted
pod "nginx" deleted

Copy link

@danehans danehans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevin-shelaga PTAL at my review feedback and e2e failure.

// External Traffic Policy on the Service object.
//
// +kubebuilder:validation:Optional
ExternalTrafficPolicy *corev1.ServiceExternalTrafficPolicy `json:"externalTrafficPolicy,omitempty"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general we want default values to be explicitly represented in our APIs (xref).

Copy link

@danehans danehans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since ExternalTrafficPolicy accepts opaque strings, it's important to include a test case for an unintended value. If this test case is not included, please create a tracker issue and xref it.

@kevin-shelaga
Copy link
Author

check for/test invalid values: #10540

@soloio-bulldozer soloio-bulldozer bot merged commit ecaab37 into main Dec 31, 2024
20 checks passed
@soloio-bulldozer soloio-bulldozer bot deleted the gw2-externaltrafficpolicy branch December 31, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to set "externalTrafficPolicy" in "GatewayParameters"