Skip to content

Commit

Permalink
Merge pull request #133 from consideRatio/pr/add-config-extracred
Browse files Browse the repository at this point in the history
Add config extraCredentials.googleServiceAccountKey
  • Loading branch information
consideRatio committed Jul 12, 2024
2 parents 75a4c30 + 470611b commit a3c5620
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
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

0 comments on commit a3c5620

Please sign in to comment.