Skip to content

Commit

Permalink
[opentelemetry-kube-stack] Add the helper for servicemonitor.scrapeLi… (
Browse files Browse the repository at this point in the history
open-telemetry#1455)

* [opentelemetry-kube-stack] Add the helper for servicemonitor.scrapeLimits

* naming

* version bump, make gen
  • Loading branch information
cabrinha authored and jtyr committed Dec 23, 2024
1 parent fc9469c commit 06bfb9f
Show file tree
Hide file tree
Showing 26 changed files with 45 additions and 26 deletions.
2 changes: 1 addition & 1 deletion charts/opentelemetry-kube-stack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: opentelemetry-kube-stack
version: 0.3.6
version: 0.3.7
description: |
OpenTelemetry Quickstart chart for Kubernetes.
Installs an operator and collector for an easy way to get started with Kubernetes observability.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: OpAMPBridge
metadata:
name: example
labels:
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: example-cluster-stats
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down Expand Up @@ -187,7 +187,7 @@ metadata:
name: example-daemon
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ spec:
- -c
- |
kubectl delete instrumentations,opampbridges,opentelemetrycollectors \
-l helm.sh/chart=opentelemetry-kube-stack-0.3.6
-l helm.sh/chart=opentelemetry-kube-stack-0.3.7
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: Instrumentation
metadata:
name: example
labels:
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: example-daemon
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
namespace: default
labels:
app: opentelemetry-kube-stack-apiserver
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: opentelemetry-kube-stack-kube-controller-manager
jobLabel: kube-controller-manager
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
namespace: default
labels:
app: opentelemetry-kube-stack-kube-controller-manager
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: opentelemetry-kube-stack-kube-dns
jobLabel: kube-dns
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
namespace: default
labels:
app: opentelemetry-kube-stack-kube-dns
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: opentelemetry-kube-stack-kube-etcd
jobLabel: kube-etcd
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
namespace: default
labels:
app: opentelemetry-kube-stack-kube-etcd
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: opentelemetry-kube-stack-kube-proxy
jobLabel: kube-proxy
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
namespace: default
labels:
app: opentelemetry-kube-stack-kube-proxy
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: opentelemetry-kube-stack-kube-scheduler
jobLabel: kube-scheduler
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
namespace: default
labels:
app: opentelemetry-kube-stack-kube-scheduler
helm.sh/chart: opentelemetry-kube-stack-0.3.6
helm.sh/chart: opentelemetry-kube-stack-0.3.7
app.kubernetes.io/version: "0.107.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ spec:
- -c
- |
kubectl delete instrumentations,opampbridges,opentelemetrycollectors \
-l helm.sh/chart=opentelemetry-kube-stack-0.3.6
-l helm.sh/chart=opentelemetry-kube-stack-0.3.7
19 changes: 19 additions & 0 deletions charts/opentelemetry-kube-stack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,22 @@ Helpers for prometheus servicemonitors
{{- $userValue := index . 3 -}}
{{- include "opentelemetry-kube-stack.kubeVersionDefaultValue" (list $values ">= 1.23-0" $insecure $secure $userValue) -}}
{{- end -}}
{{/* Sets default scrape limits for servicemonitor */}}
{{- define "opentelemetry-kube-stack.servicemonitor.scrapeLimits" -}}
{{- with .sampleLimit }}
sampleLimit: {{ . }}
{{- end }}
{{- with .targetLimit }}
targetLimit: {{ . }}
{{- end }}
{{- with .labelLimit }}
labelLimit: {{ . }}
{{- end }}
{{- with .labelNameLengthLimit }}
labelNameLengthLimit: {{ . }}
{{- end }}
{{- with .labelValueLengthLimit }}
labelValueLengthLimit: {{ . }}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
{{ include "opentelemetry-kube-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.coreDns.serviceMonitor.jobLabel }}
{{- include "servicemonitor.scrapeLimits" .Values.coreDns.serviceMonitor | nindent 2 }}
{{- include "opentelemetry-kube-stack.servicemonitor.scrapeLimits" .Values.coreDns.serviceMonitor | nindent 2 }}
selector:
{{- if .Values.coreDns.serviceMonitor.selector }}
{{ tpl (toYaml .Values.coreDns.serviceMonitor.selector | nindent 4) . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ metadata:
{{- end }}
{{ include "opentelemetry-kube-stack.labels" . | indent 4 }}
spec:
{{- include "servicemonitor.scrapeLimits" .Values.kubeApiServer.serviceMonitor | nindent 2 }}
{{- include "opentelemetry-kube-stack.servicemonitor.scrapeLimits" .Values.kubeApiServer.serviceMonitor | nindent 2 }}
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
{{- if .Values.kubeApiServer.serviceMonitor.interval }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
{{ include "opentelemetry-kube-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.kubeControllerManager.serviceMonitor.jobLabel }}
{{- include "servicemonitor.scrapeLimits" .Values.kubeControllerManager.serviceMonitor | nindent 2 }}
{{- include "opentelemetry-kube-stack.servicemonitor.scrapeLimits" .Values.kubeControllerManager.serviceMonitor | nindent 2 }}
selector:
{{- if .Values.kubeControllerManager.serviceMonitor.selector }}
{{ tpl (toYaml .Values.kubeControllerManager.serviceMonitor.selector | nindent 4) . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
{{ include "opentelemetry-kube-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.kubeDns.serviceMonitor.jobLabel }}
{{- include "servicemonitor.scrapeLimits" .Values.kubeDns.serviceMonitor | nindent 2 }}
{{- include "opentelemetry-kube-stack.servicemonitor.scrapeLimits" .Values.kubeDns.serviceMonitor | nindent 2 }}
selector:
{{- if .Values.kubeDns.serviceMonitor.selector }}
{{ tpl (toYaml .Values.kubeDns.serviceMonitor.selector | nindent 4) . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
{{ include "opentelemetry-kube-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.kubeEtcd.serviceMonitor.jobLabel }}
{{- include "servicemonitor.scrapeLimits" .Values.kubeEtcd.serviceMonitor | nindent 4 }}
{{- include "opentelemetry-kube-stack.servicemonitor.scrapeLimits" .Values.kubeEtcd.serviceMonitor | nindent 4 }}
selector:
{{- if .Values.kubeEtcd.serviceMonitor.selector }}
{{ tpl (toYaml .Values.kubeEtcd.serviceMonitor.selector | nindent 4) . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
{{ include "opentelemetry-kube-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.kubeProxy.serviceMonitor.jobLabel }}
{{- include "servicemonitor.scrapeLimits" .Values.kubeProxy.serviceMonitor | nindent 2 }}
{{- include "opentelemetry-kube-stack.servicemonitor.scrapeLimits" .Values.kubeProxy.serviceMonitor | nindent 2 }}
selector:
{{- if .Values.kubeProxy.serviceMonitor.selector }}
{{ tpl (toYaml .Values.kubeProxy.serviceMonitor.selector | nindent 4) . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
{{ include "opentelemetry-kube-stack.labels" . | indent 4 }}
spec:
jobLabel: {{ .Values.kubeScheduler.serviceMonitor.jobLabel }}
{{- include "servicemonitor.scrapeLimits" .Values.kubeScheduler.serviceMonitor | nindent 2 }}
{{- include "opentelemetry-kube-stack.servicemonitor.scrapeLimits" .Values.kubeScheduler.serviceMonitor | nindent 2 }}
selector:
{{- if .Values.kubeScheduler.serviceMonitor.selector }}
{{ tpl (toYaml .Values.kubeScheduler.serviceMonitor.selector | nindent 4) . }}
Expand Down

0 comments on commit 06bfb9f

Please sign in to comment.