sct 0.1.17 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -1
- data/lib/sct/commands/cluster.rb +39 -37
- data/lib/sct/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9a10c8fd025fd2f32f82840295ef14bd7da4604ab7f90e4d0f0f107b902ab0c
|
4
|
+
data.tar.gz: a719ae52d73c95fdff15652350046e75e6fe1bf99f3f893d85a577ed2f78efa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3777d0a28ceab88ebc43d3442068d55c5e95c6a2eaef141be7e71a81851e22e5feaf676c282e58fa662f65875fe9333a62b64211bee00a0b87b5b2e4c35aceb3
|
7
|
+
data.tar.gz: 04a36128ed9daf630791e025877800337a21efb0ddd9c374535878cc74c734c5fc502ff676ddeae57bc12888bccaeb7ae3777dcf4b2bf79db8c4e69af3109629
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sct (0.1.
|
4
|
+
sct (0.1.16)
|
5
5
|
class_interface (~> 0.1.1)
|
6
6
|
colored (~> 1.2)
|
7
7
|
commander (~> 4.4.7)
|
8
8
|
highline (>= 1.7.2)
|
9
|
+
terminal-table (~> 1.8)
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
@@ -30,6 +31,9 @@ GEM
|
|
30
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
32
|
rspec-support (~> 3.9.0)
|
32
33
|
rspec-support (3.9.2)
|
34
|
+
terminal-table (1.8.0)
|
35
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
36
|
+
unicode-display_width (1.7.0)
|
33
37
|
|
34
38
|
PLATFORMS
|
35
39
|
ruby
|
data/lib/sct/commands/cluster.rb
CHANGED
@@ -6,11 +6,11 @@ module Sct
|
|
6
6
|
class ClusterCommand
|
7
7
|
|
8
8
|
IS_PUBLIC_COMMAND = true
|
9
|
-
SYNTAX = 'sct cluster up | sct cluster down | sct cluster setup | sct cluster reset | sct cluster update-config | sct cluster delete-stalled-pods'
|
9
|
+
SYNTAX = 'sct cluster up | sct cluster down | sct cluster setup | sct cluster reset | sct cluster update-config | sct cluster delete-stalled-pods | sct cluster status'
|
10
10
|
SUMMARY = 'Perform actions on the minikube cluster.'
|
11
|
-
EXAMPLE = 'sct cluster up | sct cluster down | sct cluster setup | sct cluster reset | sct cluster update-config | sct cluster delete-stalled-pods'
|
11
|
+
EXAMPLE = 'sct cluster up | sct cluster down | sct cluster setup | sct cluster reset | sct cluster update-config | sct cluster delete-stalled-pods | sct cluster status'
|
12
12
|
EXAMPLE_DESCRIPTION = 'Perform actions on the minikube cluster.'
|
13
|
-
DESCRIPTION = "sct cluster allows you to start, stop, setup/reset, update the config,
|
13
|
+
DESCRIPTION = "sct cluster allows you to start, stop, setup/reset, update the config, delete the stalled pods, or status of the Spend Cloud minikube cluster."
|
14
14
|
|
15
15
|
OPTIONS = []
|
16
16
|
|
@@ -31,7 +31,7 @@ module Sct
|
|
31
31
|
when "status"
|
32
32
|
status
|
33
33
|
else
|
34
|
-
puts "Unknown or missing argument. Please run 'sct cluster
|
34
|
+
puts "Unknown or missing argument. Please run 'sct cluster --help'.".red
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -155,58 +155,60 @@ module Sct
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def status
|
158
|
-
|
159
|
-
|
160
|
-
system_pods
|
161
|
-
current_contexts
|
162
|
-
end
|
158
|
+
print_contexts
|
159
|
+
print_minikube_status
|
163
160
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
puts Terminal::Table.new :title => "Pods Status".green, :headings => ['Name', 'Status'], :rows => rows
|
171
|
-
end
|
172
|
-
|
173
|
-
def system_pods
|
174
|
-
rows = []
|
175
|
-
pods("kube-system").map do |pod|
|
176
|
-
status = pod[:status] == "Running" ? pod[:status].green : pod[:status].red
|
177
|
-
rows << [pod[:name], status]
|
178
|
-
end
|
179
|
-
puts Terminal::Table.new :title => "System pods Status".green, :headings => ['Name', 'Status'], :rows => rows
|
161
|
+
if get_minikube_status.find_all { |status| status[1] == 'Stopped' }.count == 0
|
162
|
+
print_pods_status("kube-system")
|
163
|
+
print_pods_status
|
164
|
+
else
|
165
|
+
puts "Please check your minikube status. If all services are stopped you should start the minikube first.".yellow
|
166
|
+
end
|
180
167
|
end
|
181
168
|
|
182
|
-
def
|
169
|
+
def print_contexts
|
183
170
|
output = `kubectl config get-contexts`
|
184
171
|
|
185
172
|
lines = output.split "\n"
|
186
173
|
lines = lines[1..-1]
|
187
174
|
|
188
|
-
rows =
|
189
|
-
|
190
|
-
|
175
|
+
rows = lines.map do |line|
|
176
|
+
columns = line.split(" ")
|
177
|
+
|
178
|
+
current_context = columns[0] == "*" ? "Yes".green : "No".red
|
191
179
|
|
192
|
-
|
193
|
-
rows << [columns[2], current_context]
|
180
|
+
[columns[2], current_context]
|
194
181
|
end
|
195
|
-
|
182
|
+
|
183
|
+
puts Terminal::Table.new title: "Contexts".green, headings: ['Cluster', 'Using context'], rows: rows
|
184
|
+
end
|
185
|
+
|
186
|
+
def print_minikube_status
|
187
|
+
|
188
|
+
puts Terminal::Table.new title: "Minikube status".green, headings: ['Name', 'Status'], rows: get_minikube_status
|
196
189
|
end
|
197
190
|
|
198
|
-
def
|
191
|
+
def get_minikube_status
|
199
192
|
output = `#{minikube} status`
|
200
193
|
|
201
194
|
lines = output.split "\n"
|
202
195
|
|
203
|
-
rows =
|
204
|
-
lines.map do |line|
|
196
|
+
rows = lines.map do |line|
|
205
197
|
columns = line.split(" ")
|
206
198
|
|
207
|
-
|
199
|
+
[columns[0][0..-2], columns[1]]
|
208
200
|
end
|
209
|
-
|
201
|
+
end
|
202
|
+
|
203
|
+
def print_pods_status(namespace = nil)
|
204
|
+
rows = pods(namespace).map do |pod|
|
205
|
+
[
|
206
|
+
pod[:name],
|
207
|
+
pod[:status] == "Running" ? pod[:status].green : pod[:status].red
|
208
|
+
]
|
209
|
+
end
|
210
|
+
|
211
|
+
puts Terminal::Table.new title: "Pods (namespace: #{namespace || "default"})".green, headings: ['Name', 'Status'], rows: rows
|
210
212
|
end
|
211
213
|
|
212
214
|
def pods(namespace = nil)
|
data/lib/sct/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reshad Farid
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
|
-
rubygems_version: 3.0.
|
193
|
+
rubygems_version: 3.0.3
|
194
194
|
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: Spend Cloud Tool.
|