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

Added PodMonitor when using sidecar mode #2404

Merged
2 changes: 1 addition & 1 deletion apis/v1alpha1/opentelemetrycollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ type PodDisruptionBudgetSpec struct {

// MetricsConfigSpec defines a metrics config.
type MetricsConfigSpec struct {
// EnableMetrics specifies if ServiceMonitor should be created for the OpenTelemetry Collector and Prometheus Exporters.
// EnableMetrics specifies if ServiceMonitor or PodMonitor(for sidecar mode) should be created for the OpenTelemetry Collector and Prometheus Exporters.
// The operator.observability.prometheus feature gate must be enabled to use this feature.
//
// +optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ metadata:
categories: Logging & Tracing,Monitoring
certified: "false"
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
createdAt: "2023-11-17T13:24:32Z"
createdAt: "2023-12-05T14:55:25Z"
description: Provides the OpenTelemetry components, including the Collector
operators.operatorframework.io/builder: operator-sdk-v1.29.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
Expand Down Expand Up @@ -135,9 +135,10 @@ spec:
- description: Metrics defines the metrics configuration for operands.
displayName: Metrics Config
path: observability.metrics
- description: EnableMetrics specifies if ServiceMonitor should be created for
the OpenTelemetry Collector and Prometheus Exporters. The operator.observability.prometheus
feature gate must be enabled to use this feature.
- description: EnableMetrics specifies if ServiceMonitor or PodMonitor(for sidecar
mode) should be created for the OpenTelemetry Collector and Prometheus Exporters.
The operator.observability.prometheus feature gate must be enabled to use
this feature.
displayName: Create ServiceMonitors for OpenTelemetry Collector
path: observability.metrics.enableMetrics
version: v1alpha1
Expand Down Expand Up @@ -233,6 +234,7 @@ spec:
- apiGroups:
- monitoring.coreos.com
resources:
- podmonitors
- servicemonitors
verbs:
- create
Expand Down Expand Up @@ -378,7 +380,7 @@ spec:
- --enable-leader-election
- --zap-log-level=info
- --zap-time-encoding=rfc3339nano
- --feature-gates=+operator.autoinstrumentation.go,+operator.autoinstrumentation.nginx
- --feature-gates=+operator.autoinstrumentation.go,+operator.observability.prometheus,+operator.autoinstrumentation.nginx
swiatekm marked this conversation as resolved.
Show resolved Hide resolved
image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.89.0
livenessProbe:
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3707,9 +3707,9 @@ spec:
description: Metrics defines the metrics configuration for operands.
properties:
enableMetrics:
description: EnableMetrics specifies if ServiceMonitor should
be created for the OpenTelemetry Collector and Prometheus
Exporters. The operator.observability.
description: EnableMetrics specifies if ServiceMonitor or
PodMonitor(for sidecar mode) should be created for the OpenTelemetry
Collector and Prometheus Exporters. The operator.observability.
type: boolean
type: object
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3704,9 +3704,9 @@ spec:
description: Metrics defines the metrics configuration for operands.
properties:
enableMetrics:
description: EnableMetrics specifies if ServiceMonitor should
be created for the OpenTelemetry Collector and Prometheus
Exporters. The operator.observability.
description: EnableMetrics specifies if ServiceMonitor or
PodMonitor(for sidecar mode) should be created for the OpenTelemetry
Collector and Prometheus Exporters. The operator.observability.
type: boolean
type: object
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ spec:
- description: Metrics defines the metrics configuration for operands.
displayName: Metrics Config
path: observability.metrics
- description: EnableMetrics specifies if ServiceMonitor should be created for
the OpenTelemetry Collector and Prometheus Exporters. The operator.observability.prometheus
feature gate must be enabled to use this feature.
- description: EnableMetrics specifies if ServiceMonitor or PodMonitor(for sidecar
mode) should be created for the OpenTelemetry Collector and Prometheus Exporters.
The operator.observability.prometheus feature gate must be enabled to use
this feature.
displayName: Create ServiceMonitors for OpenTelemetry Collector
path: observability.metrics.enableMetrics
version: v1alpha1
Expand Down
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ rules:
- apiGroups:
- monitoring.coreos.com
resources:
- podmonitors
- servicemonitors
verbs:
- create
Expand Down
2 changes: 1 addition & 1 deletion controllers/opentelemetrycollector_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func NewReconciler(p Params) *OpenTelemetryCollectorReconciler {
// +kubebuilder:rbac:groups=autoscaling,resources=horizontalpodautoscalers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=policy,resources=poddisruptionbudgets,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;create;update
// +kubebuilder:rbac:groups=monitoring.coreos.com,resources=servicemonitors,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=monitoring.coreos.com,resources=servicemonitors;podmonitors,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=route.openshift.io,resources=routes;routes/custom-host,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=opentelemetry.io,resources=opentelemetrycollectors,verbs=get;list;watch;update;patch
Expand Down
Loading