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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 971a2b67d6149c876f345d562daf515ecee6aa9f
4
- data.tar.gz: 160c22fdaf13d110c45e5be38cbda5e24eb7dbc8
3
+ metadata.gz: 32ec02089a5afa505401af7624723d223571370f
4
+ data.tar.gz: 462a3614870fea50485c1367b9b28a4df019f23e
5
5
  SHA512:
6
- metadata.gz: d00f5c5f4adb4d10bcd8fc654bc968959e86ff0c336a98e0778e1da8a54b8566391a4d2d101152a0a903bbc97119aae7fd9fa8334be697eeb25d6ef5dc56ee15
7
- data.tar.gz: 52fb12e32db488affd914f92856d1bfe8ef2ad4e50d563ffd97027da3bea0ce5b9e37bb029dc7d6fafc416958952fb63edb7ce177e5a50fcd55ba350be3848a6
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='Running')
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.downcase }
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
@@ -1,3 +1,3 @@
1
1
  module Kubert
2
- VERSION = "0.0.1-dev"
2
+ VERSION = "0.0.1-dev2"
3
3
  end
data/lib/kubert.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'Kubeclient'
2
+ require 'open3'
2
3
  require_relative "kubert/pods"
3
4
 
4
5
  module Kubert
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.pre.dev
4
+ version: 0.0.1.pre.dev2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Glusman