Skip to content

Commit

Permalink
Add new version of DatadogPodAutoscaler CRD (#1621)
Browse files Browse the repository at this point in the history
* Mark DDPA v1alpha1 as the storage version

* Generate DDPA v2alpha1

`operator-sdk create api --group datadoghq --kind DatadogPodAutoscaler --version v2alpha1`

* Fill in DDPA v2alpha1

Similar to v1alpah1, with the following changes:
- `spec.policy` renamed to `spec.actuation`
- `spec.policy.applyMode` replaced with `spec.actuation.mode` (allowed values
   `Apply` and `Preview`)
- `spec.policy.upscale.match` and `spec.policy.donwscale.match` removed
- `spec.policy.targets` renamed to `spec.policy.objectives`
- `sepc.policy.contraints.containers[].limits` removed

* Apply review comments

* Add groupversion info for v1alpha2

* make generate

* Apply review comments

* regenerate

* Drop Absolute from DatadogPodAutoscalerResourceTarget

Its not supported right now

* regenerate

* Apply review suggestions

Co-authored-by: Celene <[email protected]>

* Improve descriptions with review comments

* regenerate

* Apply reviewer suggestions

Co-authored-by: Celene <[email protected]>

* Set codeowners for autoscaling files

* Address review comments

* Regenerate

---------

Co-authored-by: Celene <[email protected]>
  • Loading branch information
jbartosik and celenechang authored Feb 5, 2025
1 parent c8f5ca6 commit be4dc2b
Show file tree
Hide file tree
Showing 9 changed files with 3,165 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ README.md @DataDog/documentation @DataDog/container-ecosystems
/internal/controller/datadogagent/feature/clusterchecks/* @DataDog/container-platform
/internal/controller/datadogagent/feature/kubernetesstatecore/* @DataDog/container-integrations
/internal/controller/datadogagent/feature/helmcheck/* @DataDog/container-integrations


/api/datadoghq/v1alpha2/datadogpodautoscaler_types.go @DataDog/container-autoscaling
/api/datadoghq/v1alpha1/datadogpodautoscaler_types.go @DataDog/container-autoscaling
8 changes: 8 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,12 @@ resources:
kind: DatadogDashboard
path: github.com/DataDog/datadog-operator/api/datadoghq/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
domain: com
group: datadoghq
kind: DatadogPodAutoscaler
path: github.com/DataDog/datadog-operator/api/datadoghq/v1alpha2
version: v1alpha2
version: "3"
32 changes: 16 additions & 16 deletions api/datadoghq/v1alpha1/datadogpodautoscaler_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,22 +549,22 @@ type DatadogPodAutoscalerCondition struct {
Message string `json:"message,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:resource:shortName=dpa
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Apply Mode",type="string",JSONPath=".spec.policy.applyMode"
//+kubebuilder:printcolumn:name="Active",type="string",JSONPath=".status.conditions[?(@.type=='Active')].status"
//+kubebuilder:printcolumn:name="In Error",type="string",JSONPath=".status.conditions[?(@.type=='Error')].status"
//+kubebuilder:printcolumn:name="Desired Replicas",type="integer",JSONPath=".status.horizontal.target.desiredReplicas"
//+kubebuilder:printcolumn:name="Generated",type="date",JSONPath=".status.horizontal.target.generatedAt"
//+kubebuilder:printcolumn:name="Able to Scale",type="string",JSONPath=".status.conditions[?(@.type=='HorizontalAbleToScale')].status"
//+kubebuilder:printcolumn:name="Last Scale",type="date",JSONPath=".status.horizontal.lastAction.time"
//+kubebuilder:printcolumn:name="Target CPU Req",type="string",JSONPath=".status.vertical.target.podCPURequest"
//+kubebuilder:printcolumn:name="Target Memory Req",type="string",JSONPath=".status.vertical.target.podMemoryRequest"
//+kubebuilder:printcolumn:name="Generated",type="date",JSONPath=".status.vertical.target.generatedAt"
//+kubebuilder:printcolumn:name="Able to Apply",type="string",JSONPath=".status.conditions[?(@.type=='VerticalAbleToApply')].status"
//+kubebuilder:printcolumn:name="Last Trigger",type="date",JSONPath=".status.vertical.lastAction.time"

// +kubebuilder:object:root=true
// +kubebuilder:resource:shortName=dpa
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Apply Mode",type="string",JSONPath=".spec.policy.applyMode"
// +kubebuilder:printcolumn:name="Active",type="string",JSONPath=".status.conditions[?(@.type=='Active')].status"
// +kubebuilder:printcolumn:name="In Error",type="string",JSONPath=".status.conditions[?(@.type=='Error')].status"
// +kubebuilder:printcolumn:name="Desired Replicas",type="integer",JSONPath=".status.horizontal.target.desiredReplicas"
// +kubebuilder:printcolumn:name="Generated",type="date",JSONPath=".status.horizontal.target.generatedAt"
// +kubebuilder:printcolumn:name="Able to Scale",type="string",JSONPath=".status.conditions[?(@.type=='HorizontalAbleToScale')].status"
// +kubebuilder:printcolumn:name="Last Scale",type="date",JSONPath=".status.horizontal.lastAction.time"
// +kubebuilder:printcolumn:name="Target CPU Req",type="string",JSONPath=".status.vertical.target.podCPURequest"
// +kubebuilder:printcolumn:name="Target Memory Req",type="string",JSONPath=".status.vertical.target.podMemoryRequest"
// +kubebuilder:printcolumn:name="Generated",type="date",JSONPath=".status.vertical.target.generatedAt"
// +kubebuilder:printcolumn:name="Able to Apply",type="string",JSONPath=".status.conditions[?(@.type=='VerticalAbleToApply')].status"
// +kubebuilder:printcolumn:name="Last Trigger",type="date",JSONPath=".status.vertical.lastAction.time"
// +kubebuilder:storageversion
// DatadogPodAutoscaler is the Schema for the datadogpodautoscalers API
type DatadogPodAutoscaler struct {
metav1.TypeMeta `json:",inline"`
Expand Down
Loading

0 comments on commit be4dc2b

Please sign in to comment.