Skip to content

Conversation

@duchieu2k
Copy link
Contributor

@duchieu2k duchieu2k commented Jan 23, 2026

Summary by CodeRabbit

  • New Features

    • Added a Telegraf monitoring chart with deployment, service, and configurable values.
    • InfluxDB integration with credential management via templated secret.
    • Service exposes UDP port 8094 for metric collection through the load balancer.
    • Added persistent storage for Telegraf configuration (shared PVC).
  • Chores

    • Fixed chart dependency file reference used during verification to ensure correct manifest lookup.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

Walkthrough

Adds a new Telegraf Helm chart (Chart, values, Deployment, Service, Secret), updates shared-volume and ingress-nginx values to support Telegraf (PVC and UDP port 8094), and fixes a CI workflow dependency check to reference Chart.yaml instead of Chart.yml.

Changes

Cohort / File(s) Summary
Telegraf Helm Chart
kubernetes/telegraf/Chart.yaml, kubernetes/telegraf/values.yaml, kubernetes/telegraf/templates/deployment.yaml, kubernetes/telegraf/templates/service.yaml, kubernetes/telegraf/templates/secret.yaml
New Helm chart and templates: chart metadata + dependency, values for images/probes/resources/influx config, Deployment with initContainer, affinity/nodeSelector/tolerations, shared-volume mounts, Secret for InfluxDB creds, Service exposing ports including UDP 8094.
Shared Volume
kubernetes/shared-volume/values.yaml
Adds telegraf-config entry to global.sharedPersistenceVolume (pvc telegraf-config-pvc, 10Mi, ReadWriteMany, seaweedfs-storage) to be shared with Telegraf.
Ingress NGINX values
kubernetes/ingress-nginx/values.yaml
Adds UDP service port entry telegraf (port 8094 / targetPort 8094) to service.portBackend.
CI Workflow
.github/workflows/main.yml
Fixes NMAA stacked_charts dependency existence check to reference Chart.yaml (was Chart.yml).

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer / CI
  participant K8s as Kubernetes API
  participant PVC as PersistentVolume
  participant Pod as telegraf Pod
  participant Influx as InfluxDB

  Dev->>K8s: Deploy Helm chart (Chart, values)
  K8s->>PVC: Provision/Bind `telegraf-config` PVC
  K8s->>Pod: Create Pod (initContainer + main)
  Pod->>Influx: initContainer waits for InfluxDB:8086
  Pod->>PVC: Mount shared volume (/home/telegraf/etc)
  K8s->>Pod: Start telegraf container
  K8s->>Pod: Service routes TCP/UDP (including UDP 8094) to Pod
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • vyvuvivo
  • tuhoanganh
  • phamtranlinhchi
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: Add new telegraf chart' accurately summarizes the main change—introducing a new Helm chart for telegraf with all supporting configuration files, templates, and values.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@kubernetes/telegraf/templates/deployment.yaml`:
- Around line 88-93: The deployment template's ports block uses protocol: {{
.protocol | default "UDP" }} which conflicts with the service template default
of "TCP"; update one of them so both default to the same protocol or require
explicit protocol in values. Locate the ports loop in the deployment template
(the range over .Values.service.ports and the protocol field) and change the
default to match the service template's default ("TCP") or vice versa, or add
validation/documentation to force protocol entries in values.yaml so .protocol
is always provided.
- Around line 47-65: The initContainer telegraf-init creates UID 101 and chowns
shared volumes, but the main Telegraf container lacks a securityContext so it
may run as root; update the chart values to ensure the main container runs as
UID 101 by adding securityContext.runAsUser: 101 and securityContext.runAsGroup:
101 (or set podSecurityContext with fsGroup: 101) in the Telegraf deployment
values (values.yaml) so the primary container process uses the same UID/GID as
the chowned files.

In `@kubernetes/telegraf/templates/service.yaml`:
- Around line 26-29: The condition/usage mismatch in the Helm template: the if
checks .Values.global.externalIPs (plural) but the block uses
.Values.global.externalIP (singular); fix by choosing one convention and
updating the template accordingly — either change the condition to check
.Values.global.externalIP when you expect a single IP, or (preferably) treat
externalIPs as a list and output it consistently by referencing
.Values.global.externalIPs (or iterating over it) in the service.yaml template;
update the template block that currently references .Values.global.externalIP to
use the chosen plural variable (.Values.global.externalIPs) or iterate so the
rendered externalIPs field matches the values file.

In `@kubernetes/telegraf/values.yaml`:
- Around line 130-136: The values file currently commits real-looking InfluxDB
credentials (influxdb_user and influxdb_password) which must be removed; replace
them with obvious placeholders (e.g., CHANGE_ME) for influxdb_user and
influxdb_password, add a short inline YAML comment near config explaining these
must be changed for production, and update documentation/README to instruct
operators to override these via helm --set or a separate values file (or use
sealed/managed secrets) for secure production deployments; ensure the other
related keys (influxdb_host, influxdb_port, influxdb_database,
influxdb_skip_database_creation) remain intact but note in the comment that
credentials should come from secrets.
🧹 Nitpick comments (2)
kubernetes/telegraf/templates/service.yaml (1)

4-4: Consider using common.names.fullname for consistency with the deployment.

The service name uses .Chart.Name directly, while the deployment (line 4) uses {{ include "common.names.fullname" . }}. This inconsistency could cause selector mismatches if release naming affects the fullname.

♻️ Proposed fix
-  name: {{ .Chart.Name }}
+  name: {{ include "common.names.fullname" . }}
kubernetes/telegraf/templates/deployment.yaml (1)

142-143: Hardcoded imagePullSecrets reduces flexibility.

The ghcr-pull-secret is hardcoded. Consider making this configurable via values for environments using different registries or secret names.

♻️ Proposed fix
       imagePullSecrets:
-      - name: ghcr-pull-secret
+      {{- if .Values.imagePullSecrets }}
+      {{- toYaml .Values.imagePullSecrets | nindent 6 }}
+      {{- else }}
+      - name: ghcr-pull-secret
+      {{- end }}

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@kubernetes/telegraf/templates/service.yaml`:
- Around line 4-5: The service metadata uses .Chart.Name which ignores Helm
release/nameOverride/fullnameOverride and should use the common naming helper;
replace the hardcoded name .Chart.Name in the service template with the helper
include "common.names.fullname" (same helper used by deployment.yaml and
secret.yaml) so the service honors overrides and avoids name collisions.

Comment on lines +4 to +5
name: {{ .Chart.Name }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Step 1: Find and examine the common chart helpers, especially the fullname helper
echo "=== Searching for common.names.fullname definition ==="
rg -n 'define "common.names.fullname"' -g '*tpl' -g '*common*'

echo -e "\n=== Searching for common.names.fullname and common.names.name usage in telegraf ==="
rg -n 'common\.names\.fullname|common\.names\.name' kubernetes/telegraf -g '*.yaml' -g '*.tpl'

echo -e "\n=== Checking .Chart.Name usage in telegraf templates ==="
rg -n '\.Chart\.Name' kubernetes/telegraf/templates -g '*.yaml'

echo -e "\n=== Examining the service.yaml file context ==="
cat -n kubernetes/telegraf/templates/service.yaml | head -30

Repository: svtechnmaa/charts

Length of output: 3268


🏁 Script executed:

#!/bin/bash
# Additional verification: Examine what the common.names.fullname helper does
echo "=== Examining common.names.fullname helper implementation ==="
cat -n kubernetes/common/templates/_names.tpl | sed -n '21,35p'

echo -e "\n=== Check context: What does metadata.name use in deployment and secret? ==="
echo "--- deployment.yaml lines 1-10 ---"
cat -n kubernetes/telegraf/templates/deployment.yaml | head -10

echo -e "\n--- secret.yaml lines 1-10 ---"
cat -n kubernetes/telegraf/templates/secret.yaml | head -10

Repository: svtechnmaa/charts

Length of output: 1745


Use common name helper to honor release/nameOverride/fullnameOverride.

.Chart.Name ignores Helm's naming overrides and breaks consistency with other resources in the chart. The deployment.yaml and secret.yaml both use the proper common.names.fullname helper for their metadata names, while this service uses .Chart.Name directly. This inconsistency can cause collisions when multiple releases are installed in the same namespace and prevents users from overriding the service name.

🐛 Proposed fix
 metadata:
-  name: {{ .Chart.Name }}
+  name: {{ include "common.names.fullname" . }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
name: {{ .Chart.Name }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
🧰 Tools
🪛 YAMLlint (1.38.0)

[error] 5-5: syntax error: expected the node content, but found '-'

(syntax)

🤖 Prompt for AI Agents
In `@kubernetes/telegraf/templates/service.yaml` around lines 4 - 5, The service
metadata uses .Chart.Name which ignores Helm
release/nameOverride/fullnameOverride and should use the common naming helper;
replace the hardcoded name .Chart.Name in the service template with the helper
include "common.names.fullname" (same helper used by deployment.yaml and
secret.yaml) so the service honors overrides and avoids name collisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants