kubert 0.1.0 → 0.1.1
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 +5 -1
- data/lib/kubert/pods.rb +21 -0
- 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: e5c74268cc6b8183802832e52b2915204446ecc3
|
4
|
+
data.tar.gz: 1be4118c38ac3bc70e1ccaae091a98224c53a4c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97697fadf8dcfe45a70457e8ad9c05dcd739e098ebeb9adb4d186449c62d62792bcb8ca168cd2e7705bc1478f1d34f4442f735432841e121e3e45435043e3767
|
7
|
+
data.tar.gz: 45ac797aad87616892d75ef0fd127d73f0b1181bafc324cb83d118e08d06dd876984dd140dd62483f10612da859dc5563663d40dec35a4b23d5d7d9cbfa7be30
|
data/lib/kubert/cli.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require_relative '../kubert'
|
2
2
|
require 'thor'
|
3
|
-
require "irb"
|
4
3
|
module Kubert
|
5
4
|
class Cli < Thor
|
6
5
|
|
@@ -31,6 +30,11 @@ module Kubert
|
|
31
30
|
Pods.execute(command)
|
32
31
|
end
|
33
32
|
|
33
|
+
desc "logs pod_type (status, default Running)", "Interleave and tail logs from all running pods of the specified type"
|
34
|
+
def logs(pod_type, status= :running)
|
35
|
+
Pods.logs(pod_type, status)
|
36
|
+
end
|
37
|
+
|
34
38
|
desc "deploy", "Perform a deployment"
|
35
39
|
method_option :namespace, type: :string, aliases: "-n"
|
36
40
|
method_option :environment, type: :string, aliases: "-e"
|
data/lib/kubert/pods.rb
CHANGED
@@ -12,6 +12,10 @@ module Kubert
|
|
12
12
|
new.execute(command)
|
13
13
|
end
|
14
14
|
|
15
|
+
def self.logs(pod_type, status)
|
16
|
+
new.all(pod_type).status(status).logs
|
17
|
+
end
|
18
|
+
|
15
19
|
attr_reader :project_name, :pods
|
16
20
|
def initialize(project_name= Kubert.configuration[:project_name])
|
17
21
|
@project_name = project_name
|
@@ -42,5 +46,22 @@ module Kubert
|
|
42
46
|
puts "THIS WILL NEVER EXECUTE BECAUSE OF EXEC ABOVE"
|
43
47
|
end
|
44
48
|
|
49
|
+
def logs
|
50
|
+
fibers = names.map.with_index do |pod_name, i|
|
51
|
+
puts "logging #{pod_name}:"
|
52
|
+
watcher = Kubert.client.watch_pod_log(pod_name, pods.first.metadata.namespace)
|
53
|
+
pod_name = names[i]
|
54
|
+
log_enum = watcher.to_enum
|
55
|
+
Fiber.new do
|
56
|
+
loop do
|
57
|
+
Fiber.yield(puts "#{pod_name} |> #{log_enum.next}")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
while fibers.all?(&:alive?) do
|
62
|
+
fibers.shuffle.each(&:resume)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
45
66
|
end
|
46
67
|
end
|
data/lib/kubert/version.rb
CHANGED
data/lib/kubert.rb
CHANGED