From 98dbf1db6136b2aec7cd305cb96a24bb47dd5e8a Mon Sep 17 00:00:00 2001 From: philbow61 <80156619+philbow61@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:44:28 +0200 Subject: [PATCH] feat: pass fx adapter api keys to oracles (#10443) --- packages/celotool/src/lib/env-utils.ts | 1 + packages/celotool/src/lib/k8s-oracle/base.ts | 1 + packages/celotool/src/lib/oracle.ts | 12 +++++++++++- .../oracle/templates/api_keys-secret.yaml | 7 +++++++ .../helm-charts/oracle/templates/statefulset.yaml | 5 +++++ 5 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 packages/helm-charts/oracle/templates/api_keys-secret.yaml diff --git a/packages/celotool/src/lib/env-utils.ts b/packages/celotool/src/lib/env-utils.ts index e70ebcaf44a..db12c6ae8e0 100644 --- a/packages/celotool/src/lib/env-utils.ts +++ b/packages/celotool/src/lib/env-utils.ts @@ -115,6 +115,7 @@ export enum envVar { ORACLE_DOCKER_IMAGE_REPOSITORY = 'ORACLE_DOCKER_IMAGE_REPOSITORY', ORACLE_DOCKER_IMAGE_TAG = 'ORACLE_DOCKER_IMAGE_TAG', ORACLE_UNUSED_ORACLE_ADDRESSES = 'ORACLE_UNUSED_ORACLE_ADDRESSES', + ORACLE_FX_ADAPTERS_API_KEYS = 'ORACLE_FX_ADAPTERS_API_KEYS', PRIVATE_NODE_DISK_SIZE_GB = 'PRIVATE_NODE_DISK_SIZE_GB', PRIVATE_TX_NODES = 'PRIVATE_TX_NODES', PROMETHEUS_DISABLE_STACKDRIVER_SIDECAR = 'PROMETHEUS_DISABLE_STACKDRIVER_SIDECAR', diff --git a/packages/celotool/src/lib/k8s-oracle/base.ts b/packages/celotool/src/lib/k8s-oracle/base.ts index 557c978db3f..a900f287305 100644 --- a/packages/celotool/src/lib/k8s-oracle/base.ts +++ b/packages/celotool/src/lib/k8s-oracle/base.ts @@ -73,6 +73,7 @@ export abstract class BaseOracleDeployer { ? getFornoWebSocketUrl(this.celoEnv) : getFullNodeWebSocketRpcInternalUrl(this.celoEnv) return [ + `--set oracle.api_keys=${fetchEnv(envVar.ORACLE_FX_ADAPTERS_API_KEYS)}`, `--set environment.name=${this.celoEnv}`, `--set image.repository=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_REPOSITORY)}`, `--set image.tag=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_TAG)}`, diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts index dfac13dcd77..8a42599eb16 100644 --- a/packages/celotool/src/lib/oracle.ts +++ b/packages/celotool/src/lib/oracle.ts @@ -303,7 +303,17 @@ const mnemonicBasedOracleIdentityConfigDynamicEnvVars: { */ export function addCurrencyPairMiddleware(argv: yargs.Argv) { return argv.option('currencyPair', { - choices: ['CELOUSD', 'CELOEUR', 'CELOBRL', 'USDCUSD', 'USDCEUR', 'USDCBRL'], + choices: [ + 'CELOUSD', + 'CELOEUR', + 'CELOBRL', + 'USDCUSD', + 'USDCEUR', + 'USDCBRL', + 'CELOXOF', + 'EUROCXOF', + 'EUROCEUR', + ], description: 'Oracle deployment to target based on currency pair', demandOption: true, type: 'string', diff --git a/packages/helm-charts/oracle/templates/api_keys-secret.yaml b/packages/helm-charts/oracle/templates/api_keys-secret.yaml new file mode 100644 index 00000000000..ad3071bb020 --- /dev/null +++ b/packages/helm-charts/oracle/templates/api_keys-secret.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: api-keys +type: Opaque +data: + api_keys: {{ .Values.oracle.api_keys | b64enc }} \ No newline at end of file diff --git a/packages/helm-charts/oracle/templates/statefulset.yaml b/packages/helm-charts/oracle/templates/statefulset.yaml index de6c0790911..1d5a604e879 100644 --- a/packages/helm-charts/oracle/templates/statefulset.yaml +++ b/packages/helm-charts/oracle/templates/statefulset.yaml @@ -115,6 +115,11 @@ spec: valueFrom: fieldRef: fieldPath: metadata.name + - name: API_KEYS + valueFrom: + secretKeyRef: + key: api_keys + name: api-keys {{ include "common.env-var" (dict "name" "API_REQUEST_TIMEOUT" "dict" .Values.oracle "value_name" "apiRequestTimeoutMs" "optional" true) | indent 8 }} {{ include "common.env-var" (dict "name" "AZURE_HSM_INIT_TRY_COUNT" "dict" .Values.oracle.azureHsm "value_name" "initTryCount") | indent 8 }} {{ include "common.env-var" (dict "name" "AZURE_HSM_INIT_MAX_RETRY_BACKOFF_MS" "dict" .Values.oracle.azureHsm "value_name" "initMaxRetryBackoffMs") | indent 8 }}