Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACM-14962: init MCOA metrics #1659

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ type PlatformLogsCollectionSpec struct {
Enabled bool `json:"enabled,omitempty"`
}

// PlatformMetricsCollectionSpec defines the spec for the addon to collect and forward metrics
// from fleet managed clusters.
type PlatformMetricsCollectionSpec struct {
// Enabled defines a flag to enable/disable the platform metrics collection.
//
// +optional
// +kubebuilder:validation:Optional
Enabled bool `json:"enabled,omitempty"`
}
Comment on lines +71 to +79
Copy link
Contributor

Choose a reason for hiding this comment

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

In this initial version since metrics will be taking a managed approach to metric collection I wonder if these values are the best ones to use since the equivalent for logs & traces currently correlates to an unmanaged approach where the user fully controls the root resources. I would be in favor of deliberating a bit how we want these different scenarios to be exposed to users. This correlates with stolostron/multicluster-observability-addon#88 (comment) maybe a discussion for the nexus syncs


// PlatformLogsSpec defines the spec for the addon to collect, forward and store logs
// from fleet managed clusters.
type PlatformLogsSpec struct {
Expand All @@ -79,6 +89,17 @@ type PlatformLogsSpec struct {
Collection PlatformLogsCollectionSpec `json:"collection,omitempty"`
}

// PlatformMetricsSpec defines the spec for the addon to collect, forward and store metrics
// from fleet managed clusters.
type PlatformMetricsSpec struct {
// Collection defines the spec for the addon to collect and forward metrics
// from fleet managed clusters.
//
// +optional
// +kubebuilder:validation:Optional
Collection PlatformMetricsCollectionSpec `json:"collection,omitempty"`
}

// PlatformCapabilitiesSpec defines the observability capabilities managed by the addon
// for platform components.
type PlatformCapabilitiesSpec struct {
Expand All @@ -88,6 +109,13 @@ type PlatformCapabilitiesSpec struct {
// +optional
// +kubebuilder:validation:Optional
Logs PlatformLogsSpec `json:"logs,omitempty"`

// Metrics defines the configuration spec for collecting and storing metrics from
// platform components running on fleet managed clusters.
//
// +optional
// +kubebuilder:validation:Optional
Metrics PlatformMetricsSpec `json:"metrics,omitempty"`
}

// ClusterLogForwarderSpec defines the spec for the addon to collect and forward logs
Expand All @@ -110,6 +138,16 @@ type UserWorkloadLogsCollectionSpec struct {
ClusterLogForwarder ClusterLogForwarderSpec `json:"clusterLogForwarder,omitempty"`
}

// UserWorkloadLogsSpec defines the spec for the addon to collect,forward and store logs
// from user workloads hosted on fleet managed clusters.
type UserWorkloadMetricsCollectionSpec struct {
// Enabled defines a flag to enable/disable the platform metrics collection.
//
// +optional
// +kubebuilder:validation:Optional
Enabled bool `json:"enabled,omitempty"`
}

// UserWorkloadLogsSpec defines the spec for the addon to collect,forward and store logs
// from user workloads hosted on fleet managed clusters.
type UserWorkloadLogsSpec struct {
Expand All @@ -121,6 +159,17 @@ type UserWorkloadLogsSpec struct {
Collection UserWorkloadLogsCollectionSpec `json:"collection,omitempty"`
}

// UserWorkloadMetricsSpec defines the spec for the addon to collect, forward and store metrics
// from user workloads hosted on fleet managed clusters.
type UserWorkloadMetricsSpec struct {
// Collection defines the spec for the addon to collect and forward metrics
// from user workloads hosted on fleet managed clusters.
//
// +optional
// +kubebuilder:validation:Optional
Collection UserWorkloadMetricsCollectionSpec `json:"collection,omitempty"`
}

// OpenTelemetryCollectorSpec defines the spec for the addon to collect and forward observability signals
// using the OpenTelemetryCollector custom resource.
type OpenTelemetryCollectorSpec struct {
Expand Down Expand Up @@ -176,6 +225,14 @@ type UserWorkloadCapabilitiesSpec struct {
// +optional
// +kubebuilder:validation:Optional
Logs UserWorkloadLogsSpec `json:"logs,omitempty"`

// Metrics defines the spec for the addon to collect, forward and store metrics
// from user workloads hosted on fleet managed clusters.
//
// +optional
// +kubebuilder:validation:Optional
Metrics UserWorkloadMetricsSpec `json:"metrics,omitempty"`

// Traces defines the spec for the addon to collect, forward and store traces
// from user workloads hosted on fleet managed clusters.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ metadata:
}
]
capabilities: Basic Install
createdAt: "2024-09-23T12:07:01Z"
createdAt: "2024-11-06T16:52:14Z"
operators.operatorframework.io/builder: operator-sdk-v1.34.2
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
name: multicluster-observability-operator.v0.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10036,6 +10036,22 @@ spec:
type: boolean
type: object
type: object
metrics:
description: |-
Metrics defines the configuration spec for collecting and storing metrics from
platform components running on fleet managed clusters.
properties:
collection:
description: |-
Collection defines the spec for the addon to collect and forward metrics
from fleet managed clusters.
properties:
enabled:
description: Enabled defines a flag to enable/disable
the platform metrics collection.
type: boolean
type: object
type: object
type: object
userWorkloads:
description: |-
Expand Down Expand Up @@ -10066,6 +10082,22 @@ spec:
type: object
type: object
type: object
metrics:
description: |-
Metrics defines the spec for the addon to collect, forward and store metrics
from user workloads hosted on fleet managed clusters.
properties:
collection:
description: |-
Collection defines the spec for the addon to collect and forward metrics
from user workloads hosted on fleet managed clusters.
properties:
enabled:
description: Enabled defines a flag to enable/disable
the platform metrics collection.
type: boolean
type: object
type: object
traces:
description: |-
Traces defines the spec for the addon to collect, forward and store traces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10020,6 +10020,22 @@ spec:
type: boolean
type: object
type: object
metrics:
description: |-
Metrics defines the configuration spec for collecting and storing metrics from
platform components running on fleet managed clusters.
properties:
collection:
description: |-
Collection defines the spec for the addon to collect and forward metrics
from fleet managed clusters.
properties:
enabled:
description: Enabled defines a flag to enable/disable
the platform metrics collection.
type: boolean
type: object
type: object
type: object
userWorkloads:
description: |-
Expand Down Expand Up @@ -10050,6 +10066,22 @@ spec:
type: object
type: object
type: object
metrics:
description: |-
Metrics defines the spec for the addon to collect, forward and store metrics
from user workloads hosted on fleet managed clusters.
properties:
collection:
description: |-
Collection defines the spec for the addon to collect and forward metrics
from user workloads hosted on fleet managed clusters.
properties:
enabled:
description: Enabled defines a flag to enable/disable
the platform metrics collection.
type: boolean
type: object
type: object
traces:
description: |-
Traces defines the spec for the addon to collect, forward and store traces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,16 @@ spec:
# Describes the default Instrumentation type applied to all managed clusters.
- group: opentelemetry.io
resource: instrumentations
# Metrics forwarding configuration types.
- group: monitoring.coreos.com
resource: prometheusagents
- group: monitoring.coreos.com
resource: scrapeconfigs
- group: monitoring.coreos.com
resource: prometheusrules
installStrategy:
type: Placements
placements:
- name: global
namespace: open-cluster-management-global-set
configs:
- group: observability.openshift.io
resource: clusterlogforwarders
name: instance
namespace: open-cluster-management-observability
- group: opentelemetry.io
resource: opentelemetrycollectors
name: instance
namespace: open-cluster-management-observability
- group: opentelemetry.io
resource: instrumentations
name: instance
namespace: open-cluster-management-observability
configs: []
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,7 @@
- apiGroups: ["opentelemetry.io"]
resources: ["opentelemetrycollectors", "instrumentations"]
verbs: ["get", "list", "watch"]
# Role for addon to perform prometheus specific actions
- apiGroups: ["monitoring.coreos.com"]
resources: ["prometheusagents", "scrapeconfigs", "prometheusrules"]
verbs: ["get", "list", "watch", "create", "update", "delete"]
2 changes: 2 additions & 0 deletions operators/multiclusterobservability/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,15 @@ const (
ClusterLogForwarderCRDName = "clusterlogforwarders.observability.openshift.io"
OpenTelemetryCollectorCRDName = "opentelemetrycollectors.opentelemetry.io"
InstrumentationCRDName = "instrumentations.opentelemetry.io"
PrometheusAgentCRDName = "prometheusagents.monitoring.coreos.com"
)

var (
mcoaSupportedCRDs = map[string]string{
ClusterLogForwarderCRDName: "v1",
OpenTelemetryCollectorCRDName: "v1beta1",
InstrumentationCRDName: "v1alpha1",
PrometheusAgentCRDName: "v1alpha1",
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ func TestGetMCOASupportedCRDNames(t *testing.T) {
"clusterlogforwarders.observability.openshift.io",
"opentelemetrycollectors.opentelemetry.io",
"instrumentations.opentelemetry.io",
"prometheusagents.monitoring.coreos.com",
}

result := GetMCOASupportedCRDNames()
Expand Down
Loading
Loading