Class: Kustomize::Transform::DropFilteredDocumentsTransform

Inherits:
Kustomize::Transform show all
Includes:
Accessory, Singleton
Defined in:
lib/kustomize/transform/drop_filtered_documents_transform.rb

Constant Summary collapse

ANNOTS_LENS =
Lens['metadata', 'annotations']
DROP_ON_ANNOTS =
Set[
  'config.kubernetes.io/local-config',
  'kustomizer.covalenthq.com/drop'
]

Instance Method Summary collapse

Methods inherited from Kustomize::Transform

create, #inspect, #rewrite

Instance Method Details

#rewrite_all(rcs) ⇒ Object



19
20
21
22
23
24
# File 'lib/kustomize/transform/drop_filtered_documents_transform.rb', line 19

def rewrite_all(rcs)
  rcs.filter do |rc|
    annot_keys = (ANNOTS_LENS.get_in(rc) || {}).keys
    not(annot_keys.find{ |k| DROP_ON_ANNOTS.member?(k) })
  end
end