Skip to content

Commit

Permalink
[operator] feat: add 'relabelings' and 'metricRelabelings' configs to…
Browse files Browse the repository at this point in the history
… serviceMonitor (open-telemetry#1246)

* feat: add 'relabelings' and 'metricRelabelings' configs to serviceMonitor

Signed-off-by: Ryan Lonergan <[email protected]>

* update schema

Signed-off-by: Ryan Lonergan <[email protected]>

* update version in Chart.yaml

Signed-off-by: Ryan Lonergan <[email protected]>

* bump Chart version

* chore: make generate-examples CHARTS=opentelemetry-operator

---------

Signed-off-by: Ryan Lonergan <[email protected]>
  • Loading branch information
rl0nergan authored and 12ushan committed Jul 22, 2024
1 parent b8c4f43 commit 9cde864
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 96 deletions.
2 changes: 1 addition & 1 deletion charts/opentelemetry-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: opentelemetry-operator
version: 0.64.3
version: 0.64.4
description: OpenTelemetry Operator Helm chart for Kubernetes
type: application
home: https://opentelemetry.io/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: default/example-opentelemetry-operator-serving-cert
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down Expand Up @@ -91,7 +91,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: default/example-opentelemetry-operator-serving-cert
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand All @@ -30,7 +30,7 @@ apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down Expand Up @@ -223,7 +223,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand All @@ -242,7 +242,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand All @@ -26,7 +26,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: v1
kind: Service
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down Expand Up @@ -32,7 +32,7 @@ apiVersion: v1
kind: Service
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: opentelemetry-operator
namespace: default
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: "example-opentelemetry-operator-cert-manager"
namespace: default
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: "example-opentelemetry-operator-metrics"
namespace: default
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down Expand Up @@ -44,7 +44,7 @@ metadata:
name: "example-opentelemetry-operator-webhook"
namespace: default
labels:
helm.sh/chart: opentelemetry-operator-0.64.3
helm.sh/chart: opentelemetry-operator-0.64.4
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
Expand Down
8 changes: 8 additions & 0 deletions charts/opentelemetry-operator/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ spec:
app.kubernetes.io/component: controller-manager
endpoints:
{{- toYaml .Values.manager.serviceMonitor.metricsEndpoints | nindent 2 }}
{{- with .Values.manager.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.manager.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 4 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
Expand Down
174 changes: 97 additions & 77 deletions charts/opentelemetry-operator/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -711,83 +711,103 @@
}]
},
"serviceMonitor": {
"type": "object",
"default": {},
"title": "The serviceMonitor Schema",
"required": [
"enabled",
"extraLabels",
"annotations",
"metricsEndpoints"
],
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean",
"default": false,
"title": "The enabled Schema",
"examples": [
false
]
},
"extraLabels": {
"type": "object",
"default": {},
"title": "The extraLabels Schema",
"required": [],
"properties": {},
"examples": [{}]
},
"annotations": {
"type": "object",
"default": {},
"title": "The annotations Schema",
"required": [],
"properties": {},
"examples": [{}]
},
"metricsEndpoints": {
"type": "array",
"default": [],
"title": "The metricsEndpoints Schema",
"items": {
"type": "object",
"default": {},
"title": "A Schema",
"required": [
"port"
],
"additionalProperties": false,
"properties": {
"port": {
"type": "string",
"default": "",
"title": "The port Schema",
"examples": [
"metrics"
]
}
},
"examples": [{
"port": "metrics"
}]
},
"examples": [
[{
"port": "metrics"
}]
]
}
},
"examples": [{
"enabled": false,
"extraLabels": {},
"annotations": {},
"metricsEndpoints": [{
"port": "metrics"
}]
}]
},
"type": "object",
"default": {},
"title": "The serviceMonitor Schema",
"required": [
"enabled",
"extraLabels",
"annotations",
"metricsEndpoints",
"relabelings",
"metricRelabelings"
],
"properties": {
"enabled": {
"type": "boolean",
"default": false,
"title": "The enabled Schema",
"examples": [
true
]
},
"extraLabels": {
"type": "object",
"default": {},
"title": "The extraLabels Schema",
"required": [],
"properties": {},
"examples": [{}]
},
"annotations": {
"type": "object",
"default": {},
"title": "The annotations Schema",
"required": [],
"properties": {},
"examples": [{}]
},
"metricsEndpoints": {
"type": "array",
"default": [],
"title": "The metricsEndpoints Schema",
"items": {
"type": "object",
"default": {},
"title": "A Schema",
"required": [
"port"
],
"properties": {
"port": {
"type": "string",
"default": "",
"title": "The port Schema",
"examples": [
"metrics"
]
}
},
"examples": [{
"port": "metrics"
}]
},
"examples": [
[{
"port": "metrics"
}]
]
},
"relabelings": {
"type": "array",
"description": "Specify general relabeling",
"default": [],
"items": {}
},
"metricRelabelings": {
"type": "array",
"description": "Specify additional relabeling of metrics",
"default": [],
"items": {}
}
},
"examples": [{
"enabled": true,
"extraLabels": {},
"annotations": {},
"metricsEndpoints": [{
"port": "metrics"
}],
"relabelings": [{
"sourceLabels": [
"__meta_kubernetes_pod_node_name"
],
"targetLabel": "node",
"replacement": "${1}"
}],
"metricRelabelings": []
}]
},
"deploymentAnnotations": {
"type": "object",
"default": {},
Expand Down
4 changes: 4 additions & 0 deletions charts/opentelemetry-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ manager:
annotations: {}
metricsEndpoints:
- port: metrics
# Used to set relabeling and metricRelabeling configs on the ServiceMonitor
# https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
relabelings: []
metricRelabelings: []

# Adds additional annotations to the manager Deployment
deploymentAnnotations: {}
Expand Down

0 comments on commit 9cde864

Please sign in to comment.