kubert 0.0.1.pre.dev → 0.0.1.pre.dev2
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/kubert/cli.rb +8 -1
- data/lib/kubert/pods.rb +13 -1
- data/lib/kubert/version.rb +1 -1
- data/lib/kubert.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32ec02089a5afa505401af7624723d223571370f
|
4
|
+
data.tar.gz: 462a3614870fea50485c1367b9b28a4df019f23e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 737d300f5c48c6c8bbf11148cfcf4d1489610bb10044d0f4569b43bc5eb0e20d35a7a9026d23cd736b11b88c5ea37ecf31fe23612bd7927263ca306c2cbb0f2a
|
7
|
+
data.tar.gz: c31ce61bbccea32cb2e2066fde51d0ccf1d34bc417bc1fd313d324224d637a58bd74167ebb6e6be559954bd0d2f6dcdfed14ca20f6555dfc962a34aa7d992f02
|
data/lib/kubert/cli.rb
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
require_relative '../kubert'
|
2
2
|
require 'thor'
|
3
|
+
require "irb"
|
3
4
|
module Kubert
|
4
5
|
class Cli < Thor
|
5
6
|
|
6
7
|
desc "list pod_type", "display a list of one type of Pod, only Ready by default"
|
7
|
-
def list(pod_type, status
|
8
|
+
def list(pod_type, status=:running)
|
8
9
|
puts Pods.list(pod_type, status)
|
9
10
|
end
|
11
|
+
|
12
|
+
desc "console", "Connect to a Rails console on a console pod"
|
13
|
+
def console
|
14
|
+
Pods.console
|
15
|
+
end
|
16
|
+
|
10
17
|
end
|
11
18
|
end
|
data/lib/kubert/pods.rb
CHANGED
@@ -4,6 +4,10 @@ module Kubert
|
|
4
4
|
new.all(pod_type).status(status).names
|
5
5
|
end
|
6
6
|
|
7
|
+
def self.console
|
8
|
+
new.console
|
9
|
+
end
|
10
|
+
|
7
11
|
attr_reader :project, :pods
|
8
12
|
def initialize(project= ENV['PROJECT'] || "connect")
|
9
13
|
@project = project
|
@@ -16,7 +20,7 @@ module Kubert
|
|
16
20
|
end
|
17
21
|
|
18
22
|
def status(pod_status)
|
19
|
-
@pods = pods.select {|pod| pod.status.phase.downcase == pod_status.
|
23
|
+
@pods = pods.select {|pod| pod.status.phase.downcase == pod_status.to_s }
|
20
24
|
self
|
21
25
|
end
|
22
26
|
|
@@ -24,6 +28,14 @@ module Kubert
|
|
24
28
|
pods.map(&:metadata).map(&:name)
|
25
29
|
end
|
26
30
|
|
31
|
+
def console
|
32
|
+
pod = all('console').status(:running).pods.sample
|
33
|
+
Open3.popen3("bash") do
|
34
|
+
exec "kubectl exec -n #{pod.metadata.namespace} #{pod.metadata.name} -it bundle exec rails c"
|
35
|
+
end
|
36
|
+
puts "THIS WILL NEVER EXECUTE BECAUSE OF EXEC ABOVE"
|
37
|
+
end
|
38
|
+
|
27
39
|
|
28
40
|
end
|
29
41
|
end
|
data/lib/kubert/version.rb
CHANGED
data/lib/kubert.rb
CHANGED