Skip to content

Commit 4749653

Browse files
committed
feat: add otel attributes to temlates
1 parent 31012b7 commit 4749653

File tree

6 files changed

+61
-0
lines changed

6 files changed

+61
-0
lines changed

charts/gitops-runtime/templates/_components/internal-router/_deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ spec:
3434
securityContext:
3535
{{- toYaml .Values.securityContext | nindent 12 }}
3636
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
37+
{{- $accountId := .Values.global.codefresh.accountId -}}
38+
{{- $runtimeName := .Values.global.runtime.name -}}
39+
{{- $otelResourceAttributes := printf "service.name=app-proxy,cf.account.id=%s,cf.gitops.runtime.name=%s" $accountId $runtimeName -}}
40+
{{- $_ := set .Values.env "OTEL_RESOURCE_ATTRIBUTES" $otelResourceAttributes }}
41+
{{- $_ := set .Values.env "A_RUNTIME_TOKEN" (dict "valueFrom" (dict "secretKeyRef" (dict "name" "codefresh-token" "key" "token" "optional" true ))) }}
42+
{{- $_ := set .Values.env "OTEL_EXPORTER_OTLP_HEADERS" "Authorization=$(A_RUNTIME_TOKEN)" }}
3743
{{- include "codefresh-gitops-runtime.components.common_helpers.container-templates.env-vars" .Values.env | nindent 10 }}
3844
imagePullPolicy: {{ .Values.image.pullPolicy }}
3945
ports:

charts/gitops-runtime/templates/argo-gateway/_env.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "
2020
CODEFRESH_SSL_CERT_PATH: {{ printf "/app/config/codefresh-tls-certs/%s" $secretKey }}
2121
{{- end }}
2222

23+
{{- $accountId := .Values.global.codefresh.accountId -}}
24+
{{- $runtimeName := .Values.global.runtime.name -}}
25+
{{- $otelResourceAttributes := printf "service.name=argo-gateway,cf.account.id=%s,cf.gitops.runtime.name=%s" $accountId $runtimeName -}}
26+
OTEL_RESOURCE_ATTRIBUTES: {{ $otelResourceAttributes }}
27+
A_CODEFRESH_TOKEN:
28+
valueFrom:
29+
secretKeyRef:
30+
key: token
31+
name: codefresh-token
32+
OTEL_EXPORTER_OTLP_HEADERS: "Authorization=$(A_CODEFRESH_TOKEN)"
33+
2334
{{- end }}
2435

2536
{{- define "argo-gateway.resources.environment-variables.defaults" -}}

charts/gitops-runtime/templates/event-reporters/cluster-event-reporter/_env.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "
2020
CODEFRESH_SSL_CERT_PATH: {{ printf "/app/config/codefresh-tls-certs/%s" $secretKey }}
2121
{{- end }}
2222

23+
{{- $accountId := .Values.global.codefresh.accountId -}}
24+
{{- $runtimeName := .Values.global.runtime.name -}}
25+
{{- $otelResourceAttributes := printf "service.name=cluster-event-reporter,cf.account.id=%s,cf.gitops.runtime.name=%s" $accountId $runtimeName -}}
26+
OTEL_RESOURCE_ATTRIBUTES: {{ $otelResourceAttributes }}
27+
A_CODEFRESH_TOKEN:
28+
valueFrom:
29+
secretKeyRef:
30+
key: token
31+
name: codefresh-token
32+
OTEL_EXPORTER_OTLP_HEADERS: "Authorization=$(A_CODEFRESH_TOKEN)"
33+
2334
{{- end }}
2435

2536
{{- define "cluster-event-reporter.resources.environment-variables.defaults" -}}

charts/gitops-runtime/templates/event-reporters/runtime-event-reporter/_env.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "
2020
CODEFRESH_SSL_CERT_PATH: {{ printf "/app/config/codefresh-tls-certs/%s" $secretKey }}
2121
{{- end }}
2222

23+
{{- $accountId := .Values.global.codefresh.accountId -}}
24+
{{- $runtimeName := .Values.global.runtime.name -}}
25+
{{- $otelResourceAttributes := printf "service.name=runtime-event-reporter,cf.account.id=%s,cf.gitops.runtime.name=%s" $accountId $runtimeName -}}
26+
OTEL_RESOURCE_ATTRIBUTES: {{ $otelResourceAttributes }}
27+
A_CODEFRESH_TOKEN:
28+
valueFrom:
29+
secretKeyRef:
30+
key: token
31+
name: codefresh-token
32+
OTEL_EXPORTER_OTLP_HEADERS: "Authorization=$(A_CODEFRESH_TOKEN)"
33+
2334
{{- end }}
2435

2536
{{- define "runtime-event-reporter.resources.environment-variables.defaults" -}}

charts/gitops-runtime/templates/hooks/pre-install/_env.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ NAMESPACE:
2323
fieldRef:
2424
fieldPath: metadata.namespace
2525
REQUIRED_VERSION_CONSTRAINT: ">=2.12 <3.1"
26+
{{- $accountId := .Values.global.codefresh.accountId -}}
27+
{{- $runtimeName := .Values.global.runtime.name -}}
28+
{{- $otelResourceAttributes := printf "service.name=pre-install,cf.account.id=%s,cf.gitops.runtime.name=%s" $accountId $runtimeName -}}
29+
OTEL_RESOURCE_ATTRIBUTES: {{ $otelResourceAttributes }}
30+
A_RUNTIME_TOKEN:
31+
valueFrom:
32+
secretKeyRef:
33+
name: codefresh-token
34+
key: token
35+
optional: true
36+
OTEL_EXPORTER_OTLP_HEADERS: "Authorization=$(A_RUNTIME_TOKEN)"
2637
{{- end -}}
2738

2839
{{- define "installer.validate-values.environment-variables" -}}

charts/gitops-runtime/templates/hooks/pre-uninstall/_env.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ SSL_CERT_FILE: /app/config/codefresh-tls-certs/{{ $customCASecretKey }}
1515
{{- end }}
1616
USER_TOKEN:
1717
{{- include "codefresh-gitops-runtime.installation-token-env-var-value" . | nindent 2 }}
18+
{{- $accountId := .Values.global.codefresh.accountId -}}
19+
{{- $runtimeName := .Values.global.runtime.name -}}
20+
{{- $otelResourceAttributes := printf "service.name=pre-uninstall,cf.account.id=%s,cf.gitops.runtime.name=%s" $accountId $runtimeName -}}
21+
OTEL_RESOURCE_ATTRIBUTES: {{ $otelResourceAttributes }}
22+
A_RUNTIME_TOKEN:
23+
valueFrom:
24+
secretKeyRef:
25+
name: codefresh-token
26+
key: token
27+
optional: true
28+
OTEL_EXPORTER_OTLP_HEADERS: "Authorization=$(A_RUNTIME_TOKEN)"
1829
{{- end -}}
1930

2031
{{- define "installer.delete-runtime-from-platform.environment-variables" -}}

0 commit comments

Comments
 (0)