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

Support configuring proxy with environment variables #225

Closed
micheas opened this issue Nov 22, 2018 · 6 comments · Fixed by #1514
Closed

Support configuring proxy with environment variables #225

micheas opened this issue Nov 22, 2018 · 6 comments · Fixed by #1514
Assignees
Labels
priority: p0 Highest priority. Critical issue. P0 implies highest priority. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@micheas
Copy link

micheas commented Nov 22, 2018

With instances being a command line argument I cannot use k8s secrets to set the instance and then recycle the same deployment.yaml file between environments, but rather resort to a generator for the k8s config.

An example can be found at:

https://github.com/itkj/docker-cloud-sql-proxy/blob/master/Dockerfile#L10

from itkj/docker-cloud-sql-proxy on docker hub.

@kurtisvg kurtisvg added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Nov 27, 2018
@kurtisvg kurtisvg self-assigned this Dec 13, 2018
@kurtisvg kurtisvg removed their assignment Nov 19, 2019
@enocom enocom added the priority: p3 Desirable enhancement or fix. May not be included in next release. label Feb 9, 2021
@enocom
Copy link
Member

enocom commented Feb 10, 2021

We're working on some major structural improvements to the proxy. Once those are complete, we'll come back to address this issue.

@enocom enocom added the v2 label Dec 2, 2021
@enocom enocom changed the title Ideally Instances would be a variable in the docker container. Support configuring proxy with environment variables Aug 29, 2022
@enocom
Copy link
Member

enocom commented Aug 29, 2022

The new v2 proxy uses cobra and makes it easy to integrate with viper. Now that the v2 proxy is out, I have this in my backlog.

@enocom enocom added priority: p0 Highest priority. Critical issue. P0 implies highest priority. and removed priority: p3 Desirable enhancement or fix. May not be included in next release. labels Aug 29, 2022
@enocom
Copy link
Member

enocom commented Aug 29, 2022

This work will unblock #1045.

@hessjcg
Copy link
Collaborator

hessjcg commented Aug 31, 2022

What if we did a kind of naming scheme for the environment variables:

# global flag
CLOUD_SQL_PROXY_PORT=5000 
CLOUD_SQL_PROXY_CREDENTIALS_FILE=./keys/service_account.json # global flag

# instance specific flags
CLOUD_SQL_PROXY_INSTANCE_1=hello:world:db1 # instance flag
CLOUD_SQL_PROXY_INSTANCE_1_PORT=8080
CLOUD_SQL_PROXY_INSTANCE_1_PRIVATE_IP=true #Boolean env var?

CLOUD_SQL_PROXY_INSTANCE_2=hello:world:db2
CLOUD_SQL_PROXY_INSTANCE_2_PORT=8081
CLOUD_SQL_PROXY_INSTANCE_2_USE_IAM_AUTHN=true

@enocom
Copy link
Member

enocom commented Sep 24, 2022

I think we should make the list of instance connection names zero indexed and also define an INSTANCE_CONNECTION_NAME variable for the first instance, for the cases when someone is connecting to only a single instance:

CLOUD_SQL_PROXY_INSTANCE_CONNECTION_NAME=proj:reg:myinst
CLOUD_SQL_PROXY_INSTANCE_0=proj:reg:myinst
CLOUD_SQL_PROXY_INSTANCE_1=proj:reg:myotherinst

@enocom enocom self-assigned this Oct 3, 2022
@enocom
Copy link
Member

enocom commented Oct 25, 2022

Also, to configure individual instances, we'll continue to use query params:

CLOUD_SQL_AUTO_IAM_AUTHN=true
CLOUD_SQL_PROXY_INSTANCE_0=proj:reg:myinst?auto-iam-authn=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p0 Highest priority. Critical issue. P0 implies highest priority. 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.

4 participants