-
Notifications
You must be signed in to change notification settings - Fork 3
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 chart config to mount and consume a GCP service account's credentials #123
Comments
I now see this as something that could be done in three separate ways:
I forgot to consider option 2 when refining this work, hmmm... I disliked the complexity of 1 for the user which then also needs to create a k8s Secret themselves and went thinking about 3, but with 2 we can still avoid the need for users to create a k8s Secret and allow for any kind of credentials to be easily injected. Comparing option 2 and 3 from a usage perspective: # how one would use option 2
binderhub-service:
extraFiles:
gcp-sa-key.json:
mountPath: /mnt/gcp-sa-key.json
stringData: |
<...>
extraEnv:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /mnt/gcp-sa-key.json
# how one would use option 3
binderhub-service:
extraCredentials:
googleServiceAccountKey: |
<...> Dang it, because this chart doesn't have extraEnv support a dictionary (yet?), use of |
mybinder.org has its federated binderhubs log event data to a single google logging destination, and does so via this extraConfig.
For credentials to get setup for that:
eventsArchiver.serviceAccountKey
binderhub.extraVolumes
andbinderhub.extraVolumeMounts
is used to mount the k8s Secret created by the mybinder chart on the binderhub deployment's podbinderhub.extraEnv.GOOGLE_APPLICATION_CREDENTIALS
is used to make the credentials detected by thegoogle-cloud-logging
libraryI think it makes sense of binderhub-service embraces this complexity by accepting a
extraCredentials.googleServiceAccountKey
configuration, and if received, adds a key/value (Secret's and ConfigMap's keys become filenames when mounted, and the values becomes the file content) to the existing k8s Secret template. That k8s Secret is already declared as a volume and mounted to/etc/binderhub/mounted-secret/
, so what remains is to just conditionally declares aGOOGLE_APPLICATION_CREDENTIALS
environment variable to reference the file with credentials.Practically this is the plan
extraCredentials.googleServiceAccountKey
config (values.yaml entry, values.schema.yaml entry, tools/templates/lint-and-validate-values.yaml entry)GOOGLE_APPLICATION_CREDENTIALS
to point to the mounted fileDevelopment tips
Development tips
To test and develop changes to template files, you can make use of commands below - the
tools/
folders commands are available in z2jh / binderhub as well, so this practice can be useful to know about for contributions to those projects as well.The text was updated successfully, but these errors were encountered: