Skip to content

Improved Helm Chart Templates#215

Open
sdibernardo wants to merge 7 commits intobeelzebub-labs:mainfrom
sdibernardo:main
Open

Improved Helm Chart Templates#215
sdibernardo wants to merge 7 commits intobeelzebub-labs:mainfrom
sdibernardo:main

Conversation

@sdibernardo
Copy link

@sdibernardo sdibernardo commented Aug 28, 2025

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you lint your code locally before submission?

Summary by CodeRabbit

  • New Features
    • Generates separate configuration resources and ConfigMaps per service.
    • Deployments mount individual service configs and create per-service volumes and mounts.
    • Container ports are exposed per service, derived from each service config.
    • Service publishes multiple named ports based on each service’s configuration.
  • Tests
    • Health/check tests now run per-service (creates a check container per configured service).

Signed-off-by: Sascha Di Bernardo <Sascha.diBernardo@viadee.de>
Signed-off-by: Sascha Di Bernardo <Sascha.diBernardo@viadee.de>
Signed-off-by: Sascha Di Bernardo <Sascha.diBernardo@viadee.de>
Signed-off-by: Sascha Di Bernardo <Sascha.diBernardo@viadee.de>
@coderabbitai
Copy link

coderabbitai bot commented Aug 28, 2025

Walkthrough

Templates were converted from a single aggregated service config to per-service resources: one ConfigMap, volume, mount, port, and test container per entry in .Values.beelzebubServiceConfigs; names and ports are derived from each entry’s name and config.address.

Changes

Cohort / File(s) Summary
Per-service ConfigMaps
beelzebub-chart/templates/configmap_services.yaml
Replaced one aggregated ConfigMap with multiple ConfigMaps, one per entry in .Values.beelzebubServiceConfigs. ConfigMap names are beelzebub-services-cm-{{ $safeName }}; each data key is the entry name and holds that entry's YAML (value.config).
Deployment volumes, mounts, and containerPorts
beelzebub-chart/templates/deployment.yaml
Replaced single service-config volume/mount and static containerPort with per-entry volumes, mounts, and containerPort definitions produced by looping .Values.beelzebubServiceConfigs. Volumes reference the per-service ConfigMaps; mounts use subPath of the entry name; containerPort derives from value.config.address with fallback to .Values.service.port. Core config volume unchanged.
Service ports
beelzebub-chart/templates/service.yaml
Replaced single port entry with a loop over .Values.beelzebubServiceConfigs, emitting one Service port per entry. Port name derived from the trimmed filename; targetPort derived from value.config.address (trimPrefix ":"), replacing the previous fixed "http" mapping.
Test Pod containers
beelzebub-chart/templates/tests/test-connection.yaml
Replaced single wget test container with a loop producing one wget container per .Values.beelzebubServiceConfigs entry; each container targets the corresponding fullname and port derived from value.config.address.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as Helm User
  participant H as Helm Template Engine
  participant K as Kubernetes API
  participant D as Deployment/Pod
  participant S as Service

  rect rgba(227,246,255,0.5)
    note over U,H: Template render using .Values.beelzebubServiceConfigs
    U->>H: helm install/upgrade with values
    H-->>U: Manifests: N ConfigMaps, Deployment, Service, Test Pod
  end

  rect rgba(240,255,240,0.5)
    note over U,K: Apply manifests
    U->>K: kubectl apply (Helm)
    K-->>U: Creates N ConfigMaps (beelzebub-services-cm-<name>)
    K-->>U: Updates Deployment (adds N volumes/mounts, containerPorts)
    K-->>U: Updates Service (adds N named ports)
  end

  rect rgba(255,249,227,0.5)
    note over D,S: Runtime wiring
    K-->>D: Pod mounts per-service ConfigMaps (subPath = entry name)
    K-->>S: Service exposes named ports per entry
    D-->>S: Containers listen on ports derived from each config.address
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

I nibble configs, one by one,
Names trimmed neat beneath the sun.
Volumes hop to each small pod,
Ports now dance where once was sod.
A hungry rabbit cheers the run. 🥕

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sdibernardo
Copy link
Author

I feel like to original Helm Chart was not that easy to work with out of the box and thus decided to propose changes as seen in the PR.

Feel free to discuss and I'm open to any kind of feedback.

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: 5

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b231f24 and 399e30c.

📒 Files selected for processing (3)
  • beelzebub-chart/templates/configmap_services.yaml (1 hunks)
  • beelzebub-chart/templates/deployment.yaml (2 hunks)
  • beelzebub-chart/templates/ingress.yaml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
beelzebub-chart/templates/configmap_services.yaml

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

(syntax)

🔇 Additional comments (1)
beelzebub-chart/templates/deployment.yaml (1)

40-45: Sanitize volume names & guard subPath

  • Derive and use $safeName for name: config-services-volume-… exactly as you do for the ConfigMap to keep them in sync.
  • Ensure $value.name cannot contain / (invalid for subPath) or sanitize it upstream.

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

♻️ Duplicate comments (3)
beelzebub-chart/templates/configmap_services.yaml (1)

1-2: Compute and reuse a DNS-1123-safe name per item; use it for resource names.

$value.name can contain dots/uppercase and break K8s naming. Compute $safeName once and reuse.

Apply:

-{{- range $value := .Values.beelzebubServiceConfigs }}
+{{- range $value := .Values.beelzebubServiceConfigs }}
+{{- $trimmed := trimSuffix ".yaml" $value.name -}}
+{{- $safeName := (regexReplaceAll "[^a-z0-9-]" (lower $trimmed) "-" ) | trimAll "-" | trunc 63 -}}
 ---
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: beelzebub-services-cm-{{ trimSuffix ".yaml" $value.name }}
+  name: beelzebub-services-cm-{{ $safeName }}

Also applies to: 6-6

beelzebub-chart/templates/deployment.yaml (2)

40-46: Use a single sanitized name for volumeMount names; keep user-facing paths intact.

Volume names must be DNS-1123 compliant. Compute $safeName once and reuse.

-            {{- range $index, $value := .Values.beelzebubServiceConfigs }}
-            - name: config-services-volume-{{ trimSuffix ".yaml" $value.name }}
+            {{- range $index, $value := .Values.beelzebubServiceConfigs }}
+            {{- $trimmed := trimSuffix ".yaml" $value.name -}}
+            {{- $safeName := (regexReplaceAll "[^a-z0-9-]" (lower $trimmed) "-" ) | trimAll "-" | trunc 63 -}}
+            - name: config-services-volume-{{ $safeName }}
               mountPath: /configurations/services/{{ $value.name }}
               subPath: {{ $value.name }}
               readOnly: true
             {{- end }}

67-71: Keep volume names and referenced ConfigMap names in sync using the same $safeName.

Prevents mismatch and ensures DNS-1123 compliance.

-        {{- range $index, $value := .Values.beelzebubServiceConfigs }}
-        - name: config-services-volume-{{ trimSuffix ".yaml" $value.name }}
+        {{- range $index, $value := .Values.beelzebubServiceConfigs }}
+        {{- $trimmed := trimSuffix ".yaml" $value.name -}}
+        {{- $safeName := (regexReplaceAll "[^a-z0-9-]" (lower $trimmed) "-" ) | trimAll "-" | trunc 63 -}}
+        - name: config-services-volume-{{ $safeName }}
           configMap:
-            name: beelzebub-services-cm-{{ trimSuffix ".yaml" $value.name }}
+            name: beelzebub-services-cm-{{ $safeName }}
         {{- end }}

Render and diff-check:

#!/bin/bash
set -e
helm template beelzebub ./beelzebub-chart > /tmp/r.yaml
# Ensure every volume name has a matching ConfigMap name suffix
awk '/- name: config-services-volume-/{print $4}' /tmp/r.yaml | sed 's/-$//' > /tmp/vn
rg -n 'name:\s+beelzebub-services-cm-' /tmp/r.yaml | sed 's/.*cm-//' > /tmp/cn
diff -u /tmp/vn /tmp/cn
🧹 Nitpick comments (1)
beelzebub-chart/templates/deployment.yaml (1)

16-19: Add config checksum annotations to trigger rolling updates on config changes.

Without checksums, new ConfigMap data won’t roll pods automatically.

Outside this hunk, add under pod template metadata.annotations:

      annotations:
        {{- range $v := .Values.beelzebubServiceConfigs }}
        {{- $trimmed := trimSuffix ".yaml" $v.name -}}
        {{- $safeName := (regexReplaceAll "[^a-z0-9-]" (lower $trimmed) "-" ) | trimAll "-" | trunc 63 -}}
        checksum/config-{{ $safeName }}: {{ toYaml $v.config | sha256sum }}
        {{- end }}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 399e30c and 13da6ce.

