diff --git a/spartan/aztec-network/templates/_helpers.tpl b/spartan/aztec-network/templates/_helpers.tpl index 1b9c0e2b8407..7045a38ff4c5 100644 --- a/spartan/aztec-network/templates/_helpers.tpl +++ b/spartan/aztec-network/templates/_helpers.tpl @@ -188,6 +188,37 @@ Sets up the OpenTelemetry resource attributes for a service mountPath: /shared/config {{- end -}} +{{/* +Otel Env vars +*/}} +{{- define "aztec-network.otelEnvVars" -}} +{{- $serviceName := base $.Template.Name | trimSuffix ".yaml" -}} +- name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP +- name: K8S_POD_UID + valueFrom: + fieldRef: + fieldPath: metadata.uid +- name: K8S_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name +- name: K8S_NAMESPACE_NAME + valueFrom: + fieldRef: + fieldPath: metadata.namespace +- name: OTEL_SERVICE_NAME + value: "{{ $serviceName }}" +- name: OTEL_RESOURCE_ATTRIBUTES + value: 'service.name={{ .Release.Name }},service.namespace={{ .Release.Namespace }},service.version={{ .Chart.AppVersion }},environment={{ .Values.environment | default "production" }}' +- name: USE_GCLOUD_LOGGING + value: "{{ .Values.telemetry.useGcloudLogging }}" +- name: OTEL_EXCLUDE_METRICS + value: "{{ .Values.telemetry.excludeMetrics }}" +{{- end -}} + {{/** Anti-affinity when running in public network mode */}} diff --git a/spartan/aztec-network/templates/boot-node.yaml b/spartan/aztec-network/templates/boot-node.yaml index 39ff87d3e44f..cc70b253acd6 100644 --- a/spartan/aztec-network/templates/boot-node.yaml +++ b/spartan/aztec-network/templates/boot-node.yaml @@ -133,10 +133,10 @@ spec: - /bin/bash - -c - | + source /scripts/setup-otel-resource.sh && \ source /shared/contracts/contracts.env && \ source /shared/config/p2p-addresses && \ source /shared/config/service-addresses && \ - source /shared/config/otel-resource && \ env && \ node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --node --archiver --sequencer --pxe startupProbe: @@ -156,27 +156,14 @@ spec: volumeMounts: - name: config mountPath: /shared/config + - name: scripts + mountPath: /scripts - name: boot-node-data mountPath: {{ .Values.bootNode.dataDir }} - name: scripts-output mountPath: /shared/contracts env: - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - name: K8S_POD_UID - valueFrom: - fieldRef: - fieldPath: metadata.uid - - name: K8S_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: K8S_NAMESPACE_NAME - valueFrom: - fieldRef: - fieldPath: metadata.namespace + {{- include "aztec-network.otelEnvVars" . | nindent 12 }} - name: NODE_OPTIONS value: "--max-old-space-size={{ .Values.bootNode.maxOldSpaceSize}}" - name: AZTEC_PORT @@ -223,10 +210,6 @@ spec: value: "{{ .Values.storage.dataStoreMapSize }}" - name: WS_DB_MAP_SIZE_KB value: "{{ .Values.storage.worldStateMapSize }}" - - name: USE_GCLOUD_LOGGING - value: "{{ .Values.telemetry.useGcloudLogging }}" - - name: OTEL_EXCLUDE_METRICS - value: "{{ .Values.telemetry.excludeMetrics }}" - name: TEST_ACCOUNTS value: "{{ .Values.aztec.testAccounts }}" {{- if .Values.blobSink.enabled }} diff --git a/spartan/aztec-network/templates/full-node.yaml b/spartan/aztec-network/templates/full-node.yaml index 9c5de221b857..1fc83c7e6b97 100644 --- a/spartan/aztec-network/templates/full-node.yaml +++ b/spartan/aztec-network/templates/full-node.yaml @@ -51,6 +51,7 @@ spec: - /bin/bash - -c - | + source /scripts/setup-otel-resource.sh source /shared/contracts/contracts.env source /shared/config/p2p-addresses source /shared/config/service-addresses @@ -72,6 +73,8 @@ spec: timeoutSeconds: 30 failureThreshold: 3 volumeMounts: + - name: scripts + mountPath: /scripts - name: config mountPath: /shared/config - name: full-node-data @@ -80,24 +83,7 @@ spec: mountPath: /shared/contracts/contracts.env subPath: contracts.env env: - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - name: K8S_POD_UID - valueFrom: - fieldRef: - fieldPath: metadata.uid - - name: K8S_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: OTEL_SERVICE_NAME - value: full-node - - name: K8S_NAMESPACE_NAME - valueFrom: - fieldRef: - fieldPath: metadata.namespace + {{- include "aztec-network.otelEnvVars" . | nindent 12 }} - name: NODE_OPTIONS value: "--max-old-space-size={{ .Values.fullNode.maxOldSpaceSize}}" - name: AZTEC_PORT @@ -116,8 +102,6 @@ spec: value: "true" - name: L1_CHAIN_ID value: "{{ .Values.ethereum.chainId }}" - - name: OTEL_RESOURCE_ATTRIBUTES - value: service.name={{ .Release.Name }},service.namespace={{ .Release.Namespace }},service.version={{ .Chart.AppVersion }},environment={{ .Values.environment | default "production" }} - name: PROVER_REAL_PROOFS value: "{{ .Values.aztec.realProofs }}" - name: PXE_PROVER_ENABLED @@ -146,10 +130,6 @@ spec: value: "{{ .Values.storage.dataStoreMapSize }}" - name: WS_DB_MAP_SIZE_KB value: "{{ .Values.storage.worldStateMapSize }}" - - name: USE_GCLOUD_LOGGING - value: "{{ .Values.telemetry.useGcloudLogging }}" - - name: OTEL_EXCLUDE_METRICS - value: "{{ .Values.telemetry.excludeMetrics }}" - name: P2P_BOOTSTRAP_NODES_AS_FULL_PEERS value: "{{ .Values.network.p2pBootstrapNodesAsFullPeers }}" - name: TEST_ACCOUNTS diff --git a/spartan/aztec-network/templates/prover-agent.yaml b/spartan/aztec-network/templates/prover-agent.yaml index d501d0b8c732..fc7e01a179b5 100644 --- a/spartan/aztec-network/templates/prover-agent.yaml +++ b/spartan/aztec-network/templates/prover-agent.yaml @@ -46,7 +46,6 @@ spec: defaultMode: 0755 initContainers: {{- include "aztec-network.combinedAllSetupContainer" . | nindent 8 }} - {{- include "aztec-network.otelResourceSetupContainer" . | nindent 8 }} - name: wait-for-prover-node {{- include "aztec-network.image" . | nindent 10 }} command: @@ -69,26 +68,17 @@ spec: volumeMounts: - name: config mountPath: /shared/config + - name: scripts + mountPath: /scripts command: - "/bin/bash" - "-c" - | + source /scripts/setup-otel-resource.sh && \ source /shared/config/service-addresses && \ - source /shared/config/otel-resource && \ node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --prover-agent env: - - name: K8S_POD_UID - valueFrom: - fieldRef: - fieldPath: metadata.uid - - name: K8S_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: K8S_NAMESPACE_NAME - valueFrom: - fieldRef: - fieldPath: metadata.namespace + {{- include "aztec-network.otelEnvVars" . | nindent 12 }} - name: AZTEC_PORT value: "{{ .Values.proverAgent.service.nodePort }}" - name: LOG_LEVEL @@ -109,10 +99,6 @@ spec: value: "{{ .Values.proverAgent.testDelayFactor }}" - name: PROVER_AGENT_PROOF_TYPES value: {{ join "," .Values.proverAgent.proofTypes | quote }} - - name: USE_GCLOUD_LOGGING - value: "{{ .Values.telemetry.useGcloudLogging }}" - - name: OTEL_EXCLUDE_METRICS - value: "{{ .Values.telemetry.excludeMetrics }}" resources: {{- toYaml .Values.proverAgent.resources | nindent 12 }} {{- end }} diff --git a/spartan/aztec-network/templates/prover-broker.yaml b/spartan/aztec-network/templates/prover-broker.yaml index 90c221bffe16..9645caea2116 100644 --- a/spartan/aztec-network/templates/prover-broker.yaml +++ b/spartan/aztec-network/templates/prover-broker.yaml @@ -112,27 +112,18 @@ spec: mountPath: /shared/contracts - name: prover-broker-data mountPath: {{ .Values.proverBroker.dataDir }} + - name: scripts + mountPath: /scripts command: - "/bin/bash" - "-c" - | + source /scripts/setup-otel-resource.sh && \ source /shared/config/service-addresses && \ source /shared/contracts/contracts.env && \ - source /shared/config/otel-resource && \ node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --prover-broker env: - - name: K8S_POD_UID - valueFrom: - fieldRef: - fieldPath: metadata.uid - - name: K8S_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: K8S_NAMESPACE_NAME - valueFrom: - fieldRef: - fieldPath: metadata.namespace + {{- include "aztec-network.otelEnvVars" . | nindent 12 }} - name: NODE_OPTIONS value: "--max-old-space-size={{ .Values.proverBroker.maxOldSpaceSize}}" - name: L1_CHAIN_ID @@ -153,10 +144,6 @@ spec: value: "{{ .Values.proverBroker.dataDir }}" - name: DATA_STORE_MAP_SIZE_KB value: "{{ .Values.storage.dataStoreMapSize }}" - - name: USE_GCLOUD_LOGGING - value: "{{ .Values.telemetry.useGcloudLogging }}" - - name: OTEL_EXCLUDE_METRICS - value: "{{ .Values.telemetry.excludeMetrics }}" resources: {{- toYaml .Values.proverBroker.resources | nindent 12 }} volumes: diff --git a/spartan/aztec-network/templates/prover-node.yaml b/spartan/aztec-network/templates/prover-node.yaml index 674661fa94c1..ab6f5d1eb310 100644 --- a/spartan/aztec-network/templates/prover-node.yaml +++ b/spartan/aztec-network/templates/prover-node.yaml @@ -135,14 +135,16 @@ spec: - /bin/bash - -c - | + source /scripts/setup-otel-resource.sh && \ source /shared/config/keys.env && \ source /shared/contracts/contracts.env && \ source /shared/config/p2p-addresses && \ source /shared/config/service-addresses && \ - source /shared/config/otel-resource && \ env && \ node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --prover-node --archiver volumeMounts: + - name: scripts + mountPath: /scripts - name: contracts-env mountPath: /shared/contracts - name: config @@ -150,22 +152,7 @@ spec: - name: prover-node-data mountPath: {{ .Values.proverNode.dataDir }} env: - - name: K8S_POD_UID - valueFrom: - fieldRef: - fieldPath: metadata.uid - - name: K8S_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: K8S_NAMESPACE_NAME - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP + {{- include "aztec-network.otelEnvVars" . | nindent 12 }} - name: NODE_OPTIONS value: "--max-old-space-size={{ .Values.proverNode.maxOldSpaceSize}}" - name: AZTEC_PORT @@ -230,10 +217,6 @@ spec: value: "{{ .Values.storage.dataStoreMapSize }}" - name: WS_DB_MAP_SIZE_KB value: "{{ .Values.storage.worldStateMapSize }}" - - name: USE_GCLOUD_LOGGING - value: "{{ .Values.telemetry.useGcloudLogging }}" - - name: OTEL_EXCLUDE_METRICS - value: "{{ .Values.telemetry.excludeMetrics }}" - name: TEST_ACCOUNTS value: "{{ .Values.aztec.testAccounts }}" {{- if .Values.blobSink.enabled }} diff --git a/spartan/aztec-network/templates/transaction-bot.yaml b/spartan/aztec-network/templates/transaction-bot.yaml index 09330adfca0d..1aa885c009b2 100644 --- a/spartan/aztec-network/templates/transaction-bot.yaml +++ b/spartan/aztec-network/templates/transaction-bot.yaml @@ -107,10 +107,12 @@ spec: - "/bin/bash" - "-c" - | + source /scripts/setup-otel-resource.sh + source /shared/config/service-addresses cat /shared/config/service-addresses + source /shared/config/keys.env - source /shared/config/otel-resource {{- if .Values.bot.nodeUrl }} export AZTEC_NODE_URL={{ .Values.bot.nodeUrl }} {{- else if .Values.network.public }} @@ -121,18 +123,7 @@ spec: echo "AZTEC_NODE_URL=${AZTEC_NODE_URL}" node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --pxe --bot env: - - name: K8S_POD_UID - valueFrom: - fieldRef: - fieldPath: metadata.uid - - name: K8S_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: K8S_NAMESPACE_NAME - valueFrom: - fieldRef: - fieldPath: metadata.namespace + {{- include "aztec-network.otelEnvVars" . | nindent 12 }} - name: AZTEC_PORT value: "{{ .Values.bot.service.nodePort }}" - name: LOG_JSON diff --git a/spartan/aztec-network/templates/validator.yaml b/spartan/aztec-network/templates/validator.yaml index 8e06f66ded9a..6aff400795d9 100644 --- a/spartan/aztec-network/templates/validator.yaml +++ b/spartan/aztec-network/templates/validator.yaml @@ -78,11 +78,11 @@ spec: - "/bin/bash" - "-c" - | + source /scripts/setup-otel-resource.sh && \ source /shared/contracts/contracts.env && \ source /shared/config/p2p-addresses && \ source /shared/config/service-addresses && \ source /shared/config/keys.env && \ - source /shared/config/otel-resource && \ env && \ node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --node --archiver --sequencer startupProbe: @@ -102,6 +102,8 @@ spec: timeoutSeconds: 30 failureThreshold: 3 volumeMounts: + - name: scripts + mountPath: /scripts - name: contracts-env mountPath: /shared/contracts - name: config @@ -109,22 +111,7 @@ spec: - name: validator-data mountPath: {{ .Values.validator.dataDir }} env: - - name: K8S_POD_UID - valueFrom: - fieldRef: - fieldPath: metadata.uid - - name: K8S_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - name: K8S_NAMESPACE_NAME - valueFrom: - fieldRef: - fieldPath: metadata.namespace + {{- include "aztec-network.otelEnvVars" . | nindent 12 }} - name: NODE_OPTIONS value: "--max-old-space-size={{ .Values.validator.maxOldSpaceSize}}" - name: AZTEC_PORT @@ -181,10 +168,6 @@ spec: value: "{{ .Values.storage.dataStoreMapSize }}" - name: WS_DB_MAP_SIZE_KB value: "{{ .Values.storage.worldStateMapSize }}" - - name: USE_GCLOUD_LOGGING - value: "{{ .Values.telemetry.useGcloudLogging }}" - - name: OTEL_EXCLUDE_METRICS - value: "{{ .Values.telemetry.excludeMetrics }}" - name: TEST_ACCOUNTS value: "{{ .Values.aztec.testAccounts }}" - name: P2P_BOOTSTRAP_NODES_AS_FULL_PEERS