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

Document using cloudsql auth proxy in kubernetes jobs #1941

Closed
tnimni opened this issue Sep 11, 2023 · 5 comments · Fixed by #1953
Closed

Document using cloudsql auth proxy in kubernetes jobs #1941

tnimni opened this issue Sep 11, 2023 · 5 comments · Fixed by #1953
Assignees
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: docs Improvement to the documentation for an API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@tnimni
Copy link

tnimni commented Sep 11, 2023

Question

I need to use this in a kubernetes job,
While it works in the side car pattern, the job is stuck in NotReady status since the auth proxy never exit.

any way to trigger an exit code with status code that will make the job succeed?

Code

No response

Additional Details

No response

@tnimni tnimni added the type: question Request for information or clarification. label Sep 11, 2023
@enocom
Copy link
Member

enocom commented Sep 11, 2023

You can do this with two flags:

  1. --quitquitquit and
  2. --exit-zero-on-sigterm

With both in place, your main task has to call the /quitquitquit endpoint after your job is done and the Proxy will shutdown with a zero exit code.

This is a common enough use case, we'll make this issue about improving documentation about it.

Let me know if you have any other questions.

@enocom enocom changed the title Using cloudsql auth proxy in kubernetes jobs Document using cloudsql auth proxy in kubernetes jobs Sep 11, 2023
@enocom enocom added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: docs Improvement to the documentation for an API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: question Request for information or clarification. labels Sep 11, 2023
@enocom enocom assigned jackwotherspoon and unassigned enocom Sep 11, 2023
@hessjcg
Copy link
Collaborator

hessjcg commented Sep 14, 2023

Hello, There will soon be a better piece of documentation on how to make this work correctly in the cloud-sql-proxy-operator project. See cloud-sql-proxy-operator#438.

I will add documentation to this project as well, for users who would rather configure side-car containers themselves.

@hessjcg hessjcg assigned hessjcg and unassigned jackwotherspoon Sep 19, 2023
hessjcg added a commit that referenced this issue Sep 20, 2023
This example demonstrates how to use the /quitquitquit endpoint in a kubernetes job to allow job pods
to exit successfully when the main application container exits.

Fixes #1941
@millerm
Copy link

millerm commented Nov 3, 2023

I experienced a similar issue.

Upon completion, the main container shuts down and makes the recommended curl request (per the example).

The GET function was not working as expected. I was able to successfully shut down the proxy when updating to a POST:

curl -X POST -d '' http://localhost:9092/quitquitquit

This is described in the comments of the example .yaml if you read more closely. I am running gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.6.0 - maybe the GET works in later releases.

EDIT:
The GET is supported in 2.7:

* /quitquitquit api now responds to HTTP GET and POST requests. ([#1947](https://github.com/GoogleCloudPlatform/cloud-sql-proxy/issues/1947)) ([e5ebb48](https://github.com/GoogleCloudPlatform/cloud-sql-proxy/commit/e5ebb485f7a7a5f9820822bf4e84467da431fc6b)), closes [#1946](https://github.com/GoogleCloudPlatform/cloud-sql-proxy/issues/1946)

@enocom
Copy link
Member

enocom commented Nov 3, 2023

Yes, GET support was released in 2.7.0.

https://github.com/GoogleCloudPlatform/cloud-sql-proxy/releases/tag/v2.7.0

@millerm
Copy link

millerm commented Nov 3, 2023

Yes, GET support was released in 2.7.0.

https://github.com/GoogleCloudPlatform/cloud-sql-proxy/releases/tag/v2.7.0

Awesome, thank you! Appreciate all the hard work on the cloud-sql-proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: docs Improvement to the documentation for an API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants