Build label propagation enables you to provide build and version metadata information to the injected OneAgent about the newly deployed pods. This information is then visible on the Properties and tags section of your entities pages.
You can reference the value of a metadata field in an environment variable.
env:- name: MY_POD_NAMESPACEvalueFrom:fieldRef:fieldPath: metadata.namespace
Then OneAgent injects into the newly deployed pods and collects the metadata provided via environment variables.
To enable build label propagation, you need to set feature.dynatrace.com/label-version-detection to true in DynaKube. Note that since enabling build label propagation requires webhook injection, it only works with applicationMonitoring and cloudNativeFullStack deployments.
apiVersion: dynatrace.com/v1beta5kind: DynaKubemetadata:name: dynakubenamespace: dynatraceannotations:feature.dynatrace.com/label-version-detection: "true"...spec:oneAgent:cloudNativeFullStack: {}
DT_RELEASE_VERSION environment variable gets the value from metadata.labels['app.kubernetes.io/version'].DT_RELEASE_PRODUCT environment variable gets the value from metadata.labels['app.kubernetes.io/part-of'].For example, if your application has the following pod:
apiVersion: v1kind: Podmetadata:...labels:app.kubernetes.io/version: "1.0.0"app.kubernetes.io/part-of: "store"spec:...
the value of the labels is added to the environment variables of the injected containers:
apiVersion: v1kind: Podmetadata:...labels:app.kubernetes.io/version: "1.0.0"app.kubernetes.io/part-of: "Store"spec:...containers:- name: app...env:- name: "DT_RELEASE_VERSION"valueFrom:fieldRef:fieldPath: metadata.labels['app.kubernetes.io/version']- name: "DT_RELEASE_PRODUCT"valueFrom:fieldRef:fieldPath: metadata.labels['app.kubernetes.io/part-of']
If the DT_RELEASE_VERSION or DT_RELEASE_PRODUCT environment variables are already set on the container before the OneAgent injection, they will not be overwritten.
You can annotate your namespace to provide further mappings or overrule the defaults for pods within that namespace.
fieldPath.fieldPath is the same as for fieldRef.Example to overwrite the default values for version and product, and enable stage and build-version:
annotations:mapping.release.dynatrace.com/version: "metadata.annotations['my-version']"mapping.release.dynatrace.com/product: "metadata.labels['app.kubernetes.io/name']"mapping.release.dynatrace.com/stage: "metadata.namespace"mapping.release.dynatrace.com/build-version: "metadata.labels['release.dynatrace.com/stage']"
Each of these annotations configures a different environment variable:
| Holds the If this annotation is missing, mapping falls back to the default behavior. |
| Holds the If this annotation is missing, mapping falls back to the default behavior. |
| Holds the |
| Holds the |
The values aren't validated by Dynatrace Operator or the webhook, so make sure they are valid.