Skip to content

Commit 338baad

Browse files
committed
fix(deployment): properly expose service account key for secret manager
We need to mount the service account key as a file into the controlplane and cas container when using GCP secret manager. - use proper key in sercret manager service account configuration - update helm chart README - be consitent in chart template and use 'serviceaccountkey' everywhere Signed-off-by: Christophe de Carvalho <christophe@archipelo.co>
1 parent f6ec84d commit 338baad

File tree

7 files changed

+46
-6
lines changed

7 files changed

+46
-6
lines changed

deployment/chainloop/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ helm install [RELEASE_NAME] oci://ghcr.io/chainloop-dev/charts/chainloop \
9999
# Secrets backend
100100
--set secretsBackend.backend=gcpSecretManager \
101101
--set secretsBackend.gcpSecretManager.projectId=[GCP Project ID] \
102-
--set secretsBackend.gcpSecretManager.authKey=[GCP Auth KEY] \
102+
--set secretsBackend.gcpSecretManager.serviceAccountKey=[GCP Auth KEY] \
103103
# Server Auth KeyPair
104104
# ...
105105
```
@@ -317,7 +317,7 @@ secretsBackend:
317317
backend: gcpSecretManager
318318
gcpSecretManager:
319319
projectId: [PROJECT_ID]
320-
authKey: [KEY]
320+
serviceAccountKey: [KEY]
321321
```
322322

323323
### Send exceptions to Sentry
@@ -370,7 +370,7 @@ chainloop config save \
370370
| `secretsBackend.awsSecretManager.secretKey` | AWS Secret Key | |
371371
| `secretsBackend.awsSecretManager.region` | AWS Secret Manager Region | |
372372
| `secretsBackend.gcpSecretManager.projectId` | GCP Project ID | |
373-
| `secretsBackend.gcpSecretManager.authKey` | GCP Auth Key | |
373+
| `secretsBackend.gcpSecretManager.serviceAccountKey` | GCP Auth Key | |
374374
375375
### Authentication
376376

deployment/chainloop/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ awsSecretManager:
8282
gcpSecretManager:
8383
secretPrefix: {{ required "secret prefix required" .secretPrefix | quote }}
8484
projectId: {{ required "project id required" .gcpSecretManager.projectId | quote }}
85-
authKey: {{ required "auth key required" .gcpSecretManager.authKey | quote }}
85+
serviceAccountKey: "/gcp-secrets/serviceAccountKey.json"
8686

8787
{{- end }}
8888
{{- end }}

deployment/chainloop/templates/cas/deployment.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ spec:
5858
mountPath: "/data/conf"
5959
- name: jwt-public-key
6060
mountPath: "/tmp"
61+
{{- if eq "gcpSecretManager" .Values.secretsBackend.backend }}
62+
- name: gcp-secretmanager-serviceaccountkey
63+
mountPath: /gcp-secrets
64+
{{- end }}
6165
volumes:
6266
- name: config
6367
projected:
@@ -69,3 +73,8 @@ spec:
6973
- name: jwt-public-key
7074
secret:
7175
secretName: {{ include "chainloop.cas.fullname" . }}-jwt-public-key
76+
{{- if eq "gcpSecretManager" .Values.secretsBackend.backend }}
77+
- name: gcp-secretmanager-serviceaccountkey
78+
secret:
79+
secretName: {{ include "chainloop.controlplane.fullname" . }}-gcp-secretmanager-serviceaccountkey
80+
{{- end }}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{- if eq "gcpSecretManager" .Values.secretsBackend.backend }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ include "chainloop.cas.fullname" . }}-gcp-secretmanager-serviceaccountkey
6+
labels:
7+
{{- include "chainloop.cas.labels" . | nindent 4 }}
8+
type: Opaque
9+
data:
10+
serviceAccountKey.json: {{ .Values.secretsBackend.gcpSecretManager.serviceAccountKey | b64enc | quote }}
11+
{{- end }}

deployment/chainloop/templates/controlplane/deployment.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ spec:
8585
mountPath: /tmp
8686
- name: jwt-cas-private-key
8787
mountPath: /secrets
88+
{{- if eq "gcpSecretManager" .Values.secretsBackend.backend }}
89+
- name: gcp-secretmanager-serviceaccountkey
90+
mountPath: /gcp-secrets
91+
{{- end }}
8892
volumes:
8993
- name: config
9094
projected:
@@ -99,3 +103,8 @@ spec:
99103
- name: jwt-cas-private-key
100104
secret:
101105
secretName: {{ include "chainloop.controlplane.fullname" . }}-jwt-cas
106+
{{- if eq "gcpSecretManager" .Values.secretsBackend.backend }}
107+
- name: gcp-secretmanager-serviceaccountkey
108+
secret:
109+
secretName: {{ include "chainloop.controlplane.fullname" . }}-gcp-secretmanager-serviceaccountkey
110+
{{- end }}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{- if eq "gcpSecretManager" .Values.secretsBackend.backend }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ include "chainloop.controlplane.fullname" . }}-gcp-secretmanager-serviceaccountkey
6+
labels:
7+
{{- include "chainloop.controlplane.labels" . | nindent 4 }}
8+
type: Opaque
9+
data:
10+
serviceAccountKey.json: {{ .Values.secretsBackend.gcpSecretManager.serviceAccountKey | b64enc | quote }}
11+
{{- end }}

deployment/chainloop/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ secretsBackend:
5555
# region: ""
5656

5757
## @extra secretsBackend.gcpSecretManager.projectId GCP Project ID
58-
## @extra secretsBackend.gcpSecretManager.authKey GCP Auth Key
58+
## @extra secretsBackend.gcpSecretManager.serviceAccountKey GCP Auth Key
5959
##
6060
# gcpSecretManager:
6161
# projectId: ""
62-
# authKey: ""
62+
# serviceAccountKey: ""
6363

6464
## @section Authentication
6565
##

0 commit comments

Comments
 (0)