Skip to content

Conversation

@DMSwimTech
Copy link
Contributor

Allowing users to add extra kubernetes resouces without the need to fork the helm chart internally.

Example scenarios:

  1. external secrets
  2. Istio virtual services

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 31, 2025

Walkthrough

Adds support for rendering additional Kubernetes objects via Helm. Introduces a new template that processes .Values.extraObjects (strings or objects) into separate YAML documents using tpl. Updates values.yaml to include a new top-level extraObjects array with comments and an example, defaulting to an empty list.

Changes

Cohort / File(s) Summary of changes
Helm template for extra objects
helm/holmes/templates/extra-objects.yaml
New template iterates over .Values.extraObjects; for string items renders via tpl; for non-strings converts with toYaml then tpl; emits each as a separate YAML document with '---'.
Values default for extraObjects
helm/holmes/values.yaml
Adds top-level extraObjects: [] with documentation and example snippet; no other keys modified.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Helm as Helm Renderer
  participant Chart as holmes Chart
  participant Template as templates/extra-objects.yaml
  participant K8s as Kubernetes Manifests

  User->>Helm: helm install/upgrade -f values.yaml
  Helm->>Chart: Load values (.Values.extraObjects)
  Helm->>Template: Render extra-objects.yaml with root context ($)
  alt extraObjects item is string
    Template->>Template: tpl(itemString, $)
  else item is object
    Template->>Template: toYaml(item) -> tpl(yamlString, $)
  end
  Template-->>Helm: Emit '---' delimited YAML docs
  Helm-->>K8s: Output combined manifests
  note over Template,K8s: Each extra object becomes its own YAML document
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • arikalon1

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ 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 @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai 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:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai 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 @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @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.

Copy link
Contributor

@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

🧹 Nitpick comments (2)
helm/holmes/values.yaml (1)

58-68: Docs: clarify accepted item formats + add a string-template example

Mention that items can be either fully-rendered YAML objects or string templates rendered via tpl, and add a short string-based example to avoid ambiguity.

Example docs tweak:

  • Supports two formats:
    • Object: a YAML object (apiVersion/kind/metadata/spec…)
    • String: a templated manifest string rendered with tpl and the root context (.)

Example (string):

- |

apiVersion: v1

kind: ConfigMap

metadata:

name: {{ include "holmes.fullname" . }}-extras

namespace: {{ .Release.Namespace }}

data:

enabled: "{{ .Values.enableTelemetry }}"

helm/holmes/templates/extra-objects.yaml (1)

1-8: Skip empty/nil items to avoid emitting 'null' documents

Without a guard, toYaml nil yields "null" and produces a bogus document.

Covered by the else-if $obj guard in the diff above.

📜 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 135031e and e651b19.

📒 Files selected for processing (2)
  • helm/holmes/templates/extra-objects.yaml (1 hunks)
  • helm/holmes/values.yaml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
helm/holmes/templates/extra-objects.yaml

[error] 4-4: syntax error: expected '', but found '{'

(syntax)


[warning] 6-6: wrong indentation: expected 0 but found 4

(indentation)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (3.12)
  • GitHub Check: build (3.10)
  • GitHub Check: build (3.11)
  • GitHub Check: llm_evals
🔇 Additional comments (1)
helm/holmes/templates/extra-objects.yaml (1)

1-8: Exclude Helm templates from yamllint
Add the following to your .yamllint to ignore Go templating in helm/**/templates/**:

extends: default
ignore: |
  helm/**/templates/**

Please verify locally that helm template ./helm/holmes still produces valid YAML (e.g. via helm template … | yq 'split("---") | length').

Comment on lines +1 to +8
{{ range .Values.extraObjects }}
---
{{ if typeIs "string" . }}
{{- tpl . $ }}
{{- else }}
{{- tpl (toYaml .) $ }}
{{- end }}
{{ end }}
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 31, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix indentation + use kindIs; current output will be invalid YAML

The leading spaces before tpl emitters indent entire documents, breaking top-level YAML. Also, Helm commonly uses kindIs for type checks; typeIs is unreliable across Helm/Sprig versions.

Apply:

-{{ range .Values.extraObjects }}
----
-{{ if typeIs "string" . }}
-    {{- tpl . $ }}
-{{- else }}
-    {{- tpl (toYaml .) $ }}
-{{- end }}
-{{ end }}
+{{- if .Values.extraObjects }}
+{{- range $i, $obj := .Values.extraObjects }}
+---
+{{- if kindIs "string" $obj }}
+{{ tpl $obj $ }}
+{{- else if $obj }}
+{{ tpl (toYaml $obj) $ }}
+{{- end }}
+{{- end }}
+{{- end }}

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 4-4: syntax error: expected '', but found '{'

(syntax)


[warning] 6-6: wrong indentation: expected 0 but found 4

(indentation)

🤖 Prompt for AI Agents
In helm/holmes/templates/extra-objects.yaml lines 1-8, the current template
inserts leading spaces before the tpl calls which indents entire emitted
documents and breaks top-level YAML, and it uses typeIs which can be unreliable;
change typeIs "string" to kindIs "string" and remove the leading spaces so the
tpl outputs start at column 1 (keep the leading '---' separator at top-level),
calling tpl directly for string values and tpl(toYaml .) for non-strings so
emitted YAML documents are valid and not indented.

Copy link
Contributor

Choose a reason for hiding this comment

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

@DMSwimTech Did you see this comment from code rabbit?
Is it a real issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Contributor

@arikalon1 arikalon1 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @DMSwimTech

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