Skip to content

Commit 5c6a1ca

Browse files
committed
feat: add environmental variables for OTEL exporter
1 parent aa98ea7 commit 5c6a1ca

File tree

4 files changed

+15
-21
lines changed

4 files changed

+15
-21
lines changed

charts/gitops-runtime/templates/_components/cap-app-proxy/environment-variables/_main-container.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,14 @@ CACHE_PASSWORD:
222222
name: gitops-runtime-redis
223223
key: auth
224224
{{ include "codefresh-gitops-runtime.get-proxy-env-vars" . }}
225+
226+
{{- $serviceVersion := printf "%s@%s" (index .Values "app-proxy" "image" "tag") (index .Values "app-proxy" "image" "digest") -}}
227+
{{- $accountId := .Values.global.codefresh.accountId -}}
228+
{{- $runtimeName := .Values.global.runtime.name -}}
229+
{{- $otelResourceAttributes := printf "service.name=app-proxy,service.version=%s,cf.account.id=%s,cf.gitops.runtime.name=%s" $serviceVersion $accountId $runtimeName -}}
230+
OTEL_RESOURCE_ATTRIBUTES: {{- $otelResourceAttributes -}}
231+
OTEL_EXPORTER_OTLP_HEADERS: "Authorization=Bearer $(RUNTIME_TOKEN)"
232+
225233
{{- end -}}
226234

227235
{{/*

charts/gitops-runtime/templates/_components/gitops-operator/_env.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,15 @@ NAMESPACE:
4040
valueFrom:
4141
fieldRef:
4242
fieldPath: metadata.namespace
43-
RUNTIME_VERSION:
43+
RUNTIME_VERSION:
4444
valueFrom:
4545
configMapKeyRef:
4646
name: codefresh-cm
4747
key: version
48+
{{- $serviceVersion := printf "%s@%s" (index .Values "gitops-operator" "image" "tag") (index .Values "gitops-operator" "image" "digest") -}}
49+
{{- $accountId := .Values.global.codefresh.accountId -}}
50+
{{- $runtimeName := .Values.global.runtime.name -}}
51+
{{- $otelResourceAttributes := printf "service.name=gitops-operator,service.version=%s,cf.account.id=%s,cf.gitops.runtime.name=%s" $serviceVersion $accountId $runtimeName -}}
52+
OTEL_RESOURCE_ATTRIBUTES: {{- $otelResourceAttributes -}}
53+
OTEL_EXPORTER_OTLP_HEADERS: "Authorization=Bearer $(CF_TOKEN)"
4854
{{- end -}}

charts/gitops-runtime/templates/app-proxy/deployment.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,4 @@
2323
{{- $_ := set $appProxyContext.Values.initContainer "extraVolumeMounts" $initContainerExtraVolumeMounts }}
2424
{{- end }}
2525

26-
{{- $serviceVersion := printf "%s@%s" (index .Values "app-proxy" "image" "tag") (index .Values "app-proxy" "image" "digest") -}}
27-
{{- $accountId := .Values.global.codefresh.accountId -}}
28-
{{- $runtimeName := .Values.global.runtime.name -}}
29-
{{- $otelResourceAttributes := printf "service.name=app-proxy,service.version=%s,cf.account.id=%s,cf.gitops.runtime.name=%s" $serviceVersion $accountId $runtimeName -}}
30-
{{- $__ := set $appProxyContext.Values.env "OTEL_RESOURCE_ATTRIBUTES" $otelResourceAttributes -}}
31-
32-
{{- $token := .Values.global.codefresh.userToken.token -}}
33-
{{- $otelExporterOtlpHeaders := printf "Authorization=Bearer %s" $token -}}
34-
{{- $___ := set $appProxyContext.Values.env "OTEL_EXPORTER_OTLP_HEADERS" $otelExporterOtlpHeaders -}}
35-
3626
{{- include "cap-app-proxy.resources.deployment" $appProxyContext }}

charts/gitops-runtime/templates/gitops-operator/deployment.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,4 @@
2525
{{- $_ := set $context.Values.global.codefresh.tls.caCerts.secretKeyRef "key" ($context.Values.global.codefresh.tls.caCerts.secret.create | ternary (default "ca-bundle.crt" $context.Values.global.codefresh.tls.caCerts.secret.key) $context.Values.global.codefresh.tls.caCerts.secretKeyRef.key) }}
2626
{{- end }}
2727

28-
{{- $serviceVersion := printf "%s@%s" (index .Values "gitops-operator" "image" "tag") (index .Values "gitops-operator" "image" "digest") -}}
29-
{{- $accountId := .Values.global.codefresh.accountId -}}
30-
{{- $runtimeName := .Values.global.runtime.name -}}
31-
{{- $otelResourceAttributes := printf "service.name=gitops-operator,service.version=%s,cf.account.id=%s,cf.gitops.runtime.name=%s" $serviceVersion $accountId $runtimeName -}}
32-
{{- $__ := set $context.Values.env "OTEL_RESOURCE_ATTRIBUTES" $otelResourceAttributes -}}
33-
34-
{{- $token := .Values.global.codefresh.userToken.token -}}
35-
{{- $otelExporterOtlpHeaders := printf "Authorization=Bearer %s" $token -}}
36-
{{- $___ := set $context.Values.env "OTEL_EXPORTER_OTLP_HEADERS" $otelExporterOtlpHeaders -}}
37-
3828
{{- include "gitops-operator.resources.deployment" $context }}

0 commit comments

Comments
 (0)