Skip to content

Commit

Permalink
Support observability in TempoMonolithic CR (#793)
Browse files Browse the repository at this point in the history
Support creating ServiceMonitors, PrometheusRules and Grafana Data Sources in TempoMonolithic CR

Signed-off-by: Andreas Gerstmayr <[email protected]>
  • Loading branch information
andreasgerstmayr authored Feb 13, 2024
1 parent 33f677b commit b5f51e3
Show file tree
Hide file tree
Showing 25 changed files with 1,422 additions and 49 deletions.
16 changes: 16 additions & 0 deletions .chloggen/monolithic_observability.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. operator, github action)
component: operator

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Support creating ServiceMonitors, PrometheusRules and Grafana Data Sources in TempoMonolithic CR

# One or more tracking issues related to the change
issues: [793]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
78 changes: 78 additions & 0 deletions apis/tempo/v1alpha1/tempomonolithic_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ type TempoMonolithicSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Jaeger UI"
JaegerUI *MonolithicJaegerUISpec `json:"jaegerui,omitempty"`

// Observability defines the observability configuration of the Tempo deployment.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Observability"
Observability *MonolithicObservabilitySpec `json:"observability,omitempty"`

// ManagementState defines whether this instance is managed by the operator or self-managed.
// Default: Managed.
//
Expand Down Expand Up @@ -277,6 +283,78 @@ type MonolithicJaegerUIRouteSpec struct {
Termination TLSRouteTerminationType `json:"termination,omitempty"`
}

// MonolithicObservabilitySpec defines the observability configuration of the Tempo deployment.
type MonolithicObservabilitySpec struct {
// Metrics defines the metric configuration of the Tempo deployment.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Metrics"
Metrics *MonolithicObservabilityMetricsSpec `json:"metrics,omitempty"`

// Grafana defines the Grafana configuration of the Tempo deployment.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Grafana"
Grafana *MonolithicObservabilityGrafanaSpec `json:"grafana,omitempty"`
}

// MonolithicObservabilityMetricsSpec defines the metrics settings of the Tempo deployment.
type MonolithicObservabilityMetricsSpec struct {
// ServiceMonitors defines the ServiceMonitor configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Service Monitors"
ServiceMonitors *MonolithicObservabilityMetricsServiceMonitorsSpec `json:"serviceMonitors,omitempty"`

// ServiceMonitors defines the PrometheusRule configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Prometheus Rules"
PrometheusRules *MonolithicObservabilityMetricsPrometheusRulesSpec `json:"prometheusRules,omitempty"`
}

// MonolithicObservabilityMetricsServiceMonitorsSpec defines the ServiceMonitor settings.
type MonolithicObservabilityMetricsServiceMonitorsSpec struct {
// Enabled defines if ServiceMonitor objects should be created for this Tempo deployment.
//
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enabled bool `json:"enabled"`
}

// MonolithicObservabilityMetricsPrometheusRulesSpec defines the PrometheusRules settings.
type MonolithicObservabilityMetricsPrometheusRulesSpec struct {
// Enabled defines if PrometheusRule objects should be created for this Tempo deployment.
//
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enabled bool `json:"enabled"`
}

// MonolithicObservabilityGrafanaSpec defines the Grafana configuration of the Tempo deployment.
type MonolithicObservabilityGrafanaSpec struct {
// DataSource defines the Grafana data source configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Grafana data source"
DataSource *MonolithicObservabilityGrafanaDataSourceSpec `json:"dataSource,omitempty"`
}

// MonolithicObservabilityGrafanaDataSourceSpec defines the Grafana data source configuration of the Tempo deployment.
type MonolithicObservabilityGrafanaDataSourceSpec struct {
// Enabled defines if a Grafana data source should be created for this Tempo deployment.
//
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enabled bool `json:"enabled"`

// InstanceSelector defines the Grafana instance where the data source should be created.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Grafana Instance Selector"
InstanceSelector *metav1.LabelSelector `json:"instanceSelector,omitempty"`
}

// MonolithicComponentStatus defines the status of each component.
type MonolithicComponentStatus struct {
// Tempo is a map of the pod status of the Tempo pods.
Expand Down
125 changes: 125 additions & 0 deletions apis/tempo/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ metadata:
capabilities: Deep Insights
categories: Logging & Tracing,Monitoring
containerImage: ghcr.io/grafana/tempo-operator/tempo-operator:v0.8.0
createdAt: "2024-02-12T14:43:26Z"
createdAt: "2024-02-12T19:30:29Z"
description: Create and manage deployments of Tempo, a high-scale distributed
tracing backend.
operatorframework.io/cluster-monitoring: "true"
Expand Down Expand Up @@ -243,6 +243,47 @@ spec:
the operator or self-managed. Default: Managed.'
displayName: Management State
path: management
- description: Observability defines the observability configuration of the
Tempo deployment.
displayName: Observability
path: observability
- description: Grafana defines the Grafana configuration of the Tempo deployment.
displayName: Grafana
path: observability.grafana
- description: DataSource defines the Grafana data source configuration.
displayName: Grafana data source
path: observability.grafana.dataSource
- description: Enabled defines if a Grafana data source should be created for
this Tempo deployment.
displayName: Enabled
path: observability.grafana.dataSource.enabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: InstanceSelector defines the Grafana instance where the data
source should be created.
displayName: Grafana Instance Selector
path: observability.grafana.dataSource.instanceSelector
- description: Metrics defines the metric configuration of the Tempo deployment.
displayName: Metrics
path: observability.metrics
- description: ServiceMonitors defines the PrometheusRule configuration.
displayName: Prometheus Rules
path: observability.metrics.prometheusRules
- description: Enabled defines if PrometheusRule objects should be created for
this Tempo deployment.
displayName: Enabled
path: observability.metrics.prometheusRules.enabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: ServiceMonitors defines the ServiceMonitor configuration.
displayName: Service Monitors
path: observability.metrics.serviceMonitors
- description: Enabled defines if ServiceMonitor objects should be created for
this Tempo deployment.
displayName: Enabled
path: observability.metrics.serviceMonitors.enabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Resources defines the compute resource requirements of the Tempo
container.
displayName: Resources
Expand Down
Loading

0 comments on commit b5f51e3

Please sign in to comment.