Class: Dapp::Kube::Kubernetes::Manager::Pod
- Inherits:
-
Base
- Object
- Base
- Dapp::Kube::Kubernetes::Manager::Pod
show all
- Defined in:
- lib/dapp/kube/kubernetes/manager/pod.rb
Instance Attribute Summary
Attributes inherited from Base
#dapp, #name
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#containers ⇒ Object
5
6
7
8
9
10
|
# File 'lib/dapp/kube/kubernetes/manager/pod.rb', line 5
def containers
pod = Kubernetes::Client::Resource::Pod.new(dapp.kubernetes.pod(name))
@containers ||= pod.containers_names.map do |container_name|
Container.new(dapp, container_name, self)
end
end
|
#wait_till_running! ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/dapp/kube/kubernetes/manager/pod.rb', line 12
def wait_till_running!
loop do
pod = Kubernetes::Client::Resource::Pod.new(dapp.kubernetes.pod(name))
break if pod.phase == 'Running'
sleep 0.1
end
end
|
#watch_till_done! ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/dapp/kube/kubernetes/manager/pod.rb', line 20
def watch_till_done!
process_queue = containers.map {|c| [c, nil]}
loop do
container, last_processed_at = process_queue.shift
break unless container
sleep 1 if last_processed_at and (Time.now - last_processed_at < 1)
container.watch_till_terminated!
process_queue.push([container, Time.now]) unless container.done?
end
end
|