Skip to content

fix: imageurl without quotes#884

Open
krishnaGajabi wants to merge 1 commit into
openebs:developfrom
krishnaGajabi:imageurlfix
Open

fix: imageurl without quotes#884
krishnaGajabi wants to merge 1 commit into
openebs:developfrom
krishnaGajabi:imageurlfix

Conversation

@krishnaGajabi

@krishnaGajabi krishnaGajabi commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Issue:
image url containing {{ }} is being interpreted as a function on mayastor helm chart
Root Cause:
image url being rendered using tpl which treats it as helm function
Steps to Reproduce:
values.yaml

global:
  imageRegistry: "{{ my_registry }}/my-org/"

Command :
helm template chartsdirectory -f values.yaml

Error:
`Error: template: mayastor/templates/mayastor/agents/ha/ha-node-daemonset.yaml:31:12: executing "mayastor/templates/mayastor/agents/ha/ha-node-daemonset.yaml" at <include "base_init_ha_node_containers" .>: error calling include: template: mayastor/templates/_helpers.tpl:34:8: executing "base_init_ha_node_containers" at <include "render_init_containers" (dict "value" .Values.base.initHaNodeContainers.containers "context" $)>: error calling include: template: mayastor/templates/_helpers.tpl:405:8: executing "render_init_containers" at <tpl ($containers | toYaml) .context>: error calling tpl: cannot parse template "- command:\n - sh\n - -c\n - trap "exit 1" TERM; until nc -vzw 5 {{ .Release.Name }}-agent-core 50052; do date;\n echo "Waiting for agent-cluster-grpc services..."; sleep 1; done;\n image: '{{ my_registry }}/my-org//openebs/alpine-sh:4.5.0'\n imagePullPolicy: IfNotPresent\n name: agent-cluster-grpc-probe": template: gotpl:6: function "my_registry" not defined

Use --debug flag to render out invalid YAML
(END)`

Solution:
Only render the initcontainer command with tpl and eveyrthing else wihout it.

This PR also fixes preupgrade hook image url which had no quotes in previous versions.

image url containing {{ }} is being interpreted as a function on mayastor helm chart

Signed-off-by: krishnaGajabi <gajbikrishna23@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes Helm rendering failures when an image registry contains {{ ... }} by avoiding tpl evaluation of initContainer YAML (which previously interpreted those braces as Go template functions), and aligns the pre-upgrade hook image field formatting with the rest of the chart.

Changes:

  • Quote the pre-upgrade hook image: value so rendered YAML remains valid even when registry strings contain {/}.
  • Update render_init_containers to render only command entries via tpl while emitting the rest of the container YAML without tpl, preventing accidental template evaluation of image strings.
  • Factor default initContainer image construction into a dedicated render_init_container_image helper.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
chart/templates/pre-upgrade-hook.yaml Quotes the pre-upgrade hook image string to avoid invalid YAML when registry values contain special characters.
chart/templates/_helpers.tpl Stops tpl-rendering the full initContainer YAML; selectively tpl-renders command only and centralizes default initContainer image generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 408 to 410
{{- end -}}
{{- tpl ($containers | toYaml) .context }}
{{- $containers | toYaml }}
{{- end -}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is ok since only the command needs templating?
@niladrih

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.

3 participants