Skip to content

Commit

Permalink
feat: allow external cardano-wallet and cardano-db-sync
Browse files Browse the repository at this point in the history
Signed-off-by: Kranium Gikos Mendoza <[email protected]>
  • Loading branch information
womfoo committed Jun 7, 2024
1 parent 94a31c5 commit 0ccfa70
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 3 deletions.
40 changes: 39 additions & 1 deletion infrastructure/charts/node/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,26 @@ spec:
value: {{ .Values.server.refereshAndSubmitPeriod | quote }}
- name: NODE_CARDANO_CONFIRMATION_BLOCKS
value: {{ .Values.server.confirmationBlocks | quote }}
{{- if and (eq "cardano" .Values.server.ledger) (not (empty .Values.vdr.externalResources.wallet.host)) }}
- name: NODE_CARDANO_WALLET_API_HOST
value: "{{ .Values.vdr.externalResources.wallet.host }}"
- name: NODE_CARDANO_WALLET_API_PORT
value: "{{ .Values.vdr.externalResources.wallet.port }}"
- name: NODE_CARDANO_WALLET_ID
valueFrom:
secretKeyRef:
name: "{{ .Values.secrets.cardanoWallet }}"
key: wallet_id
optional: false
- name: NODE_CARDANO_WALLET_PASSPHRASE
valueFrom:
secretKeyRef:
name: "{{ .Values.secrets.cardanoWallet }}"
key: passphrase
optional: false
- name: NODE_CARDANO_PAYMENT_ADDRESS
value: "{{ .Values.vdr.externalResources.wallet.payment_address }}"
{{- else if eq "cardano" .Values.server.ledger }}
- name: NODE_CARDANO_WALLET_API_HOST
value: "{{ .Values.vdr.cardanoNode }}.{{ .Values.vdr.cardanoNamespace }}"
- name: NODE_CARDANO_WALLET_ID
Expand All @@ -69,7 +89,25 @@ spec:
name: "{{ .Values.vdr.cardanoNode }}-{{ .Values.vdr.cardanoWallet }}"
key: address
optional: false
{{- if eq "cardano" .Values.server.ledger }}
{{- end }}
{{- if and (eq "cardano" .Values.server.ledger) (not (empty .Values.vdr.externalResources.db_sync.host)) }}
- name: NODE_CARDANO_DB_SYNC_USERNAME
valueFrom:
secretKeyRef:
name: "{{ .Values.secrets.cardanoDbSync }}"
key: username
optional: false
- name: NODE_CARDANO_DB_SYNC_PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Values.secrets.cardanoDbSync }}"
key: password
optional: false
- name: NODE_CARDANO_DB_SYNC_DATABASE
value: "{{ .Values.vdr.externalResources.db_sync.database }}"
- name: NODE_CARDANO_DB_SYNC_HOST
value: "{{ .Values.vdr.externalResources.db_sync.host }}"
{{- else if eq "cardano" .Values.server.ledger }}
- name: NODE_CARDANO_DB_SYNC_USERNAME
valueFrom:
secretKeyRef:
Expand Down
42 changes: 40 additions & 2 deletions infrastructure/charts/node/templates/externalsecret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ spec:
dataFrom:
- extract:
key: {{ .Values.secrets.dockerRegistryToken }}

---
# Requires wallet to be created (atm it's done through terraform module)
{{- if and (empty .Values.vdr.externalResources.wallet.host)
(empty .Values.vdr.externalResources.db_sync.host) }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
Expand All @@ -36,3 +36,41 @@ spec:
dataFrom:
- extract:
key: {{ .Values.vdr.cardanoWallet }}
---
{{- end }}
{{- if not (empty .Values.vdr.externalResources.wallet.host) }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: "{{ .Values.secrets.cardanoWallet }}"
namespace: {{ .Release.Namespace }}
labels:
{{ template "labels.common" . }}
spec:
refreshInterval: "0"
secretStoreRef:
name: {{ .Values.secrets.secretStore }}
kind: ClusterSecretStore
dataFrom:
- extract:
key: "{{ .Values.secrets.cardanoWallet }}"
---
{{- end }}
{{- if not (empty .Values.vdr.externalResources.db_sync.host) }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: "{{ .Values.secrets.cardanoDbSync }}"
namespace: {{ .Release.Namespace }}
labels:
{{ template "labels.common" . }}
spec:
refreshInterval: "0"
secretStoreRef:
name: {{ .Values.secrets.secretStore }}
kind: ClusterSecretStore
dataFrom:
- extract:
key: "{{ .Values.secrets.cardanoDbSync }}"
---
{{- end }}
10 changes: 10 additions & 0 deletions infrastructure/charts/node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ ingress:
secrets:
secretStore: chart-base-secretstore
dockerRegistryToken: chart-base-docker-registry-token
# cardanoWallet: must contain wallet_id and passphrase
# cardanoDbSync: must contain username and password

server:
ledger: "in-memory"
Expand Down Expand Up @@ -39,6 +41,14 @@ database:
numberOfInstances: 2

vdr:
externalResources:
wallet:
host:
payment_address:
port: "443"
db_sync:
host:
database:
cardanoNode: atala-cardano-dev-preprod
cardanoNamespace: cardano-stack
cardanoWallet: dev-k8s-cardano-wallet

0 comments on commit 0ccfa70

Please sign in to comment.