apache / apisix-ingress-controller

APISIX Ingress Controller for Kubernetes
https://apisix.apache.org/
Apache License 2.0
998 stars 342 forks source link

request help: Datadog plugin config #2264

Open redhandpl opened 2 months ago

redhandpl commented 2 months ago

Issue description

HI, I'm using Apisix chart 2.8.1 with Apisix 3.9.1 and cannot create metadata for DataDog plugin. Following https://github.com/apache/apisix-ingress-controller/issues/2125#issuecomment-1890984319 I downgraded to Apisix 3.7 and unfortunately it doesn't work either.

In both cases I'm using below code.

apiVersion: apisix.apache.org/v2
kind: ApisixGlobalRule
metadata:
  name: global
spec:
  plugins:
  - name: datadog
    enable: true
    config:
      host: "datadog-agent.datadog.svc.cluster.local"
      port: 8125
      namespace: "apisix"

This adds global rule

❯ curl "http://127.0.0.1:9180/apisix/admin/global_rules/" -H 'X-API-KEY: THEKEY'
{"total":1,"list":[{"key":"/apisix/global_rules/cd935c2f","value":{"id":"cd935c2f","plugins":{"datadog":{"port":8125,"prefer_name":true,"buffer_duration":60,"inactive_timeout":5,"retry_delay":1,"namespace":"apisix","name":"datadog","batch_max_size":1000,"max_retry_count":0,"host":"datadog-agent.datadog.svc.cluster.local"}},"create_time":1720782046,"update_time":1720783721},"modifiedIndex":641,"createdIndex":488}]}

But not the metedata

❯ curl http://127.0.0.1:9180/apisix/admin/plugin_metadata/ -H 'X-API-KEY: THEKEY'
{"total":0,"list":[]}

And in logs I still see

2024/07/12 11:36:22 [error] 51#51: *6297 [lua] datadog.lua:172: send_metric_over_udp(): failed to report req body size to dogstatsd server: host[127.0.0.1] port[8125] err: connection refused, context: ngx.timer, client: 10.103.10.44, server: 0.0.0.0:9080

Adding plugin-metadata-config-map, does not make any difference

kind: ConfigMap
metadata:
  name: plugin-metadata-config-map
data:
  config.yaml: |
    - cluster: default
      plugins:
      - name: datadog
        metadata:
          host: "datadog-agent.datadog.svc.cluster.local"
          port: 8125
          namespace: "apisix"

I also tried using ApisixPluginConfig CRD and proper config line in ApisixRoute. This doesn't work as well.

For now I have to manually call API by

❯ curl http://127.0.0.1:9180/apisix/admin/plugin_metadata/datadog -H 'X-API-KEY: THEKEY -X PUT -d '
{
    "host": "datadog-agent.datadog.svc.cluster.local",
    "port": 8125,
    "constant_tags": [
        "source:dev",
        "service:apisix"
    ],
    "namespace": "apisix"
}'

How can I achieve this by using CRD/configmap?

mfractal commented 1 month ago

i've run into this exact issue as well. Also posted in slack

I've zeroed in on the problem here

So far haven't heard back from the team and as i see this issue is also ignored.