Sha256: cebb9794ef015726ce94da7f1f1d323d6aa52c5df88b8f6fccade2ec847110df
Contents?: true
Size: 991 Bytes
Versions: 13
Compression:
Stored size: 991 Bytes
Contents
require 'date' require 'picsolve_docker_builder/helpers/kubernetes/resource' module PicsolveDockerBuilder module Helpers module Kubernetes # A generic kuberntes resource class Pod < Resource attr_reader :pod def initialize(pod, kubernetes) @pod = pod @kubernetes = kubernetes # seconds after a running pod consider as healthy @grace_time = 20 end def remove log.debug "remove pod #{pod.metadata.name}" client.delete_pod(@pod.metadata.name, @pod.metadata.namespace) end def ready? # ensure pod is running return false unless pod.status.phase == 'Running' diff = DateTime.now - DateTime.strptime(pod.status.startTime) diff_seconds = diff * 24 * 60 * 60 # ensure pod is running for more than 20 seconds return false if diff_seconds < @grace_time true end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems