Skip to content

Commit

Permalink
make api url a secret
Browse files Browse the repository at this point in the history
Signed-off-by: André Bauer <[email protected]>

use different name

Signed-off-by: André Bauer <[email protected]>
  • Loading branch information
monotek committed Jun 25, 2024
1 parent 77a2915 commit 832d6fb
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/visual-regression-tracker/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sources:
- https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker
- https://github.com/kokuwaio/helm-charts/tree/main/charts/visual-regression-tracker
type: application
version: 4.0.0
version: 3.2.0
appVersion: "5.0.5"
maintainers:
- name: monotek
Expand Down
4 changes: 2 additions & 2 deletions charts/visual-regression-tracker/files/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ async function createDefaultUser() {
},
create: {
email: defaultEmail,
firstName: 'Admin',
lastName: 'Admin',
firstName: 'fname',
lastName: 'lname',
role: Role.admin,
apiKey: defaultApiKey,
password: await hash(defaultPassword, salt),
Expand Down
12 changes: 12 additions & 0 deletions charts/visual-regression-tracker/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,15 @@ type: Opaque
data:
{{ .Values.secrets.defaults.secretKey }}: {{ tpl (.Files.Get "files/seed.ts") $ | b64enc }}
{{ end }}
{{ if and .Values.vrtConfig.reactAppApiUrl (not .Values.secrets.apiUrl.useExisting) }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ template "visual-regression-tracker.vrtSecretName" . }}-api-url
labels:
{{- include "visual-regression-tracker.labels" . | nindent 4 }}
type: Opaque
data:
{{ .Values.secrets.apiUrl.secretKey }}: {{ .Values.vrtConfig.reactAppApiUrl | b64enc | quote }}
{{ end }}
5 changes: 4 additions & 1 deletion charts/visual-regression-tracker/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ spec:
- name: {{ .Chart.Name }}-ui
env:
- name: REACT_APP_API_URL
value: "{{ .Values.vrtConfig.reactAppApiUrl }}"
valueFrom:
secretKeyRef:
name: {{ template "visual-regression-tracker.vrtSecretName" . }}-api-url
key: {{ .Values.secrets.apiUrl.secretKey }}
- name: VRT_VERSION
value: "{{ .Chart.AppVersion }}"
image: "{{ .Values.vrtComponents.ui.image.repository }}:{{ .Values.vrtComponents.ui.image.tag }}"
Expand Down
4 changes: 4 additions & 0 deletions charts/visual-regression-tracker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ persistence:
annotations: {}

secrets:
apiUrl:
useExisting: false
secretKey: api-url
secretName: vrt-api-url
defaults:
useExisting: false
secretName: vrt
Expand Down

0 comments on commit 832d6fb

Please sign in to comment.