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

release-22.2: ccl/sqlproxyccl: add PROXY protocol support via CLI flag to sqlproxy #100497

Conversation

jaylim-crl
Copy link
Collaborator

Backport commits from #99429 and #100288.

/cc @cockroachdb/release


This commit adds a new require-proxy-protocol flag to mt start-proxy, and
that changes the sqlproxy's behavior to support the PROXY protocol. When the
flag is set, the protocol will be enforced on the SQL listener, and supported
on a best-effort basis on the HTTP listener. If the PROXY protocol isn't used,
but is enforced, the connection will be rejected. The rationale behind doing
best-effort basis on the HTTP listener is that some healthcheck systems don't
support the protocol.

This work is needed for the AWS PrivateLink work in CockroachCloud, which
requires the use of the PROXY protocol.

Release note: None

Epic: none

Release justification: SQL Proxy change only. Changes are needed for the AWS
PrivateLink work in CockroachCloud. Doing this for 22.2 helps with rolling out
the changes.

This commits adds a new `require-proxy-protocol` flag to `mt start-proxy`, and
that changes the sqlproxy's behavior to support the PROXY protocol. When the
flag is set, the protocol will be enforced on the SQL listener, and supported
on a best-effort basis on the HTTP listener. If the PROXY protocol isn't used,
but is enforced, the connection will be rejected. The rationale behind doing
best-effort basis on the HTTP listener is that some healthcheck systems don't
support the protocol.

This work is needed for the AWS PrivateLink work in CockroachCloud, which
requires the use of the PROXY protocol.

Release note: None

Epic: none

Release justification: SQL Proxy change only. Changes are needed for the AWS
PrivateLink work in CockroachCloud.
Fixes cockroachdb#100269.

It appears that there's a possibility where the server returns a malformed
response (i.e. one that the client doesn't understand), if one attempts to
send non-HTTP requests to an HTTP server (e.g. in the case of a PROXY header).
In that case, just assert that we have an error, and we're done.

Release note: None

Release justification: Fixes a test flake.

Epic: none
@jaylim-crl jaylim-crl requested review from a team as code owners April 3, 2023 18:50
@blathers-crl
Copy link

blathers-crl bot commented Apr 3, 2023

Thanks for opening a backport.

Please check the backport criteria before merging:

  • Patches should only be created for serious issues or test-only changes.
  • Patches should not break backwards-compatibility.
  • Patches should change as little code as possible.
  • Patches should not change on-disk formats or node communication protocols.
  • Patches should not add new functionality.
  • Patches must not add, edit, or otherwise modify cluster versions; or add version gates.
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
  • There is a high priority need for the functionality that cannot wait until the next release and is difficult to address in another way.
  • The new functionality is additive-only and only runs for clusters which have specifically “opted in” to it (e.g. by a cluster setting).
  • New code is protected by a conditional check that is trivial to verify and ensures that it only runs for opt-in clusters.
  • The PM and TL on the team that owns the changed code have signed off that the change obeys the above rules.

Add a brief release justification to the body of your PR to justify this backport.

Some other things to consider:

  • What did we do to ensure that a user that doesn’t know & care about this backport, has no idea that it happened?
  • Will this work in a cluster of mixed patch versions? Did we test that?
  • If a user upgrades a patch version, uses this feature, and then downgrades, what happens?

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@jaylim-crl jaylim-crl requested a review from jeffswenson April 3, 2023 18:51
@jaylim-crl
Copy link
Collaborator Author

Note that this PR wasn't a clean cherry-pick, especially for the first commit, as there were some CLI refactor changes that weren't backported into 22.2.

@jaylim-crl
Copy link
Collaborator Author

I'm going to close this. We'll just make this available via v23.1 for now. If there's a strong need, we can bring this back.

@jaylim-crl jaylim-crl closed this Apr 3, 2023
@jaylim-crl jaylim-crl deleted the backport22.2-99429-100288 branch April 3, 2023 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants