Class: Vidar::DeployStatus
- Inherits:
-
Object
- Object
- Vidar::DeployStatus
- Defined in:
- lib/vidar/deploy_status.rb
Constant Summary collapse
- INITIAL_SLEEP =
2
- SLEEP =
10
- MAX_TRIES =
30
Instance Attribute Summary collapse
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
-
#max_tries ⇒ Object
readonly
Returns the value of attribute max_tries.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
-
#initialize(namespace:, filter: nil, max_tries: MAX_TRIES) ⇒ DeployStatus
constructor
A new instance of DeployStatus.
- #last_pod_set ⇒ Object
- #pod_set ⇒ Object
- #success? ⇒ Boolean
- #wait_until_completed ⇒ Object
- #wait_until_up ⇒ Object
Constructor Details
#initialize(namespace:, filter: nil, max_tries: MAX_TRIES) ⇒ DeployStatus
Returns a new instance of DeployStatus.
9 10 11 12 13 |
# File 'lib/vidar/deploy_status.rb', line 9 def initialize(namespace:, filter: nil, max_tries: MAX_TRIES) @namespace = namespace @filter = filter @max_tries = max_tries end |
Instance Attribute Details
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
7 8 9 |
# File 'lib/vidar/deploy_status.rb', line 7 def filter @filter end |
#max_tries ⇒ Object (readonly)
Returns the value of attribute max_tries.
7 8 9 |
# File 'lib/vidar/deploy_status.rb', line 7 def max_tries @max_tries end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
7 8 9 |
# File 'lib/vidar/deploy_status.rb', line 7 def namespace @namespace end |
Instance Method Details
#last_pod_set ⇒ Object
49 50 51 |
# File 'lib/vidar/deploy_status.rb', line 49 def last_pod_set @pod_set end |
#pod_set ⇒ Object
53 54 55 |
# File 'lib/vidar/deploy_status.rb', line 53 def pod_set @pod_set = K8s::PodSet.new(namespace:, filter:) end |
#success? ⇒ Boolean
43 44 45 46 47 |
# File 'lib/vidar/deploy_status.rb', line 43 def success? return false unless last_pod_set last_pod_set.success? end |
#wait_until_completed ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vidar/deploy_status.rb', line 29 def wait_until_completed tries = 0 sleep(INITIAL_SLEEP) until pod_set.deployed? tries += 1 sleep(SLEEP) if tries > max_tries break end end end |
#wait_until_up ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/vidar/deploy_status.rb', line 15 def wait_until_up tries = 0 sleep(INITIAL_SLEEP) until pod_set.any? tries += 1 sleep(SLEEP) if tries > max_tries break end end end |