module Sensu::Plugins::Kubernetes::Exclude

A mixin module that provides filtering functions.

Public Instance Methods

node_excluded?(node_name) click to toggle source
# 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) click to toggle source

Filters the list of pods or nodes based on include/exclude options.

@option options [String] :exclude_nodes

Exclude the specified nodes (comma separated list)
Exclude wins when a node is in both include and exclude lists

@option options [String] :include-nodes

Include the specified nodes (comma separated list), an
empty list includes all nodes
# 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) click to toggle source
# 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