Skip to content

Commit

Permalink
chore: parameterised postgres secret names and keys
Browse files Browse the repository at this point in the history
  • Loading branch information
nemo83 committed Apr 18, 2024
1 parent 41fc060 commit 25bb39b
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 23 deletions.
Expand Up @@ -58,33 +58,37 @@ spec:
{{- end }}

## Postgres
{{- with .Value.indexer.aggregation }}
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_HOST
name: {{ .secretName }}
key: {{ .hostKey }}
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_PORT
name: {{ .secretName }}
key: {{ .portKey }}
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_DB
name: {{ .secretName }}
key: {{ .dbKey }}
- name: POSTGRES_SCHEMA
value: {{ .Values.dbSchema | default "public" }}
- name: SPRING_DATASOURCE_URL
value: jdbc:postgresql://$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?currentSchema={{ .Values.aggregation.dbSchema | default "public" }}
value: jdbc:postgresql://$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?currentSchema=$(POSTGRES_SCHEMA)
- name: SPRING_DATASOURCE_USERNAME
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_USER
name: {{ .secretName }}
key: {{ .userKey }}
- name: SPRING_DATASOURCE_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_PASSWORD
name: {{ .secretName }}
key: {{ .passwordKey }}
{{- end }}

- name: STORE_ACCOUNT_HISTORYCLEANUPENABLED
value: {{ .Values.aggregation.store.account.history_cleanup_enabled | quote }}
Expand Down
26 changes: 15 additions & 11 deletions deploy/cf-ledger-sync/templates/ledger-sync-deployment.yaml
Expand Up @@ -77,33 +77,37 @@ spec:
value: {{ .Values.blocks.commitThreshold | default "3000" | quote }}

## Postgres
{{- with .Value.indexer.postgres }}
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_HOST
name: {{ .secretName }}
key: {{ .hostKey }}
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_PORT
name: {{ .secretName }}
key: {{ .portKey }}
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_DB
name: {{ .secretName }}
key: {{ .dbKey }}
- name: POSTGRES_SCHEMA
value: {{ .Values.dbSchema | default "public" }}
- name: SPRING_DATASOURCE_URL
value: jdbc:postgresql://$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?currentSchema={{ .Values.dbSchema | default "public" }}
value: jdbc:postgresql://$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?currentSchema=$(POSTGRES_SCHEMA)
- name: SPRING_DATASOURCE_USERNAME
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_USER
name: {{ .secretName }}
key: {{ .userKey }}
- name: SPRING_DATASOURCE_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_PASSWORD
name: {{ .secretName }}
key: {{ .passwordKey }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
Expand Down
49 changes: 48 additions & 1 deletion deploy/cf-ledger-sync/values.yaml
Expand Up @@ -51,13 +51,60 @@ blocks:

dbSchema: public


- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_HOST
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_PORT
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_DB
- name: SPRING_DATASOURCE_URL
value: jdbc:postgresql://$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?currentSchema={{ .Values.dbSchema | default "public" }}
- name: SPRING_DATASOURCE_USERNAME
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_USER
- name: SPRING_DATASOURCE_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_PASSWORD

indexer:
postgres:
dbSchema: public
secretName: postgres-secrets
hostKey: POSTGRES_HOST
portKey: POSTGRES_PORT
dbKey: POSTGRES_DB
userKey: POSTGRES_USER
passwordKey: POSTGRES_PASSWORD


aggregation:
enabled: false
image:
repository: cardanofoundation/cf-ledger-sync-aggregation
tag: "7b05530"
pullPolicy: Always
dbSchema: public
postgres:
dbSchema: aggregation
secretName: postgres-secrets
hostKey: POSTGRES_HOST
portKey: POSTGRES_PORT
dbKey: POSTGRES_DB
userKey: POSTGRES_USER
passwordKey: POSTGRES_PASSWORD
store:
account:
history_cleanup_enabled: "true"
Expand Down

0 comments on commit 25bb39b

Please sign in to comment.