kubekey/docs/en/101-syntax.md
liujian 192af7bb7e
feat: add Chinese README and documentation updates (#2791)
- Introduced a new Chinese version of the README file (README_zh-CN.md) to enhance accessibility for Chinese-speaking users.
- Updated the English README to reflect new features and installation instructions.
- Added detailed documentation for project structure, playbooks, roles, tasks, and modules to improve user understanding and usability.

Signed-off-by: [Your Name] <[Your Email]>
Signed-off-by: redscholar <blacktiledhouse@gmail.com>
2025-09-30 10:00:07 +08:00

1008 B

Syntax

The syntax follows the go template specification, with function extensions provided by sprig.

Custom Functions

toYaml

Converts a parameter into a YAML string. The argument specifies the number of leading spaces, and the value is a string.

{{ .yaml_variable | toYaml }}

fromYaml

Converts a YAML string into a parameter format.

{{ .yaml_string | fromYaml }}

ipInCIDR

Gets all IP addresses (as an array) within the specified IP range (CIDR).

{{ .cidr_variable | ipInCIDR }}

ipFamily

Determines the family of an IP or IP_CIDR. Returns: Invalid, IPv4, or IPv6.

{{ .ip | ipFamily }}

pow

Performs exponentiation.

# 2 to the power of 3, 2 ** 3
{{ 2 | pow 3 }}

subtractList

Array exclusion.

# Returns a new list containing elements that exist in a but not in b
{{ .b | subtractList .a }}

fileExist

Checks if a file exists.

{{ .file_path | fileExist }}