Module: Sensu::Plugins::Kubernetes::Exclude
- Defined in:
- lib/sensu-plugins-kubernetes/exclude.rb
Overview
A mixin module that provides filtering functions.
Instance Method Summary collapse
- #node_excluded?(node_name) ⇒ Boolean
-
#node_included?(node_name) ⇒ Boolean
Filters the list of pods or nodes based on include/exclude options.
- #should_exclude_node(node_name) ⇒ Object
Instance Method Details
#node_excluded?(node_name) ⇒ Boolean
25 26 27 |
# File 'lib/sensu-plugins-kubernetes/exclude.rb', line 25 def node_excluded?(node_name) config[:exclude_nodes].include?(node_name) end |
#node_included?(node_name) ⇒ Boolean
Filters the list of pods or nodes based on include/exclude options.
17 18 19 20 21 22 23 |
# File 'lib/sensu-plugins-kubernetes/exclude.rb', line 17 def node_included?(node_name) if config[:include_nodes].empty? true else config[:include_nodes].include?(node_name) end end |
#should_exclude_node(node_name) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/sensu-plugins-kubernetes/exclude.rb', line 29 def should_exclude_node(node_name) if node_name.nil? false else node_excluded?(node_name) || !node_included?(node_name) end end |