mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-07 21:42:38 +00:00
Extend hidden_fields to allow more complicated field definitions (#872)
SUMMARY This allows us to ignore e.g. the last-applied-configuration annotation by specifying metadata.annotations[kubectl.kubernetes.io/last-applied-configuration] ISSUE TYPE Feature Pull Request COMPONENT NAME hidden_fields This replaces #643 as I no longer have permissions to push to branches in this repo Reviewed-by: Bikouo Aubin Reviewed-by: Helen Bailey <hebailey@redhat.com> Reviewed-by: GomathiselviS <gomathiselvi@gmail.com> Reviewed-by: Alina Buzachis
This commit is contained in:
@@ -77,6 +77,7 @@
|
||||
definition: "{{ hide_fields_base_configmap | combine({'data':{'anew':'value'}}) }}"
|
||||
hidden_fields:
|
||||
- data
|
||||
- metadata.annotations[kubectl.kubernetes.io/last-applied-configuration]
|
||||
apply: true
|
||||
register: hf6
|
||||
diff: true
|
||||
@@ -86,6 +87,22 @@
|
||||
that:
|
||||
- hf6.changed
|
||||
|
||||
- name: Ensure hidden fields are not present
|
||||
assert:
|
||||
that:
|
||||
- >-
|
||||
'annotations' not in hf6.result.metadata or
|
||||
'kubectl.kubernetes.io/last-applied-configuration'
|
||||
not in hf6.result.metadata.annotations
|
||||
- >-
|
||||
'annotations' not in hf6.diff.before.metadata or
|
||||
'kubectl.kubernetes.io/last-applied-configuration'
|
||||
not in hf6.diff.before.metadata.annotations
|
||||
- >-
|
||||
'annotations' not in hf6.diff.after.metadata or
|
||||
'kubectl.kubernetes.io/last-applied-configuration'
|
||||
not in hf6.diff.after.metadata.annotations
|
||||
|
||||
- name: Hidden field should not show up in deletion
|
||||
k8s:
|
||||
definition: "{{ hide_fields_base_configmap}}"
|
||||
|
||||
Reference in New Issue
Block a user