Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions api/datadoghq/v2alpha1/datadogagent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2349,6 +2349,43 @@ type RemoteConfigConfiguration struct {
Features *DatadogFeatures `json:"features,omitempty"`
}

// ExperimentPhase is the lifecycle phase of a Fleet Automation experiment.
// +kubebuilder:validation:Enum=running;stopped;rollback;timeout;promoted;aborted
type ExperimentPhase string

const (
// ExperimentPhaseRunning is set by RC when an experiment starts (startExperiment).
ExperimentPhaseRunning ExperimentPhase = "running"
// ExperimentPhaseStopped is set by RC to request a rollback (stopExperiment).
ExperimentPhaseStopped ExperimentPhase = "stopped"
// ExperimentPhaseRollback is set by the operator after processing a stopped signal and restoring the previous spec.
ExperimentPhaseRollback ExperimentPhase = "rollback"
// ExperimentPhaseTimeout is set by the operator when the experiment exceeds the timeout and is auto-rolled back.
ExperimentPhaseTimeout ExperimentPhase = "timeout"
// ExperimentPhasePromoted is set by RC when an experiment succeeds (promoteExperiment).
ExperimentPhasePromoted ExperimentPhase = "promoted"
// ExperimentPhaseAborted is set by the operator when a manual spec change is detected during a running experiment.
ExperimentPhaseAborted ExperimentPhase = "aborted"
)

// ExperimentStatus defines the state of a Fleet Automation experiment.
// +k8s:openapi-gen=true
type ExperimentStatus struct {
// Phase is the current state of the experiment.
// +optional
Phase ExperimentPhase `json:"phase,omitempty"`
// ID is the unique experiment ID sent by Fleet Automation.
// +optional
ID string `json:"id,omitempty"`
// Generation is the DDA metadata.generation recorded when the experiment started.
// Used to detect manual spec changes while the experiment is running: if the
// current DDA generation differs from this value, the operator aborts the experiment.
//
// This value must be recorded after the DDA is patched for a startExperiment signal.
// +optional
Generation int64 `json:"generation,omitempty"`
}

// DatadogAgentStatus defines the observed state of DatadogAgent.
// +k8s:openapi-gen=true
type DatadogAgentStatus struct {
Expand Down Expand Up @@ -2376,6 +2413,9 @@ type DatadogAgentStatus struct {
// RemoteConfigConfiguration stores the configuration received from RemoteConfig.
// +optional
RemoteConfigConfiguration *RemoteConfigConfiguration `json:"remoteConfigConfiguration,omitempty"`
// Experiment tracks the state of an active or recent Fleet Automation experiment.
// +optional
Experiment *ExperimentStatus `json:"experiment,omitempty"`
}

// DatadogAgent defines Agent configuration, see reference https://github.com/DataDog/datadog-operator/blob/main/docs/configuration.v2alpha1.md
Expand All @@ -2387,6 +2427,7 @@ type DatadogAgentStatus struct {
// +kubebuilder:printcolumn:name="cluster-agent",type="string",JSONPath=".status.clusterAgent.status"
// +kubebuilder:printcolumn:name="cluster-checks-runner",type="string",JSONPath=".status.clusterChecksRunner.status"
// +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="experiment-phase",type="string",JSONPath=".status.experiment.phase",priority=1
// +k8s:openapi-gen=true
// +genclient
type DatadogAgent struct {
Expand Down
20 changes: 20 additions & 0 deletions api/datadoghq/v2alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 42 additions & 1 deletion api/datadoghq/v2alpha1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions config/crd/bases/v1/datadoghq.com_datadogagents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: age
type: date
- jsonPath: .status.experiment.phase
name: experiment-phase
priority: 1
type: string
name: v2alpha1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -8470,6 +8474,32 @@ spec:
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
experiment:
description: Experiment tracks the state of an active or recent Fleet Automation experiment.
properties:
generation:
description: |-
Generation is the DDA metadata.generation recorded when the experiment started.
Used to detect manual spec changes while the experiment is running: if the
current DDA generation differs from this value, the operator aborts the experiment.

This value must be recorded after the DDA is patched for a startExperiment signal.
format: int64
type: integer
id:
description: ID is the unique experiment ID sent by Fleet Automation.
type: string
phase:
description: Phase is the current state of the experiment.
enum:
- running
- stopped
- rollback
- timeout
- promoted
- aborted
type: string
type: object
otelAgentGateway:
description: The actual state of the OTel Agent Gateway as a deployment.
properties:
Expand Down
28 changes: 28 additions & 0 deletions config/crd/bases/v1/datadoghq.com_datadogagents_v2alpha1.json
Original file line number Diff line number Diff line change
Expand Up @@ -8175,6 +8175,34 @@
],
"x-kubernetes-list-type": "map"
},
"experiment": {
"additionalProperties": false,
"description": "Experiment tracks the state of an active or recent Fleet Automation experiment.",
"properties": {
"generation": {
"description": "Generation is the DDA metadata.generation recorded when the experiment started.\nUsed to detect manual spec changes while the experiment is running: if the\ncurrent DDA generation differs from this value, the operator aborts the experiment.\n\nThis value must be recorded after the DDA is patched for a startExperiment signal.",
"format": "int64",
"type": "integer"
},
"id": {
"description": "ID is the unique experiment ID sent by Fleet Automation.",
"type": "string"
},
"phase": {
"description": "Phase is the current state of the experiment.",
"enum": [
"running",
"stopped",
"rollback",
"timeout",
"promoted",
"aborted"
],
"type": "string"
}
},
"type": "object"
},
"otelAgentGateway": {
"additionalProperties": false,
"description": "The actual state of the OTel Agent Gateway as a deployment.",
Expand Down
2 changes: 2 additions & 0 deletions internal/controller/datadogagent/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ type ReconcilerOptions struct {
DatadogAgentProfileEnabled bool
DatadogAgentInternalEnabled bool
CreateControllerRevisions bool
// ExperimentTimeout overrides ExperimentDefaultTimeout. Zero means use the default.
ExperimentTimeout time.Duration
}

// Reconciler is the internal reconciler for Datadog Agent
Expand Down
Loading
Loading