|
| 1 | +{{- define "sourcegraph.databaseAuth" -}} |
| 2 | +{{- $top := index . 0 -}} |
| 3 | +{{- $service := index . 1 -}} |
| 4 | +{{- $prefix := index . 2 -}} |
| 5 | +{{- $secretName := (index $top.Values $service "name") -}} |
| 6 | +{{- $secretName := printf "%s-auth" $secretName -}} |
| 7 | +{{- if (index $top.Values $service "auth" "existingSecret") }}{{- $secretName = (index $top.Values $service "auth" "existingSecret") }}{{- end -}} |
| 8 | +- name: {{ printf "%sDATABASE" $prefix }} |
| 9 | + valueFrom: |
| 10 | + secretKeyRef: |
| 11 | + key: database |
| 12 | + name: {{ $secretName }} |
| 13 | +- name: {{ printf "%sHOST" $prefix }} |
| 14 | + valueFrom: |
| 15 | + secretKeyRef: |
| 16 | + key: host |
| 17 | + name: {{ $secretName }} |
| 18 | +- name: {{ printf "%sPASSWORD" $prefix }} |
| 19 | + valueFrom: |
| 20 | + secretKeyRef: |
| 21 | + key: password |
| 22 | + name: {{ $secretName }} |
| 23 | +- name: {{ printf "%sPORT" $prefix }} |
| 24 | + valueFrom: |
| 25 | + secretKeyRef: |
| 26 | + key: port |
| 27 | + name: {{ $secretName }} |
| 28 | +- name: {{ printf "%sUSER" $prefix }} |
| 29 | + valueFrom: |
| 30 | + secretKeyRef: |
| 31 | + key: user |
| 32 | + name: {{ $secretName }} |
| 33 | +- name: {{ printf "%sSSLMODE" $prefix }} |
| 34 | + valueFrom: |
| 35 | + secretKeyRef: |
| 36 | + key: sslmode |
| 37 | + name: {{ $secretName }} |
| 38 | +{{- end }} |
| 39 | + |
| 40 | + |
| 41 | +{{- define "sourcegraph.dataSource" -}} |
| 42 | +{{- $top := index . 0 -}} |
| 43 | +{{- $service := index . 1 -}} |
| 44 | +{{- $secretName := (index $top.Values $service "name") -}} |
| 45 | +{{- $secretName := printf "%s-auth" $secretName -}} |
| 46 | +{{- if (index $top.Values $service "auth" "existingSecret") }}{{- $secretName = (index $top.Values $service "auth" "existingSecret") }}{{- end -}} |
| 47 | +- name: DATA_SOURCE_DB |
| 48 | + valueFrom: |
| 49 | + secretKeyRef: |
| 50 | + key: database |
| 51 | + name: {{ $secretName }} |
| 52 | +- name: DATA_SOURCE_PASS |
| 53 | + valueFrom: |
| 54 | + secretKeyRef: |
| 55 | + key: password |
| 56 | + name: {{ $secretName }} |
| 57 | +- name: DATA_SOURCE_PORT |
| 58 | + valueFrom: |
| 59 | + secretKeyRef: |
| 60 | + key: port |
| 61 | + name: {{ $secretName }} |
| 62 | +- name: DATA_SOURCE_USER |
| 63 | + valueFrom: |
| 64 | + secretKeyRef: |
| 65 | + key: user |
| 66 | + name: {{ $secretName }} |
| 67 | +- name: DATA_SOURCE_URI |
| 68 | + value: "localhost:$(DATA_SOURCE_PORT)/$(DATA_SOURCE_DB)?sslmode=disable" |
| 69 | +{{- end }} |
| 70 | + |
| 71 | + |
| 72 | +{{- define "sourcegraph.authChecksum" -}} |
| 73 | +{{- $checksum := list .Values.codeInsightsDB.auth -}} |
| 74 | +{{- $checksum = append $checksum .Values.codeIntelDB.auth -}} |
| 75 | +{{- $checksum = append $checksum .Values.pgsql.auth -}} |
| 76 | +checksum/auth: {{ toJson $checksum | sha256sum }} |
| 77 | +{{- end -}} |
0 commit comments