Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/helm-charts-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ jobs:
INFLUXDB_ENTERPRISE_LICENSE_KEY: "${{ secrets.INFLUXDB_ENTERPRISE_LICENSE_KEY }}"
if: steps.list-changed.outputs.changed == 'true'

- name: Create custom resources
run: |
kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/bundle.yaml
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
id: install
run: |
set -o pipefail;
ct install --namespace=default 2>&1 | tee $RUNNER_TEMP/$GITHUB_RUN_NUMBER.txt
# When https://github.com/helm/chart-testing/issues/212 is fixed, this can be used to set the license key instead of using env from secret
# run: ct install --namespace=default --helm-extra-args="--set license.key=${INFLUXDB_ENTERPRISE_LICENSE_KEY}"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/patterns.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Error loading config file
Release not loaded
2 changes: 1 addition & 1 deletion charts/telegraf/Chart.yaml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: telegraf
version: 1.8.23
version: 1.8.24
appVersion: 1.24.3
deprecated: false
description: Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics.
Expand Down
8 changes: 8 additions & 0 deletions charts/telegraf/ci/prometheus-monitor-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config:
outputs:
- prometheus_client:
listen: ":9273"
serviceMonitor:
create: true
labels:
team: losers
11 changes: 11 additions & 0 deletions charts/telegraf/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,17 @@ Create the name of the service account to use
{{- end -}}
{{- end -}}

{{/*
Create the name of the service monitor to use
*/}}
{{- define "telegraf.serviceMonitorName" -}}
{{- if .Values.serviceMonitor.create -}}
{{ default (include "telegraf.fullname" .) .Values.serviceMonitor.name }}
{{- else -}}
{{ default "default" .Values.serviceMonitor.name }}
{{- end -}}
{{- end -}}

{{/*
Get health configuration
*/}}
Expand Down
33 changes: 33 additions & 0 deletions charts/telegraf/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- if .Values.serviceMonitor.create }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Comment thread
Efrat19 marked this conversation as resolved.
name: {{ template "telegraf.serviceMonitorName" . }}
namespace: {{ .Values.serviceMonitor.namespaceOverride | default .Release.Namespace }}
labels:
{{- include "telegraf.labels" . | nindent 4 }}
Comment thread
alespour marked this conversation as resolved.
{{- if .Values.serviceMonitor.labels }}
{{- toYaml .Values.serviceMonitor.labels | nindent 4 }}
{{- end }}
{{- if .Values.serviceMonitor.annotations }}
annotations:
{{- toYaml .Values.serviceMonitor.annotations | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "telegraf.labels" . | nindent 6 }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
{{- range $objectKey, $objectValue := .Values.config.outputs }}
{{- range $key, $value := . -}}
{{- $tp := typeOf $value -}}
{{- if eq $key "prometheus_client" }}
- port: {{ trimPrefix ":" $value.listen }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

{{ (trimPrefix ":" $value.listen) | quote }} can correct the type issues.it is string instead of number

path: {{ $value.path | default "/metrics" }}
{{- end }}
{{- end -}}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/telegraf/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,24 @@ serviceAccount:
name:
# Annotations for the ServiceAccount
annotations: {}

# To make use of the serviceMonitorm, please add a prometheus_client entry to config.outputs:
# - prometheus_client:
# listen: ":9273"
# path: /metrics
serviceMonitor:
Comment thread
Efrat19 marked this conversation as resolved.
# Specifies whether a ServiceMonitor should be created
create: false
# The name of the ServiceMonitor to use.
# If not set and create is true, a name is generated using the fullname template
name:
# Extra Labels for the ServiceMonitor
labels: {}
# Annotations for the ServiceMonitor
annotations: {}
# To install the serviceMonitor in a different namespace than the release set its name here
# For example if your prometheus is <v0.19.0 the serviceMonitor must be installed in the prometheus namespace
namespaceOverride:
## Exposed telegraf configuration
## For full list of possible values see `/docs/all-config-values.yaml` and `/docs/all-config-values.toml`
## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/
Expand Down