Skip to content

Conversation

@cognifloyd
Copy link
Member

This standardizes the template helpers to follow Helm's documented "Best Practices":

https://helm.sh/docs/chart_best_practices/templates/#comments-yaml-comments-vs-template-comments

Template comments should be used when documenting features of a template, such as explaining a defined template:

{{- /*
mychart.shortname provides a 6 char truncated version of the release name.
*/}}
{{ define "mychart.shortname" -}}
{{ .Release.Name | trunc 6 }}
{{- end -}}

https://helm.sh/docs/chart_best_practices/templates/#names-of-defined-templates

Defined templates (templates created inside a {{ define }} directive) are globally accessible. ...
For that reason, all defined template names should be namespaced.

Correct:

{{- define "nginx.fullname" }}
{{/* ... */}}
{{ end -}}

Incorrect:

{{- define "fullname" -}}
{{/* ... */}}
{{ end -}}
  • use helm-style comments in _helpers
  • prefix imageRepository helper with stackstorm-ha
  • prefix hyphenPrefix helper with stackstorm-ha
  • prefix st2-config-volume* helpers with stackstorm-ha
  • prefix init-containers-* helpers with stackstorm-ha
  • prefix pack-configs-volume* helpers with stackstorm-ha
  • prefix packs-volume* helpers with stackstorm-ha
  • prefix packs-initContainers helper with stackstorm-ha
  • prefix packs-pullSecrets helper with stackstorm-ha
  • add changelog entry

@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines. Requires some effort to review. label Dec 2, 2021
@cognifloyd cognifloyd requested a review from arm4b December 2, 2021 04:43
@cognifloyd cognifloyd changed the title Misc helpers cleanups Standardize helper comments and names (prefix all helper names with stackstorm-ha) Dec 2, 2021
@cognifloyd cognifloyd added the Helm label Dec 2, 2021
@cognifloyd cognifloyd self-assigned this Dec 2, 2021
Copy link
Contributor

@ericreeves ericreeves left a comment

Choose a reason for hiding this comment

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

Best practices are a good thing. This helps bring clarity and specificity to chart values and defines.

Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@cognifloyd cognifloyd enabled auto-merge January 12, 2022 01:43
@cognifloyd cognifloyd merged commit 06103d0 into StackStorm:master Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Helm size/L PR that changes 100-499 lines. Requires some effort to review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants