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

Support runtimeClassName override (including in DAP) #1546

Merged
merged 4 commits into from
Dec 10, 2024

Conversation

tbavelier
Copy link
Member

@tbavelier tbavelier commented Dec 2, 2024

What does this PR do?

  • Implements runtimeClassName override for pods: 88ff926
  • Implements support for runtimeClassName in DatadogAgentProfile: a93199b

Motivation

  • Internal team request to support a subset of Agent pods using a different runtimeclass

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


First commit: override

  1. Create a runtimeclass (test-handler handler exists in kind by default) on a kind cluster
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
  # The name the RuntimeClass will be referenced by.
  # RuntimeClass is a non-namespaced resource.
  name: foo
# The name of the corresponding CRI configuration
handler: test-handler
  1. Provide the override to all components:
spec.override.nodeAgent.runtimeClassName: foo
spec.override.clusterAgent.runtimeClassName: foo
  1. Verify pods are scheduled with said runtimeclass

Second commit: DAP override

  1. Create a runtimeclass like for first commit on a 2+ nodes kind cluster
  2. Label a node with foo=bar
  3. Deploy generic DDA (no override for runtimeclassname)
  4. Deploy the profile:
apiVersion: datadoghq.com/v1alpha1
kind: DatadogAgentProfile
metadata:
  name: dap-runtime-foo
spec:
  profileAffinity:
    profileNodeAffinity:
      - key: foo
        operator: In
        values:
          - bar
  config:
    override:
      nodeAgent:
        runtimeClassName: foo
  1. Verify that a pod on your labelled node is using said specific class instead of default
╰─❯ kubectl get pods -o custom-columns="NAME:.metadata.name,NODE:.spec.nodeName,RUNTIMECLASS:.spec.runtimeClassName"
NAME                                                      NODE                      RUNTIMECLASS
datadog-agent-6dgr2                                       local-k8s-control-plane   <none>
datadog-agent-vvwd7                                       local-k8s-worker          <none>
datadog-agent-with-profile-system-dap-runtime-foo-flnhm   local-k8s-worker2         foo
datadog-cluster-agent-69b86c4cb9-mjkkn                    local-k8s-worker2         <none>
datadog-operator-manager-696754f84b-9bkf4                 local-k8s-worker          <none>
  1. Remove the profile and ensure a new Agent pod with default runtimeclass is scheduled

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

@tbavelier tbavelier added the enhancement New feature or request label Dec 2, 2024
@tbavelier tbavelier added this to the v1.12.0 milestone Dec 2, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.67%. Comparing base (993280d) to head (c43bfa7).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1546      +/-   ##
==========================================
+ Coverage   48.66%   48.67%   +0.01%     
==========================================
  Files         226      226              
  Lines       20363    20367       +4     
==========================================
+ Hits         9909     9913       +4     
  Misses       9937     9937              
  Partials      517      517              
Flag Coverage Δ
unittests 48.67% <100.00%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
...pi/datadoghq/v1alpha1/datadogagentprofile_types.go 100.00% <ø> (ø)
api/datadoghq/v2alpha1/datadogagent_types.go 100.00% <ø> (ø)
...ontroller/datadogagent/override/podtemplatespec.go 73.58% <100.00%> (+0.25%) ⬆️
pkg/agentprofile/agent_profile.go 71.71% <100.00%> (+0.08%) ⬆️

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 993280d...c43bfa7. Read the comment docs.

@tbavelier tbavelier marked this pull request as ready for review December 5, 2024 08:12
@tbavelier tbavelier requested review from a team as code owners December 5, 2024 08:12
Copy link
Contributor

@neko-dd neko-dd left a comment

Choose a reason for hiding this comment

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

Small suggestion :)

@tbavelier
Copy link
Member Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Dec 10, 2024

Devflow running: /merge

View all feedbacks in Devflow UI.


2024-12-10 09:01:10 UTC ℹ️ MergeQueue: pull request added to the queue

The median merge time in main is 15m.

@dd-mergequeue dd-mergequeue bot merged commit 1c820e9 into main Dec 10, 2024
28 checks passed
@dd-mergequeue dd-mergequeue bot deleted the tbavelier/runtimeclassname_override branch December 10, 2024 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants