Sha256: 90f2d7a6c4f0a9f07328796feddd6c04206fee986dab5720a826fd957f7c2bea

Contents?: true

Size: 1.86 KB

Versions: 5

Compression:

Stored size: 1.86 KB

Contents

#!/usr/bin/env ruby

  require 'kube_auto_analyzer'
  require 'ostruct'
  require 'optparse'
  options = OpenStruct.new

  options.report_directory = Dir.pwd
  options.report_file = 'kube-parse-report'
  options.target_server = 'http://127.0.0.1:8080'
  options.html_report = false
  options.token = ''
  options.token_file = ''
  options.config_file = false
  options.agent_checks = false
  

  opts = OptionParser.new do |opts|
    opts.banner = "Kubernetes Auto Analyzer #{KubeAutoAnalyzer::VERSION}"



    #TODO: Need options for different authentication mechanisms      
    opts.on("-c", "--config [CONFIG]", "kubeconfig file to load") do |file|
      options.config_file = file
    end

    opts.on("-s", "--server [SERVER]", "Target Server") do |serv|
      options.target_server = serv
    end

    opts.on("-t", "--token [TOKEN]", "Bearer Token to Use") do |token|
      options.token = token
    end

    opts.on("-f", "--token_file [TOKENFILE]", "Token file to use (provide full path)") do |token_file|
      options.token = token_file
    end
      
    opts.on("-r", "--report [REPORT]", "Report Base name") do |rep|
      options.report_file = rep + '_kube'
    end

    opts.on("--reportDirectory [REPORTDIRECTORY]", "Report Directory") do |rep|
      options.report_directory = rep
    end

    opts.on("--agentChecks","Carry out Agent Based Checks ") do |fc|
      options.agent_checks = true
    end

    opts.on("-h", "--help", "-?", "--?", "Get Help") do |help|
      puts opts
      exit
    end
      
    opts.on("-v", "--version", "get Version") do |ver|
      puts "Kubernetes Analyzer Version #{KubernetesAnalyzer::VERSION}"
      exit
    end
  end

  opts.parse!(ARGV)

  unless (options.token.length > 1 || options.config_file || options.token_file.length > 1)
    puts "No valid auth mechanism specified"
    puts opts
    exit
  end

KubeAutoAnalyzer.execute(options)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kube_auto_analyzer-0.0.6 bin/kubeautoanalyzer
kube_auto_analyzer-0.0.5 bin/kubeautoanalyzer
kube_auto_analyzer-0.0.4 bin/kubeautoanalyzer
kube_auto_analyzer-0.0.3 bin/kubeautoanalyzer
kube_auto_analyzer-0.0.2 bin/kubeautoanalyzer