ansible-collections / community.kubernetes

Kubernetes Collection for Ansible
https://galaxy.ansible.com/community/kubernetes
GNU General Public License v3.0
265 stars 106 forks source link

Fix Secret check_mode #343

Closed gravesm closed 3 years ago

gravesm commented 3 years ago
SUMMARY

When adding a Secret and using stringData, check_mode will always show changes. An existing resource fetched from Kubernetes will have the stringData already base64 encoded and merged into the data attribute. This change performs the base64 encoding and merging with the provided definition to more accurately represent the current state of the cluster.

This change only affects check_mode. When making any changes to the cluster the stringData is passed along as provided in the definition.

Closes #282.

ISSUE TYPE
COMPONENT NAME

plugin/module_utils/common.py

codecov[bot] commented 3 years ago

Codecov Report

Merging #343 (e278962) into main (a9b8cc6) will decrease coverage by 0.12%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #343      +/-   ##
==========================================
- Coverage   36.93%   36.80%   -0.13%     
==========================================
  Files           3        3              
  Lines         750      758       +8     
  Branches      146      148       +2     
==========================================
+ Hits          277      279       +2     
- Misses        424      430       +6     
  Partials       49       49              
Impacted Files Coverage Δ
...ommunity/kubernetes/plugins/module_utils/common.py 35.47% <0.00%> (-0.16%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a9b8cc6...e278962. Read the comment docs.

goneri commented 3 years ago

Thank you for the unit-tests @gravesm :-).