Skip to content

Commit 8f9c35a

Browse files
target-allocator: Add support for scrape-classes
1 parent ae7b1bd commit 8f9c35a

15 files changed

+3205
-44
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ spec:
711711
enabled: true
712712
serviceMonitorSelector: {}
713713
podMonitorSelector: {}
714+
scrapeClasses: []
714715
config:
715716
receivers:
716717
prometheus:
@@ -727,6 +728,9 @@ spec:
727728
EOF
728729
```
729730

731+
The `scrapeClasses` attribute refers to the ScrapeClass feature of the Prometheus Operator.
732+
Refer to https://prometheus-operator.dev/docs/developer/scrapeclass/ to learn more about scrape classes.
733+
730734
## Configure resource attributes
731735

732736
The OpenTelemetry Operator can automatically set resource attributes as defined in the

apis/v1beta1/targetallocator_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package v1beta1
55

66
import (
7+
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
78
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
89
)
910

@@ -25,6 +26,9 @@ type TargetAllocatorPrometheusCR struct {
2526
// +kubebuilder:default:="30s"
2627
// +kubebuilder:validation:Format:=duration
2728
ScrapeInterval *metav1.Duration `json:"scrapeInterval,omitempty"`
29+
// ScrapeClasses to be referenced by PodMonitors and ServiceMonitors to include common configuration.
30+
// +optional
31+
ScrapeClasses []*monitoringv1.ScrapeClass `json:"scrapeClasses,omitempty"`
2832
// PodMonitors to be selected for target discovery.
2933
// A label selector is a label query over a set of resources. The result of matchLabels and
3034
// matchExpressions are ANDed. An empty label selector matches all objects. A null

apis/v1beta1/zz_generated.deepcopy.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ metadata:
9999
categories: Logging & Tracing,Monitoring
100100
certified: "false"
101101
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
102-
createdAt: "2025-07-15T11:00:03Z"
102+
createdAt: "2025-07-25T14:17:34Z"
103103
description: Provides the OpenTelemetry components, including the Collector
104104
operators.operatorframework.io/builder: operator-sdk-v1.29.0
105105
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7969,6 +7969,243 @@ spec:
79697969
type: object
79707970
type: object
79717971
x-kubernetes-map-type: atomic
7972+
scrapeClasses:
7973+
items:
7974+
properties:
7975+
attachMetadata:
7976+
properties:
7977+
node:
7978+
type: boolean
7979+
type: object
7980+
authorization:
7981+
properties:
7982+
credentials:
7983+
properties:
7984+
key:
7985+
type: string
7986+
name:
7987+
default: ""
7988+
type: string
7989+
optional:
7990+
type: boolean
7991+
required:
7992+
- key
7993+
type: object
7994+
x-kubernetes-map-type: atomic
7995+
credentialsFile:
7996+
type: string
7997+
type:
7998+
type: string
7999+
type: object
8000+
default:
8001+
type: boolean
8002+
fallbackScrapeProtocol:
8003+
enum:
8004+
- PrometheusProto
8005+
- OpenMetricsText0.0.1
8006+
- OpenMetricsText1.0.0
8007+
- PrometheusText0.0.4
8008+
- PrometheusText1.0.0
8009+
type: string
8010+
metricRelabelings:
8011+
items:
8012+
properties:
8013+
action:
8014+
default: replace
8015+
enum:
8016+
- replace
8017+
- Replace
8018+
- keep
8019+
- Keep
8020+
- drop
8021+
- Drop
8022+
- hashmod
8023+
- HashMod
8024+
- labelmap
8025+
- LabelMap
8026+
- labeldrop
8027+
- LabelDrop
8028+
- labelkeep
8029+
- LabelKeep
8030+
- lowercase
8031+
- Lowercase
8032+
- uppercase
8033+
- Uppercase
8034+
- keepequal
8035+
- KeepEqual
8036+
- dropequal
8037+
- DropEqual
8038+
type: string
8039+
modulus:
8040+
format: int64
8041+
type: integer
8042+
regex:
8043+
type: string
8044+
replacement:
8045+
type: string
8046+
separator:
8047+
type: string
8048+
sourceLabels:
8049+
items:
8050+
pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
8051+
type: string
8052+
type: array
8053+
targetLabel:
8054+
type: string
8055+
type: object
8056+
type: array
8057+
name:
8058+
minLength: 1
8059+
type: string
8060+
relabelings:
8061+
items:
8062+
properties:
8063+
action:
8064+
default: replace
8065+
enum:
8066+
- replace
8067+
- Replace
8068+
- keep
8069+
- Keep
8070+
- drop
8071+
- Drop
8072+
- hashmod
8073+
- HashMod
8074+
- labelmap
8075+
- LabelMap
8076+
- labeldrop
8077+
- LabelDrop
8078+
- labelkeep
8079+
- LabelKeep
8080+
- lowercase
8081+
- Lowercase
8082+
- uppercase
8083+
- Uppercase
8084+
- keepequal
8085+
- KeepEqual
8086+
- dropequal
8087+
- DropEqual
8088+
type: string
8089+
modulus:
8090+
format: int64
8091+
type: integer
8092+
regex:
8093+
type: string
8094+
replacement:
8095+
type: string
8096+
separator:
8097+
type: string
8098+
sourceLabels:
8099+
items:
8100+
pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
8101+
type: string
8102+
type: array
8103+
targetLabel:
8104+
type: string
8105+
type: object
8106+
type: array
8107+
tlsConfig:
8108+
properties:
8109+
ca:
8110+
properties:
8111+
configMap:
8112+
properties:
8113+
key:
8114+
type: string
8115+
name:
8116+
default: ""
8117+
type: string
8118+
optional:
8119+
type: boolean
8120+
required:
8121+
- key
8122+
type: object
8123+
x-kubernetes-map-type: atomic
8124+
secret:
8125+
properties:
8126+
key:
8127+
type: string
8128+
name:
8129+
default: ""
8130+
type: string
8131+
optional:
8132+
type: boolean
8133+
required:
8134+
- key
8135+
type: object
8136+
x-kubernetes-map-type: atomic
8137+
type: object
8138+
caFile:
8139+
type: string
8140+
cert:
8141+
properties:
8142+
configMap:
8143+
properties:
8144+
key:
8145+
type: string
8146+
name:
8147+
default: ""
8148+
type: string
8149+
optional:
8150+
type: boolean
8151+
required:
8152+
- key
8153+
type: object
8154+
x-kubernetes-map-type: atomic
8155+
secret:
8156+
properties:
8157+
key:
8158+
type: string
8159+
name:
8160+
default: ""
8161+
type: string
8162+
optional:
8163+
type: boolean
8164+
required:
8165+
- key
8166+
type: object
8167+
x-kubernetes-map-type: atomic
8168+
type: object
8169+
certFile:
8170+
type: string
8171+
insecureSkipVerify:
8172+
type: boolean
8173+
keyFile:
8174+
type: string
8175+
keySecret:
8176+
properties:
8177+
key:
8178+
type: string
8179+
name:
8180+
default: ""
8181+
type: string
8182+
optional:
8183+
type: boolean
8184+
required:
8185+
- key
8186+
type: object
8187+
x-kubernetes-map-type: atomic
8188+
maxVersion:
8189+
enum:
8190+
- TLS10
8191+
- TLS11
8192+
- TLS12
8193+
- TLS13
8194+
type: string
8195+
minVersion:
8196+
enum:
8197+
- TLS10
8198+
- TLS11
8199+
- TLS12
8200+
- TLS13
8201+
type: string
8202+
serverName:
8203+
type: string
8204+
type: object
8205+
required:
8206+
- name
8207+
type: object
8208+
type: array
79728209
scrapeConfigSelector:
79738210
properties:
79748211
matchExpressions:

0 commit comments

Comments
 (0)