mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00: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:
committed by
John R Barker
parent
c3770bf6f2
commit
960ebd981f
@@ -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
|
||||
````````````````````
|
||||
|
||||
|
||||
Reference in New Issue
Block a user