@@ -143,6 +143,9 @@ type AmazonCloudWatchAgentSpec struct {
143143 // Collector and Target Allocator pods.
144144 // +optional
145145 PodAnnotations map [string ]string `json:"podAnnotations,omitempty"`
146+ // TargetAllocator indicates a value which determines whether to spawn a target allocation resource or not.
147+ // +optional
148+ TargetAllocator AmazonCloudWatchAgentTargetAllocator `json:"targetAllocator,omitempty"`
146149 // Mode represents how the collector should be deployed (deployment, daemonset, statefulset or sidecar)
147150 // +optional
148151 Mode Mode `json:"mode,omitempty"`
@@ -164,6 +167,9 @@ type AmazonCloudWatchAgentSpec struct {
164167 // ImagePullPolicy indicates the pull policy to be used for retrieving the container image (Always, Never, IfNotPresent)
165168 // +optional
166169 ImagePullPolicy v1.PullPolicy `json:"imagePullPolicy,omitempty"`
170+ // Prometheus is the raw YAML to be used as the collector's prometheus configuration.
171+ // +optional
172+ Prometheus PrometheusConfig `json:"prometheus,omitempty"`
167173 // Config is the raw JSON to be used as the collector's configuration. Refer to the OpenTelemetry Collector documentation for details.
168174 // +required
169175 Config string `json:"config,omitempty"`
@@ -273,6 +279,87 @@ type AmazonCloudWatchAgentSpec struct {
273279 UpdateStrategy appsv1.DaemonSetUpdateStrategy `json:"updateStrategy,omitempty"`
274280}
275281
282+ // AmazonCloudWatchAgentTargetAllocator defines the configurations for the Prometheus target allocator.
283+ type AmazonCloudWatchAgentTargetAllocator struct {
284+ // Replicas is the number of pod instances for the underlying TargetAllocator. This should only be set to a value
285+ // other than 1 if a strategy that allows for high availability is chosen. Currently, the only allocation strategy
286+ // that can be run in a high availability mode is consistent-hashing.
287+ // +optional
288+ Replicas * int32 `json:"replicas,omitempty"`
289+ // NodeSelector to schedule OpenTelemetry TargetAllocator pods.
290+ // +optional
291+ NodeSelector map [string ]string `json:"nodeSelector,omitempty"`
292+ // Resources to set on the OpenTelemetryTargetAllocator containers.
293+ // +optional
294+ Resources v1.ResourceRequirements `json:"resources,omitempty"`
295+ // AllocationStrategy determines which strategy the target allocator should use for allocation.
296+ // The current option is consistent-hashing.
297+ // +optional
298+ AllocationStrategy AmazonCloudWatchAgentTargetAllocatorAllocationStrategy `json:"allocationStrategy,omitempty"`
299+ // FilterStrategy determines how to filter targets before allocating them among the collectors.
300+ // The only current option is relabel-config (drops targets based on prom relabel_config).
301+ // Filtering is disabled by default.
302+ // +optional
303+ FilterStrategy string `json:"filterStrategy,omitempty"`
304+ // ServiceAccount indicates the name of an existing service account to use with this instance. When set,
305+ // the operator will not automatically create a ServiceAccount for the TargetAllocator.
306+ // +optional
307+ ServiceAccount string `json:"serviceAccount,omitempty"`
308+ // Image indicates the container image to use for the OpenTelemetry TargetAllocator.
309+ // +optional
310+ Image string `json:"image,omitempty"`
311+ // Enabled indicates whether to use a target allocation mechanism for Prometheus targets or not.
312+ // +optional
313+ Enabled bool `json:"enabled,omitempty"`
314+ // If specified, indicates the pod's scheduling constraints
315+ // +optional
316+ Affinity * v1.Affinity `json:"affinity,omitempty"`
317+ // PrometheusCR defines the configuration for the retrieval of PrometheusOperator CRDs ( servicemonitor.monitoring.coreos.com/v1 and podmonitor.monitoring.coreos.com/v1 ) retrieval.
318+ // All CR instances which the ServiceAccount has access to will be retrieved. This includes other namespaces.
319+ // +optional
320+ PrometheusCR AmazonCloudWatchAgentTargetAllocatorPrometheusCR `json:"prometheusCR,omitempty"`
321+ // SecurityContext configures the container security context for
322+ // the target-allocator.
323+ // +optional
324+ SecurityContext * v1.PodSecurityContext `json:"securityContext,omitempty"`
325+ // TopologySpreadConstraints embedded kubernetes pod configuration option,
326+ // controls how pods are spread across your cluster among failure-domains
327+ // such as regions, zones, nodes, and other user-defined topology domains
328+ // https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
329+ // +optional
330+ TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
331+ // Toleration embedded kubernetes pod configuration option,
332+ // controls how pods can be scheduled with matching taints
333+ // +optional
334+ Tolerations []v1.Toleration `json:"tolerations,omitempty"`
335+ // ENV vars to set on the OpenTelemetry TargetAllocator's Pods. These can then in certain cases be
336+ // consumed in the config file for the TargetAllocator.
337+ // +optional
338+ Env []v1.EnvVar `json:"env,omitempty"`
339+ }
340+
341+ type AmazonCloudWatchAgentTargetAllocatorPrometheusCR struct {
342+ // Enabled indicates whether to use a PrometheusOperator custom resources as targets or not.
343+ // +optional
344+ Enabled bool `json:"enabled,omitempty"`
345+ // Interval between consecutive scrapes. Equivalent to the same setting on the Prometheus CRD.
346+ //
347+ // Default: "30s"
348+ // +kubebuilder:default:="30s"
349+ // +kubebuilder:validation:Format:=duration
350+ ScrapeInterval * metav1.Duration `json:"scrapeInterval,omitempty"`
351+ // PodMonitors to be selected for target discovery.
352+ // This is a map of {key,value} pairs. Each {key,value} in the map is going to exactly match a label in a
353+ // PodMonitor's meta labels. The requirements are ANDed.
354+ // +optional
355+ PodMonitorSelector map [string ]string `json:"podMonitorSelector,omitempty"`
356+ // ServiceMonitors to be selected for target discovery.
357+ // This is a map of {key,value} pairs. Each {key,value} in the map is going to exactly match a label in a
358+ // ServiceMonitor's meta labels. The requirements are ANDed.
359+ // +optional
360+ ServiceMonitorSelector map [string ]string `json:"serviceMonitorSelector,omitempty"`
361+ }
362+
276363// ScaleSubresourceStatus defines the observed state of the AmazonCloudWatchAgent's
277364// scale subresource.
278365type ScaleSubresourceStatus struct {
0 commit comments