hoobskubes 0.0.7 → 0.0.9
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.
- checksums.yaml +4 -4
- data/lib/hoobskubes.rb +36 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4b95f50dbbe207acb9ae5a5c40ba37b016f9abeb8095ce0f46bb61bcc6b49629
|
|
4
|
+
data.tar.gz: abcf3998942883ee483f71b750cad3a9d1c7dda0f479d4cd8bcf15cb01ef1486
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56313078f6163baf5fd5a0cbca28bf5e7187e9c5b8268bf6152ea6853d9a32256aac4b7c2925f0353a7dee20b9e72e9e2cf9acdba0c67a9a7a95c3640dad8192
|
|
7
|
+
data.tar.gz: 64252ce288a7f2ad6db2423ce3c16b5002c712a997685842faded89ade058631e0143b496c72cf4d852c57f872b7886ab414db7b9b2fcd350161d167601c003b
|
data/lib/hoobskubes.rb
CHANGED
|
@@ -18,6 +18,7 @@ class HoobsKubes
|
|
|
18
18
|
|
|
19
19
|
def self.pretty_print_table(resource, namespace=nil)
|
|
20
20
|
extra = resource == "nodes" ? " -Lbeta.kubernetes.io/instance-type -Lfailure-domain.beta.kubernetes.io/zone -Lkops.k8s.io/instancegroup" : ""
|
|
21
|
+
extra += " -o wide" if @@options.wide
|
|
21
22
|
all = @@options.all ? " --all-namespaces" : ""
|
|
22
23
|
|
|
23
24
|
if namespace.nil?
|
|
@@ -90,11 +91,28 @@ class HoobsKubes
|
|
|
90
91
|
do_status
|
|
91
92
|
end
|
|
92
93
|
|
|
94
|
+
def self.do_proxy
|
|
95
|
+
begin
|
|
96
|
+
log "Starting proxy".bold.cyan
|
|
97
|
+
proxy_thread = Thread.new do
|
|
98
|
+
%x{kubectl proxy}
|
|
99
|
+
end
|
|
100
|
+
log "Opening URL for #{@@options.proxy.to_s.green}".bold.cyan
|
|
101
|
+
%x{open "http://127.0.0.1:8001/api/v1/namespaces/default/services/#{@@options.proxy}/proxy/"}
|
|
102
|
+
proxy_thread.join
|
|
103
|
+
rescue Interrupt
|
|
104
|
+
puts ""
|
|
105
|
+
log "Caught interrupt".bold.magenta
|
|
106
|
+
end
|
|
107
|
+
log "Exited proxy".bold.green
|
|
108
|
+
end
|
|
109
|
+
|
|
93
110
|
def self.run(dir)
|
|
94
111
|
@@dir = dir
|
|
95
112
|
@@options = OpenStruct.new
|
|
96
113
|
@@options.status = false
|
|
97
114
|
@@options.all = false
|
|
115
|
+
@@options.wide = false
|
|
98
116
|
@@options.change = false
|
|
99
117
|
@@options.resource = ""
|
|
100
118
|
|
|
@@ -109,6 +127,10 @@ class HoobsKubes
|
|
|
109
127
|
@@options.all = true
|
|
110
128
|
end
|
|
111
129
|
|
|
130
|
+
opts.on("-w", "--wide", "Displays wide status") do |v|
|
|
131
|
+
@@options.wide = true
|
|
132
|
+
end
|
|
133
|
+
|
|
112
134
|
opts.on("-c", "--change-context", "Change context without deploying") do |v|
|
|
113
135
|
@@options.change = true
|
|
114
136
|
end
|
|
@@ -116,15 +138,23 @@ class HoobsKubes
|
|
|
116
138
|
opts.on("-r", "--resource [RESOURCE]", "Diplay status for only a specific resource") do |v|
|
|
117
139
|
@@options.resource = v
|
|
118
140
|
end
|
|
141
|
+
|
|
142
|
+
opts.on("-p", "--proxy [SERVICE]", "Runs kubectl proxy and opens the service's proxy URL") do |v|
|
|
143
|
+
@@options.proxy = v
|
|
144
|
+
end
|
|
119
145
|
end.parse!
|
|
120
146
|
|
|
121
147
|
change_context if @@options.change
|
|
122
|
-
if @@options.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
148
|
+
if @@options.proxy
|
|
149
|
+
do_proxy
|
|
150
|
+
else
|
|
151
|
+
if @@options.resource != ""
|
|
152
|
+
pretty_print_table(@@options.resource)
|
|
153
|
+
elsif @@options.status
|
|
154
|
+
do_status
|
|
155
|
+
elsif !@@options.change
|
|
156
|
+
do_deploy
|
|
157
|
+
end
|
|
128
158
|
end
|
|
129
159
|
end
|
|
130
160
|
end
|