DataDog / datadog-operator

Kubernetes Operator for Datadog Resources
Apache License 2.0
301 stars 104 forks source link

Configuration of Tag Extraction from Node Labels #274

Open arzarif opened 3 years ago

arzarif commented 3 years ago

Datadog supports the extraction of tags from various sources: pod labels, pod annotations, and node labels (see https://docs.datadoghq.com/agent/kubernetes/tag/?tab=containerizedagent).

Currently, it appears that the operator only supports the configuration of tag extraction via pod labels and pod annotations via agent.config.podLabelsAsTags and agent.config.podAnnotationsAsTags, respectively. Is there a reason why something like agent.config.nodeLabelsAsTags doesn't exist?

jketcham commented 2 years ago

I would also love to see agent.config.nodeLabelsAsTags specifically, but also all the options on the page @arzarif linked to.

Would adding support just be a matter of adding those additional values to datadogagent_types.go, datadogagent_default.go, utils.go and const.go (in addition to updating the relevant tests and docs)?

As a work around for now, I'm just adding the relevent env vars directly to the agent config, like:

spec:
  agent:
    config:
      env:
      - name: DD_KUBERNETES_NODE_LABELS_AS_TAGS
        value: '{"app": "kube_node_app"}'