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

NET-5531 Translate response header modifier(s) from HTTPRoute onto Consul config entry #2904

Merged
merged 7 commits into from
Sep 12, 2023

Conversation

nathancoleman
Copy link
Member

@nathancoleman nathancoleman commented Sep 5, 2023

Note
This PR depends on changes in hashicorp/consul#18646

Changes proposed in this PR:
Translate the responseHeaderModifier that already exists on the K8s HTTPRoute onto the http-route config entry in Consul, which accepts response header modifiers as of hashicorp/consul#18646.

This PR also addresses the fact that we write an empty header modifier to Consul today for request header modifications when the K8s HTTPRoute does not specify any header modifications. Instead, we now appropriately write an empty list of header modifications to Consul when the HTTPRoute does not specify any.

How I've tested this PR:
Create a K8s HTTPRoute with various response header modifier filter(s) and verify that the filter syncs into Consul and functions correctly. See video of my own testing.

In addition, conformance tests exist here for this functionality that should pass where they previously failed. Here is the output of those tests passing.
CleanShot 2023-09-12 at 11 54 23@2x

How I expect reviewers to test this PR:
See above

Checklist:

@nathancoleman nathancoleman added pr/no-backport signals that a PR will not contain a backport label theme/api-gateway Related to Consul API Gateway labels Sep 5, 2023
@nathancoleman nathancoleman added backport/1.2.x This release branch is no longer active. and removed pr/no-backport signals that a PR will not contain a backport label labels Sep 11, 2023
@nathancoleman nathancoleman marked this pull request as ready for review September 11, 2023 22:50
@nathancoleman nathancoleman requested a review from a team September 12, 2023 15:56
@@ -2,7 +2,10 @@ module github.com/hashicorp/consul-k8s/control-plane

// TODO: remove when the SDK is released for Consul 1.17
// The replace directive is needed be because `api` requires 0.14.1 of SDK and is both a direct and indirect dependency
replace github.com/hashicorp/consul/sdk v0.14.1 => github.com/hashicorp/consul/sdk v0.4.1-0.20230825164720-ecdcde430924
replace (
github.com/hashicorp/consul/proto-public v0.4.1 => github.com/hashicorp/consul/proto-public v0.1.2-0.20230911164019-a69e901660bd
Copy link
Member

Choose a reason for hiding this comment

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

is there a reason why we're adding a new replace here? if it's to work with an unreleased version should we update this comment as well?

Copy link
Member Author

@nathancoleman nathancoleman Sep 12, 2023

Choose a reason for hiding this comment

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

I just added a comment explaining the replace directive that I added as well as making the TODO more robust

Copy link
Member

@jm96441n jm96441n left a comment

Choose a reason for hiding this comment

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

few minor questions but overall LGTM

Also use same pin for `sdk` that we're using for `api` and `proto-public`
@nathancoleman nathancoleman enabled auto-merge (squash) September 12, 2023 18:40
@nathancoleman nathancoleman merged commit fd4e184 into main Sep 12, 2023
3 checks passed
@nathancoleman nathancoleman deleted the response-headers branch September 12, 2023 19:07
@nathancoleman nathancoleman added pr/no-backport signals that a PR will not contain a backport label and removed backport/1.2.x This release branch is no longer active. labels Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/no-backport signals that a PR will not contain a backport label theme/api-gateway Related to Consul API Gateway
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants