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
2 changes: 2 additions & 0 deletions charts/telegraf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ To configure the chart, do either of the following:

> **Tip**: Use the default [values.yaml](values.yaml).

Use `namespaceOverride` when you need the chart to render namespaced resources into a specific namespace during Helm template rendering, such as Kustomize or Argo CD workflows.

## Telegraf configuration

Telegraf configuration is generated by YAML to TOML conversion of `.Values.config` entry.
Expand Down
6 changes: 3 additions & 3 deletions charts/telegraf/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
To open a shell session in the container running Telegraf run the following:

kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app.kubernetes.io/name={{ include "telegraf.fullname" . }} -o jsonpath='{.items[0].metadata.name}') /bin/sh
kubectl exec -i -t --namespace {{ include "telegraf.namespace" . }} $(kubectl get pods --namespace {{ include "telegraf.namespace" . }} -l app.kubernetes.io/name={{ include "telegraf.fullname" . }} -o jsonpath='{.items[0].metadata.name}') /bin/sh

To view the logs for a Telegraf pod, run the following:

kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app.kubernetes.io/name={{ include "telegraf.fullname" . }} -o jsonpath='{ .items[0].metadata.name }')
kubectl logs -f --namespace {{ include "telegraf.namespace" . }} $(kubectl get pods --namespace {{ include "telegraf.namespace" . }} -l app.kubernetes.io/name={{ include "telegraf.fullname" . }} -o jsonpath='{ .items[0].metadata.name }')

{{- if eq .Values.service.type "LoadBalancer" }}

To watch for the LoadBalancer IP run the following:

kubectl get svc -w --namespace {{ .Release.Namespace }} -l app.kubernetes.io/name={{ include "telegraf.fullname" . }}
kubectl get svc -w --namespace {{ include "telegraf.namespace" . }} -l app.kubernetes.io/name={{ include "telegraf.fullname" . }}
{{- end }}
11 changes: 11 additions & 0 deletions charts/telegraf/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Allow the release namespace to be overridden for namespaced resources.
*/}}
{{- define "telegraf.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}

{{/*
Expand the name of the chart.
*/}}
Expand Down
1 change: 1 addition & 0 deletions charts/telegraf/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "telegraf.fullname" . }}
namespace: {{ include "telegraf.namespace" . }}
labels:
{{- include "telegraf.labels" . | nindent 4 }}
data:
Expand Down
1 change: 1 addition & 0 deletions charts/telegraf/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "telegraf.fullname" . }}
namespace: {{ include "telegraf.namespace" . }}
labels:
{{- include "telegraf.labels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions charts/telegraf/templates/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{ include "telegraf.fullname" . }}
namespace: {{ include "telegraf.namespace" . }}
labels:
{{- include "telegraf.labels" . | nindent 4 }}
spec:
Expand Down
4 changes: 3 additions & 1 deletion charts/telegraf/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ kind: Role
{{- end }}
metadata:
name: {{ template "telegraf.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- if not .Values.rbac.clusterWide }}
namespace: {{ include "telegraf.namespace" . }}
{{- end }}
labels:
{{- include "telegraf.labels" . | nindent 4 }}
rules:
Expand Down
5 changes: 4 additions & 1 deletion charts/telegraf/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ kind: RoleBinding
{{- end }}
metadata:
name: {{ template "telegraf.fullname" . }}
{{- if not .Values.rbac.clusterWide }}
namespace: {{ include "telegraf.namespace" . }}
{{- end }}
labels:
{{- include "telegraf.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ template "telegraf.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "telegraf.namespace" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
{{- if .Values.rbac.clusterWide }}
Expand Down
1 change: 1 addition & 0 deletions charts/telegraf/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "telegraf.fullname" . }}
namespace: {{ include "telegraf.namespace" . }}
labels:
{{- include "telegraf.labels" . | nindent 4 }}
{{- if .Values.service.annotations }}
Expand Down
1 change: 1 addition & 0 deletions charts/telegraf/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "telegraf.serviceAccountName" . }}
namespace: {{ include "telegraf.namespace" . }}
labels:
{{- include "telegraf.labels" . | nindent 4 }}
{{- if .Values.serviceAccount.annotations }}
Expand Down
3 changes: 3 additions & 0 deletions charts/telegraf/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
## This is a YAML-formatted file.
## ref: https://hub.docker.com/r/library/telegraf/tags/

# Override the namespace for namespaced resources in this chart.
namespaceOverride: ""

replicaCount: 1
image:
repo: "docker.io/library/telegraf"
Expand Down