mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-25 17:12:50 +00:00
- 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>
48 lines
1008 B
Markdown
48 lines
1008 B
Markdown
# Syntax
|
|
The syntax follows the `go template` specification, with function extensions provided by [sprig](https://github.com/Masterminds/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
|
|
{{ .yaml_variable | toYaml }}
|
|
```
|
|
|
|
## fromYaml
|
|
Converts a YAML string into a parameter format.
|
|
```yaml
|
|
{{ .yaml_string | fromYaml }}
|
|
```
|
|
|
|
## ipInCIDR
|
|
Gets all IP addresses (as an array) within the specified IP range (CIDR).
|
|
```yaml
|
|
{{ .cidr_variable | ipInCIDR }}
|
|
```
|
|
|
|
## ipFamily
|
|
Determines the family of an IP or IP_CIDR. Returns: Invalid, IPv4, or IPv6.
|
|
```yaml
|
|
{{ .ip | ipFamily }}
|
|
```
|
|
|
|
## pow
|
|
Performs exponentiation.
|
|
```yaml
|
|
# 2 to the power of 3, 2 ** 3
|
|
{{ 2 | pow 3 }}
|
|
```
|
|
|
|
## subtractList
|
|
Array exclusion.
|
|
```yaml
|
|
# Returns a new list containing elements that exist in a but not in b
|
|
{{ .b | subtractList .a }}
|
|
```
|
|
|
|
## fileExist
|
|
Checks if a file exists.
|
|
```yaml
|
|
{{ .file_path | fileExist }}
|
|
``` |