opentelemetry-helm-charts
opentelemetry-helm-charts copied to clipboard
otel demo env schema supports extracting k8s metadata.
In some scenarios, we want to add some Pod and container fields into OTEL_RESOURCE_ATTRIBUTES
enviroment in some components, like namespace name, node name, pod name, which can help us understand a service's running metadata and also show the span attrubute's usage scenarios.
a demo values.yaml like:
components:
adService:
enabled: true
servicePort: 8080
env:
- name: OTEL_K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: OTEL_K8S_CPU_REQUEST
valueFrom:
resourceFieldRef:
containerName: test-container
resource: requests.cpu
- name: OTEL_RESOURCE_ATTRIBUTES
value: k8s.namespace.name=$(OTEL_K8S_NAMESPACE),k8s.cpu.requests=$(OTEL_K8S_CPU_REQUEST)
current values.yaml
schema only support name
value
in env
section:
"Env": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"name"
],
"title": "Env"
}
I propose to add env.valueFrom into the schema for catching the feature described above.
@TylerHelmuth @wph95 since there are many microservice in otel-demo, we can add a default env setion to handle the specific values extracted from k8s metadata and I can help with the implementation of the custom default env section.
#302
@Frapschen so the goal is to be able to set environment variables using downward api?
@Frapschen so the goal is to be able to set environment variables using downward api?
yes
Closed as completed in https://github.com/open-telemetry/opentelemetry-helm-charts/pull/302