Skip to content

Datadog pod autoscaler profile CRD#2676

Closed
ADKosm wants to merge 3 commits intomainfrom
alexey.kosmachev/cascl-1077-datadog-pod-autoscaler-profile
Closed

Datadog pod autoscaler profile CRD#2676
ADKosm wants to merge 3 commits intomainfrom
alexey.kosmachev/cascl-1077-datadog-pod-autoscaler-profile

Conversation

@ADKosm
Copy link

@ADKosm ADKosm commented Mar 2, 2026

What does this PR do?

Introduction of DatadogPodAutoscalerProfile. Please check this and this document to learn more about this project.

Motivation

Initial draft of new CRD for Profile entity.

Additional Notes

I want to explain my decision for moving some parts into common package.
From one side, it is beneficial to have exactly v1alpha2.DatadogPodAutoscalerSpec type inside DatadogPodAutoscalerProfile struct. In that case all changes make to the original v1alpha2.DatadogPodAutoscalerSpec will automatically be propagated to profiles and usage in the code will be a bit easier.
However there are two main problems with that

  • Profile is an entity inside v1alpha1 but we very likely want it to generate the latest version of DPA - v1alpha2
  • There are some fields which we don't want to provide user to change via Profile, namely - Owner, RemoteVersion and Target

Therefore the plan is

  • Move internal types from v1alpha2 to common, providing aliases for backward-compatibility.
  • Create dedicated Template struct which will replicate Spec but without there three fields.
  • Later provide function which will create spec from this template object.

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

  • Check that other repos are still compiling after that change.
  • Trying to create this object in local k8s cluster.

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
  • All commits are signed (see: signing commits)

@ADKosm ADKosm self-assigned this Mar 2, 2026
@ADKosm ADKosm requested a review from a team March 2, 2026 16:55
@ADKosm ADKosm requested review from a team as code owners March 2, 2026 16:55
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf1da54920

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@@ -0,0 +1,991 @@
---

Choose a reason for hiding this comment

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

P1 Badge Wire new profile CRD into CRD kustomization

This commit adds a new CRD base file, but config/crd/kustomization.yaml (resources list at lines 6-15) is not updated to include bases/v1/datadoghq.com_datadogpodautoscalerprofiles.yaml; as a result, kustomize build config/crd and downstream install/bundle workflows will omit this CRD, and clusters applying those manifests will reject DatadogPodAutoscalerProfile resources as unknown.

Useful? React with 👍 / 👎.

@codecov-commenter
Copy link

codecov-commenter commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.81%. Comparing base (232e661) to head (11ac000).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2676   +/-   ##
=======================================
  Coverage   38.81%   38.81%           
=======================================
  Files         307      307           
  Lines       26610    26610           
=======================================
  Hits        10329    10329           
  Misses      15501    15501           
  Partials      780      780           
Flag Coverage Δ
unittests 38.81% <ø> (ø)

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


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 232e661...11ac000. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ADKosm ADKosm requested a review from davidor March 3, 2026 14:37
// ApplyPolicy defines how recommendations should be applied.
// +optional
// +kubebuilder:default={}
ApplyPolicy *DatadogPodAutoscalerApplyPolicy `json:"applyPolicy,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not entirely sure it should be part of a template

Copy link
Author

Choose a reason for hiding this comment

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

Why? I mean, it looks useful to be able to setup apply policy since it affect how autoscaler will behave 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, the status of an Autoscaler is disjoint from its actual Spec, it would imply that you cannot pause autoscaling on a single Autoscaler managed by a template, you would need to pause all autoscalers.

metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec DatadogPodAutoscalerSpec `json:"spec,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

DatadogPodAutoscalerSpec should inline DatadogPodAutoscalerTemplate

Copy link
Author

Choose a reason for hiding this comment

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

I initially tried this, but faced the problem that initializing DatadogPodAutoscalerSpec struct will be backward incompatible (because now you need to explicitly initialize Template struct).
So I decided to go in a more safe way and just recreate this layer.

Copy link
Contributor

Choose a reason for hiding this comment

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

The YAML is backward compatible, that's what is important, the fact that the Go struct is not is actually not a problem.

@ADKosm
Copy link
Author

ADKosm commented Mar 6, 2026

Close in a favour of #2718

@ADKosm ADKosm closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants