mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
k8s append_hash (#48830)
* Add append_hash functionality to k8s module append_hash adds a hash based on the contents of a ConfigMap or Secret to the name - this enables immutable ConfigMaps and Secrets. * Provide k8s_config_resource_name plugin The k8s_config_resource_name filter plugin provides a means of determining the name of ConfigMaps and Secrets created with append_hash * Add changelog fragment * fix failing tests * Update openshift version needed for append_hash
This commit is contained in:
parent
c3770bf6f2
commit
960ebd981f
11 changed files with 174 additions and 24 deletions
|
@ -1083,6 +1083,32 @@ To escape special characters within a regex, use the "regex_escape" filter::
|
|||
{{ '^f.*o(.*)$' | regex_escape() }}
|
||||
|
||||
|
||||
Kubernetes Filters
|
||||
``````````````````
|
||||
|
||||
Use the "k8s_config_resource_name" filter to obtain the name of a Kubernetes ConfigMap or Secret,
|
||||
including its hash::
|
||||
|
||||
{{ configmap_resource_definition | k8s_config_resource_name }}
|
||||
|
||||
This can then be used to reference hashes in Pod specifications::
|
||||
|
||||
my_secret:
|
||||
kind: Secret
|
||||
name: my_secret_name
|
||||
|
||||
deployment_resource:
|
||||
kind: Deployment
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- envFrom:
|
||||
- secretRef:
|
||||
name: {{ my_secret | k8s_config_resource_name }}
|
||||
|
||||
.. versionadded:: 2.8
|
||||
|
||||
Other Useful Filters
|
||||
````````````````````
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue