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

Add config extraCredentials.googleServiceAccountKey #133

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions binderhub-service/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.extraCredentials.googleServiceAccountKey }}
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/binderhub/mounted-secret/gcp-sa-key.json
{{- end }}
{{- with .Values.extraEnv }}
{{- tpl (. | toYaml) $ | nindent 12 }}
{{- end }}
Expand Down
5 changes: 5 additions & 0 deletions binderhub-service/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ stringData:
chart-config.yaml: |
{{- pick .Values "config" "extraConfig" | toYaml | nindent 4 }}

{{- with .Values.extraCredentials.googleServiceAccountKey }}
gcp-sa-key.json: |
{{- . | nindent 4 }}
{{- end }}

{{- /* Glob files to allow them to be mounted by the binderhub pod */}}
{{- /* key=filename: value=content */}}
{{- (.Files.Glob "mounted-files/*").AsConfig | nindent 2 }}
7 changes: 7 additions & 0 deletions binderhub-service/values.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ required:
- buildPodsRegistryCredentials
# Deployment resource
- image
- extraCredentials
# Other resources
- rbac
- serviceAccount
Expand Down Expand Up @@ -83,6 +84,12 @@ properties:
patternProperties:
".*":
type: [string, "null"]
extraCredentials:
type: object
additionalProperties: false
properties:
googleServiceAccountKey:
type: string
extraEnv:
type: array

Expand Down
2 changes: 2 additions & 0 deletions binderhub-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ extraConfig:
namespace = os.environ["NAMESPACE"]
c.KubernetesBuildExecutor.docker_host = f"/var/run/{ namespace }-{ helm_release_name }/docker-api/docker-api.sock"

extraCredentials:
googleServiceAccountKey: ""
extraEnv: []
replicas: 1
image:
Expand Down
14 changes: 14 additions & 0 deletions tools/templates/lint-and-validate-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ buildPodsRegistryCredentials:
image:
repository: quay.io/2i2c/binderhub-service
tag: "set-by-chartpress"
extraCredentials:
googleServiceAccountKey: |
{
"type": "service_account",
"project_id": "PROJECT_ID",
"private_key_id": "KEY_ID",
"private_key": "-----BEGIN PRIVATE KEY-----\nPRIVATE_KEY\n-----END PRIVATE KEY-----\n",
"client_email": "SERVICE_ACCOUNT_EMAIL",
"client_id": "CLIENT_ID",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/SERVICE_ACCOUNT_EMAIL"
}
extraEnv:
- name: HELM_RELEASE_NAME
value: "{{ .Release.Name }}"
Expand Down
Loading