class Sensu::Plugins::Kubernetes::CLI

Abstract base class for a Sensu check that also provides Kubernetes client connection support.

Attributes

client[R]

Public Class Methods

new(argv = ARGV) click to toggle source

Initializes the Sensu check by creating a Kubernetes client from the given options and will report a critical error if those arguments are incorrect.

Calls superclass method
# File lib/sensu-plugins-kubernetes/cli.rb, line 81
def initialize(argv = ARGV)
  super()
  self.argv = parse_options(argv)
  begin
    @client = kubeclient(
      server: config[:api_server],
      version: config[:api_version],
      incluster: config[:api_incluster],
      ca_file: config[:api_ca_file],
      client_cert_file: config[:api_client_cert],
      client_key_file: config[:api_client_key],
      username: config[:api_user],
      password: config[:api_password],
      token: config[:api_token],
      token_file: config[:api_token_file],
      kube_config: config[:kube_config]
    )
  rescue ArgumentError => e
    critical e.message
  end
end