📒 Files selected for processing (3)
  • beelzebub-chart/templates/configmap_services.yaml (1 hunks)
  • beelzebub-chart/templates/deployment.yaml (2 hunks)
  • beelzebub-chart/templates/service.yaml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
beelzebub-chart/templates/service.yaml

[warning] 11-11: wrong indentation: expected 2 but found 4

(indentation)

beelzebub-chart/templates/configmap_services.yaml

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

(syntax)

🔇 Additional comments (2)
beelzebub-chart/templates/configmap_services.yaml (1)

1-2: Wrap the range in an if to guard against empty beelzebubServiceConfigs.

-{{- range $value := .Values.beelzebubServiceConfigs }}
+{{- if .Values.beelzebubServiceConfigs }}
+{{- range $value := .Values.beelzebubServiceConfigs }}-{{- end }}
+{{- end }}
+{{- end }}

Render locally with an empty beelzebubServiceConfigs list to confirm no standalone --- is emitted.

beelzebub-chart/templates/service.yaml (1)

10-15: Extract numeric port and sanitize service port names

  • Replace trimPrefix ":" with regexFind "[0-9]+$" (fallback to .Values.service.port) to correctly parse addresses like host:port.
  • Sanitize each ServicePort name as a valid DNS-1123 label: lowercase, replace non-alphanumerics with -, trim leading/trailing -, and truncate to 63 characters.
  • You don’t need to enforce unique numeric port values—Kubernetes only requires each ServicePort name to be unique.

Likely an incorrect or invalid review comment.

Comment on lines +48 to +52
{{- range $value := .Values.beelzebubServiceConfigs }}
- name: {{ trimSuffix ".yaml" $value.name }}
containerPort: {{ trimPrefix ":" $value.config.address | default $.Values.service.port }}
protocol: TCP
{{- end }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Robustly parse containerPort and sanitize port names.

Handle host:port and missing address; ensure containerPort is numeric; sanitize the name.

-            {{- range $value := .Values.beelzebubServiceConfigs }}
-            - name: {{ trimSuffix ".yaml" $value.name }}
-              containerPort: {{ trimPrefix ":" $value.config.address | default $.Values.service.port }}
+            {{- range $value := .Values.beelzebubServiceConfigs }}
+            {{- $trimmed := trimSuffix ".yaml" $value.name -}}
+            {{- $safeName := (regexReplaceAll "[^a-z0-9-]" (lower $trimmed) "-" ) | trimAll "-" | trunc 63 -}}
+            {{- $raw := $value.config.address | default (printf ":%v" $.Values.service.port) -}}
+            {{- $portStr := regexFind "[0-9]+$" $raw | default (printf "%v" $.Values.service.port) -}}
+            {{- $port := $portStr | int -}}
+            - name: {{ $safeName }}
+              containerPort: {{ $port }}
               protocol: TCP
-            {{- end }}  
+            {{- end }}
📝 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
{{- range $value := .Values.beelzebubServiceConfigs }}
- name: {{ trimSuffix ".yaml" $value.name }}
containerPort: {{ trimPrefix ":" $value.config.address | default $.Values.service.port }}
protocol: TCP
{{- end }}
{{- range $value := .Values.beelzebubServiceConfigs }}
{{- $trimmed := trimSuffix ".yaml" $value.name -}}
{{- $safeName := (regexReplaceAll "[^a-z0-9-]" (lower $trimmed) "-" ) | trimAll "-" | trunc 63 -}}
{{- $raw := $value.config.address | default (printf ":%v" $.Values.service.port) -}}
{{- $portStr := regexFind "[0-9]+$" $raw | default (printf "%v" $.Values.service.port) -}}
{{- $port := $portStr | int -}}
- name: {{ $safeName }}
containerPort: {{ $port }}
protocol: TCP
{{- end }}
🤖 Prompt for AI Agents
In beelzebub-chart/templates/deployment.yaml around lines 48-52, the port/name
templating must robustly handle host:port formats, missing addresses, ensure
containerPort is numeric, and sanitize the name: extract the port by splitting
on ":" and taking the last segment (so host:port -> port), fallback to
$.Values.service.port when address is empty, coerce the port to an integer (use
toInt or int conversion) and provide a safe default if conversion fails, and
sanitize the name by trimming suffix ".yaml" then lowercasing and replacing any
disallowed characters with "-" (use regexReplaceAll("[^a-z0-9-]", "-") and trim
leading/trailing "-") so the resulting name and containerPort are valid.

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: 3

🧹 Nitpick comments (3)
beelzebub-chart/templates/configmap_services.yaml (2)

1-3: Good: per-item sanitization for DNS-1123 names.

Deriving and reusing a sanitized $safeName per entry is the right move. Consider centralizing this logic in a named template helper (e.g., "beelzebub-chart.sanitizeName") to avoid duplication across templates.


4-12: ConfigMap data rendering looks correct; consider adding standard labels.

Block scalar with toYaml | nindent 4 is valid for string data. Add chart labels for traceability and selectors consistency.

Apply:

