The name of 2 ConfigMaps with different binaryData
field value is always the same whereas append_hash
is set to true
#666
Labels
type/bug
Something isn't working
SUMMARY
The name of 2 ConfigMaps with different
binaryData
field value is always the same whereasappend_hash
is set totrue
.I'm expecting to have a different generated hash when the
binaryData
changes, like it does with thedata
field.This behavior is preventing me to detect ConfigMap changes which also prevents me to trigger the rollout of the workload (Deployment, Statefulset, DeamonSet, etc.) using it. Indeed I set a label in my workload with the generated name of the configmap. Therefore if the configmap content changes, the configmap name changes, then the workload label changes and eventually my workload is rolled out and use the expected configmap.
Possible fix:
Assuming that this behavior is not expected then we could fix it as follows.
I have traced back the code and found out that the reason of this behavior is caused by the generate_hash function.
If I add the
binaryData
key in themarshall
function then the expected behavior is restored.If my assumption is correct, the same problem exists with Secret's
stringData
field.ISSUE TYPE
COMPONENT NAME
kubernetes.core.k8s
plugins/module_utils/hashes.py
ANSIBLE VERSION
COLLECTION VERSION
OS / ENVIRONMENT
Ubuntu 22.04 LTS
STEPS TO REPRODUCE
For example, the 2 following ConfigMap definitions have the same generated ConfigMap name (e.g.
test-tgz-mh2dhghg86
) whereas they don't contain the samedataBinary
.EXPECTED RESULTS
I'm expecting to have a different generated ConfigMap name when the
binaryData
changes, like it does with thedata
field.ACTUAL RESULTS
2 ConfigMaps with different
binaryData
have the same generated name even ifappend_hash
is set totrue
.The text was updated successfully, but these errors were encountered: