Class: Vidar::K8s::PodSet

Inherits:
Object
  • Object
show all
Defined in:
lib/vidar/k8s/pod_set.rb

Instance Method Summary collapse

Constructor Details

#initialize(namespace:, filter: nil) ⇒ PodSet

Returns a new instance of PodSet.



4
5
6
7
# File 'lib/vidar/k8s/pod_set.rb', line 4

def initialize(namespace:, filter: nil)
  @namespace = namespace
  @filter = filter
end

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/vidar/k8s/pod_set.rb', line 9

def any?
  containers.any?
end

#containersObject



34
35
36
37
38
39
40
# File 'lib/vidar/k8s/pod_set.rb', line 34

def containers
  if filter
    all_containers.select { |cs| cs.name.to_s.include?(filter) }
  else
    all_containers.reject(&:job?)
  end
end

#deployed?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vidar/k8s/pod_set.rb', line 13

def deployed?
  if items.empty?
    Log.error "Could not fetch pod list"
    return false
  end

  Log.line

  containers.each(&:print)

  Log.line

  containers.all?(&:deployed?)
end

#success?Boolean

Returns:

  • (Boolean)


28
29
30
31
32
# File 'lib/vidar/k8s/pod_set.rb', line 28

def success?
  return false if containers.empty?

  containers.all?(&:success?)
end