 metadata:
   name: beelzebub-services-cm-{{ $safeName }}
+  labels:
+    {{- include "beelzebub-chart.labels" . | nindent 4 }}
beelzebub-chart/templates/tests/test-connection.yaml (1)

11-16: Optional: pin BusyBox tag and add minimal retries.

Pinning avoids pulling a moving target; simple retry improves test robustness.

-      image: busybox
+      image: busybox:1.36
+      # Optional: add backoff/retry
+      # command: ['sh','-c']
+      # args: ['for i in 1 2 3; do wget -S -T3 {{ include "beelzebub-chart.fullname" $ }}:{{ $port }} && exit 0; sleep 2; done; exit 1']
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 13da6ce and f681266.

📒 Files selected for processing (4)
  • beelzebub-chart/templates/configmap_services.yaml (1 hunks)
  • beelzebub-chart/templates/deployment.yaml (2 hunks)
  • beelzebub-chart/templates/service.yaml (1 hunks)
  • beelzebub-chart/templates/tests/test-connection.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • beelzebub-chart/templates/deployment.yaml
🧰 Additional context used
🪛 YAMLlint (1.37.1)
beelzebub-chart/templates/tests/test-connection.yaml

[warning] 12-12: wrong indentation: expected 2 but found 4

(indentation)

beelzebub-chart/templates/configmap_services.yaml

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

(syntax)

beelzebub-chart/templates/service.yaml

[warning] 11-11: wrong indentation: expected 2 but found 4

(indentation)

🔇 Additional comments (2)
beelzebub-chart/templates/service.yaml (1)

10-15: Verify Service port uniqueness: Duplicate numeric ports or sanitized name values will prevent Service creation; please render the chart (e.g., with helm template) and confirm all port: and name: entries under the Service are unique.

beelzebub-chart/templates/tests/test-connection.yaml (1)

11-16: Cannot verify container names without Helm
Helm isn’t available in this environment—please run helm template beelzebub ./beelzebub-chart locally and confirm the rendered Pod spec has unique name: entries for each container.

Comment on lines +10 to +15
{{- range $value := .Values.beelzebubServiceConfigs }}
- port: {{ trimPrefix ":" $value.config.address }}
targetPort: {{ trimPrefix ":" $value.config.address }}
protocol: TCP
name: http
name: {{ trimSuffix ".yaml" $value.name }}
{{- end }}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Address parsing is brittle; trimPrefix ":" fails for hosts like 0.0.0.0:8080.

Use a regex to extract the trailing port. Current rendering will break if address includes a host.

Included in the diff above via regexFind "[0-9]{2,5}$".

🧰 Tools
🪛 YAMLlint (1.37.1)

[warning] 11-11: wrong indentation: expected 2 but found 4

(indentation)

🤖 Prompt for AI Agents
In beelzebub-chart/templates/service.yaml around lines 10 to 15, the current use
of trimPrefix ":" to get the port is brittle for addresses that include a host
(e.g. 0.0.0.0:8080); update the template to extract the trailing port with a
regex (e.g. use regexFind "[0-9]{2,5}$" on $value.config.address), use the regex
result for both port and targetPort, and add a safe fallback (default port or
skip the entry) if the regex returns empty so rendering won't fail.

⚠️ Potential issue

Port name may violate IANA_SVC_NAME (length ≤15, lowercase, a-z start); sanitize and ensure uniqueness.

{{ trimSuffix ".yaml" $value.name }} can exceed 15 chars, include invalid chars, or start with a digit. Also, duplicates across entries will be rejected. Sanitize and cap to 15, and suffix with the loop index if needed.

Apply:

-  ports:
-    {{- range $value := .Values.beelzebubServiceConfigs }}
-    - port: {{ trimPrefix ":" $value.config.address }}
-      targetPort: {{ trimPrefix ":" $value.config.address }}
-      protocol: TCP
-      name: {{ trimSuffix ".yaml" $value.name }}
-    {{- end }}
+  ports:
+    {{- range $i, $value := .Values.beelzebubServiceConfigs }}
+    {{- $trimmed := trimSuffix ".yaml" $value.name -}}
+    {{- $base := (regexReplaceAll "[^a-z0-9-]" (lower $trimmed) "-" ) | trimAll "-" -}}
+    {{- $portName := trunc 15 $base -}}
+    - port: {{ (regexFind "[0-9]{2,5}$" (toString $value.config.address)) | default (toString .Values.service.port) }}
+      targetPort: {{ (regexFind "[0-9]{2,5}$" (toString $value.config.address)) | default (toString .Values.service.port) }}
+      protocol: TCP
+      name: {{ $portName }}-{{ $i }}
+    {{- end }}

Note: If you want to strictly enforce starting with a letter, prefix with p- when it doesn’t. I can provide a helper to do this cleanly.

🧰 Tools
🪛 YAMLlint (1.37.1)

[warning] 11-11: wrong indentation: expected 2 but found 4

(indentation)

Comment on lines +11 to +16
{{- range $value := .Values.beelzebubServiceConfigs }}
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "beelzebub-chart.fullname" . }}:{{ .Values.service.port }}']
args: ['{{ include "beelzebub-chart.fullname" . }}:{{ trimPrefix ":" $value.config.address }}']
{{- end }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Duplicate container names and wrong template scope inside range.

  • All containers use name: wget; container names must be unique.
  • include "…fullname" . passes the loop item (not the root) due to range; use $ for the root.
  • Address parsing should tolerate host:port (same concern as Service).

Apply:

-  containers:
-    {{- range $value := .Values.beelzebubServiceConfigs }}
-    - name: wget
+  containers:
+    {{- range $i, $value := .Values.beelzebubServiceConfigs }}
+    {{- $trimmed := trimSuffix ".yaml" $value.name -}}
+    {{- $safeName := (regexReplaceAll "[^a-z0-9-]" (lower $trimmed) "-" ) | trimAll "-" | trunc 63 -}}
+    {{- $port := (regexFind "[0-9]{2,5}$" (toString $value.config.address)) | default (toString .Values.service.port) -}}
+    - name: wget-{{ $safeName }}-{{ $i }}
       image: busybox
       command: ['wget']
-      args: ['{{ include "beelzebub-chart.fullname" . }}:{{ trimPrefix ":" $value.config.address }}']
+      args: ['{{ include "beelzebub-chart.fullname" $ }}:{{ $port }}']
     {{- end }}
📝 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
{{- range $value := .Values.beelzebubServiceConfigs }}
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "beelzebub-chart.fullname" . }}:{{ .Values.service.port }}']
args: ['{{ include "beelzebub-chart.fullname" . }}:{{ trimPrefix ":" $value.config.address }}']
{{- end }}
containers:
{{- range $i, $value := .Values.beelzebubServiceConfigs }}
{{- $trimmed := trimSuffix ".yaml" $value.name -}}
{{- $safeName := (regexReplaceAll "[^a-z0-9-]" (lower $trimmed) "-" ) | trimAll "-" | trunc 63 -}}
{{- $port := (regexFind "[0-9]{2,5}$" (toString $value.config.address)) | default (toString .Values.service.port) -}}
- name: wget-{{ $safeName }}-{{ $i }}
image: busybox
command: ['wget']
args: ['{{ include "beelzebub-chart.fullname" $ }}:{{ $port }}']
{{- end }}
🧰 Tools
🪛 YAMLlint (1.37.1)

[warning] 12-12: wrong indentation: expected 2 but found 4

(indentation)

🤖 Prompt for AI Agents
In beelzebub-chart/templates/tests/test-connection.yaml around lines 11-16, fix
duplicate container names and wrong template scope: make each container name
unique (e.g., append the loop index or a service identifier from the loop item),
stop using the loop-scope dot when calling the fullname template (use the root
context $ so: include "beelzebub-chart.fullname" $), and keep address parsing
tolerant of host:port by preserving the host:port portion while only trimming a
leading ":" if present (apply trimPrefix to the loop item’s address but do not
lose the host:port). Ensure the name generation and include use the correct
variables ($ and the loop index or item field) consistently.

@mariocandela
Copy link
Collaborator

Hi @sdibernardo,

Nice to meet you, and thank you for your contribution to Beelzebub!

I'll check it out in the next few days. 😄

Cheers,
Mario

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