hoobskubes 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hoobskubes.rb +28 -16
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d7324e68bea96bd539724b4d5532db9e2db6576fc84bc9650a69558598a063e
4
- data.tar.gz: 97021583da01c5fe964e826ac328a80ba5923bbb900fca7a480b49be35cecce0
3
+ metadata.gz: c9404390966cc2fdf60d8a90dcb81dc9b04516f8b90b5706f0921fe07694c982
4
+ data.tar.gz: 27bf8427f2ec3dd7b9b016236a546138476498fc46aedd112d62ea313cd016dd
5
5
  SHA512:
6
- metadata.gz: 82583fcc15c051659a9281bd55bc1038dc0c66f12638e3c7c5b68bac76e632fbd0a8cc3f35d84cdbbf663e0481fce94c6cf7903cac012158eb42048b45a4471f
7
- data.tar.gz: 28a4686fe8606c8a5b01e2884e938098b7841d83fc881a0ca5f5ca1ffbeab1ed5e0863de132c5032031d90dc58edfcfff46bc0e4a2fc94fc27becd662de61297
6
+ metadata.gz: cf5f2781a2b577239b02bc5d4c0ff607ba2a91c86ffcfd85c37c3c876f6f9d879dfbce381c72a0c953552f4bd5ab76305b07ba9848d19921f800ded5bfc4fd86
7
+ data.tar.gz: 30876fcd324a005b858e4967512a4e378016e7000fd6c2d97d36e02fe020dd4f438ee0f1164a83a6d2744c37157811639b58052b3e1acc14e8482a10803e1bfc
data/lib/hoobskubes.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'optparse'
2
+ require 'ostruct'
3
+
1
4
  class HoobsKubes
2
5
  def self.current_context
3
6
  %x{kubectl config current-context}.strip
@@ -15,7 +18,7 @@ class HoobsKubes
15
18
 
16
19
  def self.pretty_print_table(resource, namespace=nil)
17
20
  extra = resource == "nodes" ? " -Lbeta.kubernetes.io/instance-type -Lfailure-domain.beta.kubernetes.io/zone" : ""
18
- all = @@all ? " --all-namespaces" : ""
21
+ all = @@options.all ? " --all-namespaces" : ""
19
22
 
20
23
  if namespace.nil?
21
24
  out = %x{kubectl get #{resource}#{extra}#{all}}
@@ -89,23 +92,32 @@ class HoobsKubes
89
92
 
90
93
  def self.run(dir)
91
94
  @@dir = dir
92
- @@all = (ARGV.include? "--all" or ARGV.include? "-a")
95
+ @@options = OpenStruct.new
96
+ @@options.status = false
97
+ @@options.all = false
98
+ @@options.change = false
93
99
 
94
- if ARGV.length == 0
95
- do_deploy
96
- elsif ARGV.include? "-s" or ARGV.include? "--status"
97
- do_status
98
- elsif ARGV.include? "-c" or ARGV.include? "--change-context"
99
- change_context
100
- elsif ARGV.include? "--help"
101
- log "Usage: ./deploy.rb [options]"
102
- log " With no options, this will apply yamls and display status"
103
- log ""
104
- log "Options:"
105
- log " --help : This message"
106
- log " -s --status : Display only status"
100
+ OptionParser.new do |opts|
101
+ opts.banner = "Usage: deploy.rb [options]"
102
+
103
+ opts.on("-s", "--status", "Displays status only") do |v|
104
+ @@options.status = true
105
+ end
106
+
107
+ opts.on("-a", "--all", "Displays status for all namespaces") do |v|
108
+ @@options.all = true
109
+ end
110
+
111
+ opts.on("-c", "--change-context", "Change context without deploying") do |v|
112
+ @@options.change = true
113
+ end
114
+ end.parse!
115
+
116
+ if @@options.status or @@options.change
117
+ change_context if @@options.change
118
+ do_status if @@options.status
107
119
  else
108
- log "Unknown usage: deploy.rb #{ARGV.join " "}"
120
+ do_deploy
109
121
  end
110
122
  end
111
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoobskubes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Colburn
@@ -10,7 +10,7 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-02-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Terrible kubernetes tools
13
+ description: Kubernetes configuration deployment
14
14
  email: samuel.colburn@gmail.com
15
15
  executables: []
16
16
  extensions: []