Description
When running in K8S with ipv6 addresses, client fails with error like Invalid "kubernetes" data ("kubernetes_service_host"): "fd95:b6e3:daad::1"
Expected Behavior
Agent should accept ipv6 addresses
Troubleshooting or NR Diag results
After looking at code and at environment, I found that K8S injects the following variables:
...
KUBERNETES_SERVICE_HOST=fd95:b6e3:daad::1
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_ADDR=fd95:b6e3:daad::1
...
The error happens in KubernetesUtilization class in detection process:
Detection https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/common/utilization.py#L153-L157 consist of fetching the data (reading envvar KUBERNETES_SERVICE_HOST) then validating it for correctness, one of the steps https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/common/utilization.py#L127 is checking valid chars https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/common/utilization.py#L27 , the agent does not expect : and fails
Steps to Reproduce
Run in K8S with ipv6
Your Environment
EKS with ipv6
Additional context
Description
When running in K8S with ipv6 addresses, client fails with error like
Invalid "kubernetes" data ("kubernetes_service_host"): "fd95:b6e3:daad::1"Expected Behavior
Agent should accept ipv6 addresses
Troubleshooting or NR Diag results
After looking at code and at environment, I found that K8S injects the following variables:
The error happens in
KubernetesUtilizationclass in detection process:Detection https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/common/utilization.py#L153-L157 consist of fetching the data (reading envvar
KUBERNETES_SERVICE_HOST) then validating it for correctness, one of the steps https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/common/utilization.py#L127 is checking valid chars https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/common/utilization.py#L27 , the agent does not expect:and failsSteps to Reproduce
Run in K8S with ipv6
Your Environment
EKS with ipv6
Additional context