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

[CECO-1106] DDA config for Admission Controller sidecar injection using selector and profile #1209

Merged

Conversation

kisungyi92
Copy link
Collaborator

@kisungyi92 kisungyi92 commented May 29, 2024

What does this PR do?

This PR is following up PR #1207 adding selectors and profiles.

Motivation

CECO-1067

Additional Notes

Anything else we should know when reviewing?

Minimum Agent Versions

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

  • Agent: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

Test based on the release v1.6.0

  • Run DDA with selectors.objectSelector option in admissionController.agentSidecarInjection.
  • Test selectors.namespaceSelector with same structure.
  features:
        selectors:
        - objectSelector:
            matchLabels:
              "testLabel": "testValue"
  features:
        selectors:
        - namespaceSelector:
            matchLabels:
              "testLabel": "testValue"
  • Check that the DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_SELECTORS is set to correct map structure.
  • Run command : kubectl describe deploy datadog-cluster-agent | grep -i DD_ADMISSION_CONTROLLER_AGENT_SIDECAR
Result #1
      DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_SELECTORS:              [{"objectSelector":{"matchLabels":{"testLabel":"testValue"}}}]
Result #2
      DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_SELECTORS:              [{"namespaceSelector":{"matchLabels":{"testLabel":"testValue"}}}]

  • Next, test DDA with profiles option in admissionController.agentSidecarInjection.
  features:
    admissionController:
      agentSidecarInjection:
        enabled: true
        provider: "fargate"
        profiles:
        - env:
          - name: DD_PROCESS_AGENT_PROCESS_COLLECTION_ENABLED
            value: "true"
          resources:
            requests:
              cpu: "400m"
              memory: "256Mi"
            limits:
              cpu: "800m"
              memory: "512Mi"
  • Check that the DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_PROFILES is set to correct map structure.
  • Run command : kubectl describe deploy datadog-cluster-agent | grep -i DD_ADMISSION_CONTROLLER_AGENT_SIDECAR
Result : 
     DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_PROFILES:               [{"env":[{"name":"DD_PROCESS_AGENT_PROCESS_COLLECTION_ENABLED","value":"true"}],"resources":{"limits":{"cpu":"800m","memory":"512Mi"},"requests":{"cpu":"400m","memory":"256Mi"}}}]

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label

@kisungyi92 kisungyi92 added the enhancement New feature or request label May 29, 2024
@kisungyi92 kisungyi92 added this to the v1.7.0 milestone May 29, 2024
@kisungyi92 kisungyi92 requested review from a team as code owners May 29, 2024 23:28
@codecov-commenter
Copy link

codecov-commenter commented May 29, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 59.53%. Comparing base (2d393ee) to head (d107ce5).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1209      +/-   ##
==========================================
+ Coverage   59.33%   59.53%   +0.20%     
==========================================
  Files         176      177       +1     
  Lines       22124    22322     +198     
==========================================
+ Hits        13127    13290     +163     
- Misses       8192     8219      +27     
- Partials      805      813       +8     
Flag Coverage Δ
unittests 59.53% <86.66%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
apis/datadoghq/v2alpha1/datadogagent_types.go 100.00% <ø> (ø)
...atadogagent/feature/admissioncontroller/feature.go 83.15% <86.66%> (+0.69%) ⬆️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d393ee...d107ce5. Read the comment docs.

apis/datadoghq/v2alpha1/datadogagent_types.go Outdated Show resolved Hide resolved
apis/datadoghq/v2alpha1/datadogagent_types.go Outdated Show resolved Hide resolved
apis/datadoghq/v2alpha1/datadogagent_types.go Outdated Show resolved Hide resolved
apis/datadoghq/v2alpha1/datadogagent_types.go Outdated Show resolved Hide resolved
apis/datadoghq/v2alpha1/datadogagent_types.go Outdated Show resolved Hide resolved
apis/datadoghq/v2alpha1/datadogagent_types.go Outdated Show resolved Hide resolved
Copy link
Contributor

@maycmlee maycmlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of small suggestions

docs/configuration.v2alpha1.md Outdated Show resolved Hide resolved
docs/configuration.v2alpha1.md Outdated Show resolved Hide resolved
@kisungyi92 kisungyi92 merged commit f424448 into main May 30, 2024
19 checks passed
@kisungyi92 kisungyi92 deleted the kisung/add_sidecar_injection_with_selector_and_profile_v2 branch May 30, 2024 19:04
@kisungyi92 kisungyi92 changed the title [CECO-1067] DDA config for Admission Controller sidecar injection using selector and profile [CECO-1106] DDA config for Admission Controller sidecar injection using selector and profile May 31, 2024
khewonc pushed a commit that referenced this pull request Jun 10, 2024
…ng selector and profile (#1209)

* Adding selectors and profiles

* changing some terms and Editing selector profile logics in AC feature

* Editing some comments on types, chaning profile logic in feature

* Repositioning AgentSidecarInjectionConfig in type

* Editing some terms in selector and profile type

* Adding generate code

/merge
@khewonc khewonc mentioned this pull request Jun 10, 2024
2 tasks
khewonc added a commit that referenced this pull request Jun 11, 2024
…ng selector and profile (#1209) (#1229)

* Adding selectors and profiles

* changing some terms and Editing selector profile logics in AC feature

* Editing some comments on types, chaning profile logic in feature

* Repositioning AgentSidecarInjectionConfig in type

* Editing some terms in selector and profile type

* Adding generate code

/merge

Co-authored-by: kisungyi92 <[email protected]>
mftoure pushed a commit that referenced this pull request Oct 3, 2024
…ng selector and profile (#1209)

* Adding selectors and profiles

* changing some terms and Editing selector profile logics in AC feature

* Editing some comments on types, chaning profile logic in feature

* Repositioning AgentSidecarInjectionConfig in type

* Editing some terms in selector and profile type

* Adding generate code

/merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants