Sha256: a727b16feb011b6e3b5a7c1e3eee58f94f9d5f30127f81a84040bc11b102fc17

Contents?: true

Size: 968 Bytes

Versions: 14

Compression:

Stored size: 968 Bytes

Contents

module Vidar
  class DeployStatus
    INITIAL_SLEEP = 2
    SLEEP = 10
    MAX_TRIES = 30

    attr_reader :namespace, :filter, :max_tries

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

    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

    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

    def success?
      return false unless last_pod_set

      last_pod_set.success?
    end

    def last_pod_set
      @pod_set
    end

    def pod_set
      @pod_set = K8s::PodSet.new(namespace: namespace, filter: filter)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
vidar-1.9.4 lib/vidar/deploy_status.rb
vidar-1.9.3 lib/vidar/deploy_status.rb
vidar-1.9.2 lib/vidar/deploy_status.rb
vidar-1.9.1 lib/vidar/deploy_status.rb
vidar-1.9.0 lib/vidar/deploy_status.rb
vidar-1.8.0 lib/vidar/deploy_status.rb
vidar-1.8.0.rc4 lib/vidar/deploy_status.rb
vidar-1.7.0 lib/vidar/deploy_status.rb
vidar-1.6.0 lib/vidar/deploy_status.rb
vidar-1.5.4 lib/vidar/deploy_status.rb
vidar-1.5.3 lib/vidar/deploy_status.rb
vidar-1.5.2 lib/vidar/deploy_status.rb
vidar-1.5.1 lib/vidar/deploy_status.rb
vidar-1.4.3 lib/vidar/deploy_status.rb