Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add port names to agent service #468

Merged
merged 1 commit into from
Apr 20, 2022
Merged

Conversation

khewonc
Copy link
Contributor

@khewonc khewonc commented Apr 11, 2022

What does this PR do?

Add port names to the agent service.

Motivation

When enabling both dogstatsd and APM, the agent service tries to expose 2 unnamed ports, which is not allowed by Kubernetes as it is considered ambiguous. The operator logs give the following error:

{"level":"ERROR","ts":"2022-04-11T02:23:42Z","logger":"controller-runtime.manager.controller.datadogagent","msg":"Reconciler error","reconciler group":"datadoghq.com","reconciler kind":"DatadogAgent","name":"datadog","namespace":"default","error":"Service \"datadog-agent\" is invalid: [spec.ports[0].name: Required value, spec.ports[1].name: Required value]"}

Describe your test plan

Spin up a DatadogAgent with APM enabled in the agent spec (agent.apm.enabled=true) so that both dogstatsd and APM are enabled:

spec:
  agent:
    apm:
      enabled: true

If needed, to force creation of the agent service in Kubernetes v1.21+, enable agent.localService.forceLocalServiceEnable=true:

spec:
  agent:
    localService:
      forceLocalServiceEnable: true

There shouldn't be any error in the operator logs about creating the agent service. The service should be created exposing both dogstatsd and APM ports:

> kubectl describe svc 
NAME                                   TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)             AGE
datadog-agent                          ClusterIP   <cluster-ip>   <none>        8125/UDP,8126/TCP   2d19h

@khewonc khewonc added the bug Something isn't working label Apr 11, 2022
@khewonc khewonc added this to the v0.8.0 milestone Apr 11, 2022
@khewonc khewonc requested a review from a team as a code owner April 11, 2022 15:00
@khewonc khewonc merged commit d0f2b27 into main Apr 20, 2022
@khewonc khewonc deleted the khewonc/add-agent-service-port-names branch April 20, 2022 12:36
khewonc added a commit that referenced this pull request Apr 20, 2022
JacksonDavenport added a commit that referenced this pull request Apr 26, 2022
…v vars

Remove POD_X_AS_TAGS as no longer defaulting to {}

Test cases for various metadata as tags configs

Move the xyzAsTags to the common set of environment variables

Revert "Move the xyzAsTags to the common set of environment variables"

This reverts commit 11a8cfa.

Update tests to use NodeAgentConfig/EnvVar rather than generics

Add port names to agent service (#468)

Update default DCA image to 1.19.0 (#470)

Share common structs in common/v1 and adds missing fields to v2alpha1 (#438)

fix: k8s version detection for agent service (#472)

Rename Test_getEnvVarsForMetadataAsTags function
JacksonDavenport added a commit that referenced this pull request Apr 27, 2022
…v vars (#471)

Remove POD_X_AS_TAGS as no longer defaulting to {}

Test cases for various metadata as tags configs

Move the xyzAsTags to the common set of environment variables

Revert "Move the xyzAsTags to the common set of environment variables"

This reverts commit 11a8cfa.

Update tests to use NodeAgentConfig/EnvVar rather than generics

Add port names to agent service (#468)

Update default DCA image to 1.19.0 (#470)

Share common structs in common/v1 and adds missing fields to v2alpha1 (#438)

fix: k8s version detection for agent service (#472)

Rename Test_getEnvVarsForMetadataAsTags function

Co-authored-by: Celene Chang <celene@datadoghq.com>
JacksonDavenport added a commit that referenced this pull request Apr 28, 2022
…v vars (#471)

Remove POD_X_AS_TAGS as no longer defaulting to {}

Test cases for various metadata as tags configs

Move the xyzAsTags to the common set of environment variables

Revert "Move the xyzAsTags to the common set of environment variables"

This reverts commit 11a8cfa.

Update tests to use NodeAgentConfig/EnvVar rather than generics

Add port names to agent service (#468)

Update default DCA image to 1.19.0 (#470)

Share common structs in common/v1 and adds missing fields to v2alpha1 (#438)

fix: k8s version detection for agent service (#472)

Rename Test_getEnvVarsForMetadataAsTags function

Co-authored-by: Celene Chang <celene@datadoghq.com>
JacksonDavenport added a commit that referenced this pull request Apr 28, 2022
…v vars (#471) (#475)

Remove POD_X_AS_TAGS as no longer defaulting to {}

Test cases for various metadata as tags configs

Move the xyzAsTags to the common set of environment variables

Revert "Move the xyzAsTags to the common set of environment variables"

This reverts commit 11a8cfa.

Update tests to use NodeAgentConfig/EnvVar rather than generics

Add port names to agent service (#468)

Update default DCA image to 1.19.0 (#470)

Share common structs in common/v1 and adds missing fields to v2alpha1 (#438)

fix: k8s version detection for agent service (#472)

Rename Test_getEnvVarsForMetadataAsTags function

Co-authored-by: Celene Chang <celene@datadoghq.com>

Co-authored-by: Celene Chang <celene@datadoghq.com>
@khewonc khewonc mentioned this pull request May 17, 2022
celenechang pushed a commit that referenced this pull request May 18, 2022
celenechang added a commit that referenced this pull request May 18, 2022
…v vars (#471) (#475)

Remove POD_X_AS_TAGS as no longer defaulting to {}

Test cases for various metadata as tags configs

Move the xyzAsTags to the common set of environment variables

Revert "Move the xyzAsTags to the common set of environment variables"

This reverts commit 11a8cfa.

Update tests to use NodeAgentConfig/EnvVar rather than generics

Add port names to agent service (#468)

Update default DCA image to 1.19.0 (#470)

Share common structs in common/v1 and adds missing fields to v2alpha1 (#438)

fix: k8s version detection for agent service (#472)

Rename Test_getEnvVarsForMetadataAsTags function

Co-authored-by: Celene Chang <celene@datadoghq.com>

Co-authored-by: Celene Chang <celene@datadoghq.com>
celenechang added a commit that referenced this pull request May 18, 2022
…v vars (#471)

Remove POD_X_AS_TAGS as no longer defaulting to {}

Test cases for various metadata as tags configs

Move the xyzAsTags to the common set of environment variables

Revert "Move the xyzAsTags to the common set of environment variables"

This reverts commit 11a8cfa.

Update tests to use NodeAgentConfig/EnvVar rather than generics

Add port names to agent service (#468)

Update default DCA image to 1.19.0 (#470)

Share common structs in common/v1 and adds missing fields to v2alpha1 (#438)

fix: k8s version detection for agent service (#472)

Rename Test_getEnvVarsForMetadataAsTags function

Co-authored-by: Celene Chang <celene@datadoghq.com>
khewonc added a commit that referenced this pull request May 19, 2022
* release v0.8.0-rc.1

* [defaulting/images] Update agent to 7.35.0 (#465)

* [controllers/datadogagent/utils] Fix process collection nil check (#466)

* [examples] Fix datadog-agent-secret-backend (#467)

* Add port names to agent service (#468)

* Update default DCA image to 1.19.0 (#470)

* release v0.8.0-rc.2

* fix: k8s version detection for agent service (#472) (#473)

* Add NodeLabelsAsTags and NamespaceLabelsAsTags, remove default Pod env vars (#471) (#475)

Remove POD_X_AS_TAGS as no longer defaulting to {}

Test cases for various metadata as tags configs

Move the xyzAsTags to the common set of environment variables

Revert "Move the xyzAsTags to the common set of environment variables"

This reverts commit 11a8cfa.

Update tests to use NodeAgentConfig/EnvVar rather than generics

Add port names to agent service (#468)

Update default DCA image to 1.19.0 (#470)

Share common structs in common/v1 and adds missing fields to v2alpha1 (#438)

fix: k8s version detection for agent service (#472)

Rename Test_getEnvVarsForMetadataAsTags function

Co-authored-by: Celene Chang <celene@datadoghq.com>

Co-authored-by: Celene Chang <celene@datadoghq.com>

* release v0.8.0-rc.3

* Default Agent version to 7.35.2 (#480)

* release v0.8.0-rc.4

* release v0.8.0

Co-authored-by: David Ortiz <david.ortiz@datadoghq.com>
Co-authored-by: Cedric Lamoriniere <cedric.lamoriniere@datadoghq.com>
Co-authored-by: JacksonDavenport <jakdavenport@yahoo.com>
Co-authored-by: Celene Chang <celene@datadoghq.com>
Co-authored-by: Paul Cacheux <paul.cacheux@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants