Jinja Filters¶
Jinja Helm
base64_encode
¶
Returns base64-encoded string
The given UTF-8 string is encoded to base64 using base64.b64encode.
| PARAMETER | DESCRIPTION |
|---|---|
|
UTF-8 string to be encoded.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Base64-encoded string.
TYPE:
|
Source code in src/adeploy/common/jinja/filters.py
basename
¶
Returns the basename of the given path using pathlib.Path.
| PARAMETER | DESCRIPTION |
|---|---|
|
The path to get the basename from.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The basename from the path.
TYPE:
|
Source code in src/adeploy/common/jinja/filters.py
quote
¶
Quotes the given string
This filter add quotations "..." around the given string and escapes any quotations inside the string.
| PARAMETER | DESCRIPTION |
|---|---|
|
The string to be quoted.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
String with quotations.
TYPE:
|
Example: Quote a property value
Source code in src/adeploy/common/jinja/filters.py
sha256sum
¶
Creates a SHA256 hash
Creates a SHA256 hash from the given string using hashlib.sha256.
| PARAMETER | DESCRIPTION |
|---|---|
|
UTF-8 string to be hashed.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Hex representation of SHA265 as string.
TYPE:
|
Example: Use a SHA265 hash of a config map to trigger a re-creation of k8s API objects on changes
Source code in src/adeploy/common/jinja/filters.py
yaml
¶
Converts given object into YAML formatted string
This filter is using PyYAML to convert the given object into a YAML formatted string.
| PARAMETER | DESCRIPTION |
|---|---|
|
The object to convert into the YAML formatted string.
TYPE:
|
|
By default, PyYAML chooses the style of a collection depending on whether it has nested collections.
If a collection has nested collections, it will be assigned the block style. Otherwise it will have the flow
style. Set
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
YAML representation of the given data.
TYPE:
|
Example: Using the yaml() filter with flow_style=False
spec:
ingressClassName: {{ ingress.className }}
{% if ingress.get('tls', False) %}
tls:
{{ ingress.get('tls') | yaml(false) | indent(4) }}
{% endif %}
Will result in the following: