Documentation ¶
Overview ¶
Package helm provides utilities to aid in the conversion from a Helm chart into an Ansible Playbook Role.
Index ¶
- Constants
- func ConvertControlFlowSyntax(roleDirectory string)
- func ConvertDefaultsToSnakeCase(chartClient *helm.HelmChartClient, roleDirectory string) *map[string]string
- func CopyTemplates(helmChartRootDirectory string, rolesDirectory string) string
- func CopyValuesToDefaults(chartRoot string, roleDirectory string)
- func InstallAnsibleFilters(roleDirectory string)
- func InstallAnsibleTasks(roleDirectory string)
- func RemoveValuesReferencesInDefaults(roleDirectory string)
- func RemoveValuesReferencesInTemplates(roleDirectory string)
- func SuppressWhitespaceTrimmingInTemplates(roleDirectory string)
Constants ¶
const HelmTemplatesDirectory = "templates"
Variables ¶
This section is empty.
Functions ¶
func ConvertControlFlowSyntax ¶
func ConvertControlFlowSyntax(roleDirectory string)
Invokes a custom text/template implementation in order to convert possibly-nested Branch Nodes into the Ansible counterparts. For example, the following Golang template:
{{ if conditional }} ... {{ end }}
Becomes:
{% if conditional %} ... {% endif %}
func ConvertDefaultsToSnakeCase ¶
func ConvertDefaultsToSnakeCase(chartClient *helm.HelmChartClient, roleDirectory string) *map[string]string
Convert keys in defaults/main.yaml to snake case, and return a list of the substitutions for use in templates later.
func CopyTemplates ¶
Copies Helm Yaml templates to the appropriate Ansible Playbook roles template, post-fixing each YAML file with a ".j2" extension. The path to the ansible playbook templates directory is returned.
func CopyValuesToDefaults ¶
Copies the contents of a Helm templates values.yml or values.yaml to the corresponding Ansible Role's defaults/main.yaml.
func InstallAnsibleFilters ¶
func InstallAnsibleFilters(roleDirectory string)
Installs some default Ansible Filters into the generated workspace to aid in the Sprig transition.
func InstallAnsibleTasks ¶
func InstallAnsibleTasks(roleDirectory string)
Installs the Ansible Playbook Role task responsible for invoking the translated templates.
func RemoveValuesReferencesInDefaults ¶
func RemoveValuesReferencesInDefaults(roleDirectory string)
Given an Ansible role directory, correct the defaults/main.yml file for ".Values." references. Although Helm allows self-reference, Ansible Playbook does not support this behavior. Thus, report to the user that the file will need manual inspection/editing after export, and put the appropriate hint in the exported Ansible Playbook.
func RemoveValuesReferencesInTemplates ¶
func RemoveValuesReferencesInTemplates(roleDirectory string)
Remove references to to ".Values." in all templates by replacing with an empty string. Ansible Playbook can directly access defaults defined in defaults/main.yml.
func SuppressWhitespaceTrimmingInTemplates ¶
func SuppressWhitespaceTrimmingInTemplates(roleDirectory string)
Removes Whitespace Trimming calls "{{-" and "-}}" and replaces them with "{{" and "}}" respectively for all templates in an Ansible Role. This is due to the fact that the Go text/template lexer is destructive, and ends up eating this white-space.
Types ¶
This section is empty.