DataDog / datadog-operator

Kubernetes Operator for Datadog Resources
Apache License 2.0
303 stars 105 forks source link

Allow the ability to disable or specify custom host ports for OTLP #1440

Closed mrdoggopat closed 1 month ago

mrdoggopat commented 1 month ago

What does this PR do?

Add the ability to disable host ports for OTLP and specify custom host ports.

Motivation

CECO-663 https://github.com/DataDog/datadog-operator/issues/903

Anything else we should know when reviewing? N/A

Are there minimum versions of the Datadog Agent and/or Cluster Agent required? N/A

Describe your test plan

Play around with the following DatadogAgent configuration:

spec:
  features:
    otlp:
      receiver:
        protocols:
          grpc:
            enabled: true
            hostPortConfig:
              enabled: <true or false>
              hostPort: <host port>
          http:
            enabled: true
            hostPortConfig:
              enabled: <true or false>
              hostPort: <host port>

Run kubectl describe pod <node agent pod> and see if the behavior reflects.

For running the node agent in a single container:

spec:
  global:
    containerStrategy: single
  features:
    otlp:
      receiver:
        protocols:
          grpc:
            enabled: true
            hostPortConfig:
              enabled: <true or false>
              hostPort: <host port>
          http:
            enabled: true
            hostPortConfig:
              enabled: <true or false>
              hostPort: <host port>

Run kubectl describe pod <node agent pod> and see if the behavior reflects.

Checklist

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 49.01%. Comparing base (0d97b8a) to head (5690a73).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440/graphs/tree.svg?width=650&height=150&src=pr&token=b1U0O5wQwj&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog)](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) ```diff @@ Coverage Diff @@ ## main #1440 +/- ## ========================================== + Coverage 48.89% 49.01% +0.12% ========================================== Files 223 223 Lines 19455 19501 +46 ========================================== + Hits 9513 9559 +46 Misses 9453 9453 Partials 489 489 ``` | [Flag](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | `49.01% <100.00%> (+0.12%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [api/datadoghq/v2alpha1/datadogagent\_default.go](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440?src=pr&el=tree&filepath=api%2Fdatadoghq%2Fv2alpha1%2Fdatadogagent_default.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-YXBpL2RhdGFkb2docS92MmFscGhhMS9kYXRhZG9nYWdlbnRfZGVmYXVsdC5nbw==) | `89.74% <100.00%> (+0.36%)` | :arrow_up: | | [api/datadoghq/v2alpha1/datadogagent\_types.go](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440?src=pr&el=tree&filepath=api%2Fdatadoghq%2Fv2alpha1%2Fdatadogagent_types.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-YXBpL2RhdGFkb2docS92MmFscGhhMS9kYXRhZG9nYWdlbnRfdHlwZXMuZ28=) | `100.00% <ø> (ø)` | | | [api/datadoghq/v2alpha1/test/builder.go](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440?src=pr&el=tree&filepath=api%2Fdatadoghq%2Fv2alpha1%2Ftest%2Fbuilder.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-YXBpL2RhdGFkb2docS92MmFscGhhMS90ZXN0L2J1aWxkZXIuZ28=) | `91.94% <100.00%> (+0.11%)` | :arrow_up: | | [...al/controller/datadogagent/feature/otlp/feature.go](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440?src=pr&el=tree&filepath=internal%2Fcontroller%2Fdatadogagent%2Ffeature%2Fotlp%2Ffeature.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-aW50ZXJuYWwvY29udHJvbGxlci9kYXRhZG9nYWdlbnQvZmVhdHVyZS9vdGxwL2ZlYXR1cmUuZ28=) | `63.79% <100.00%> (+4.56%)` | :arrow_up: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog). Last update [0d97b8a...5690a73](https://app.codecov.io/gh/DataDog/datadog-operator/pull/1440?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog).