class Dapp::Kube::Kubernetes::Client::Resource::Pod

Public Instance Methods

container_id(container_name) click to toggle source
# File lib/dapp/kube/kubernetes/client/resource/pod.rb, line 19
def container_id(container_name)
  container_status = spec.fetch('status', {})
    .fetch('containerStatuses')
    .find {|cs| cs['name'] == container_name}

  if container_status
    container_status['containerID']
  else
    nil
  end
end
container_state(container_name) click to toggle source
# File lib/dapp/kube/kubernetes/client/resource/pod.rb, line 31
def container_state(container_name)
  container_status = status
    .fetch('containerStatuses', [])
    .find {|cs| cs['name'] == container_name}

  if container_status
    container_state, container_state_data = container_status.fetch('state', {}).first
    [container_state, container_state_data]
  else
    [nil, {}]
  end
end
containers_names() click to toggle source
# File lib/dapp/kube/kubernetes/client/resource/pod.rb, line 48
def containers_names
  spec.fetch('spec', {})
    .fetch('containers', [])
    .map {|container_spec| container_spec['name']}
end
phase() click to toggle source
# File lib/dapp/kube/kubernetes/client/resource/pod.rb, line 44
def phase
  status.fetch('phase', nil)
end
ready_condition() click to toggle source
# File lib/dapp/kube/kubernetes/client/resource/pod.rb, line 15
def ready_condition
  status.fetch('conditions', {}).find {|condition| condition['type'] == 'Ready'}
end
ready_condition_status() click to toggle source

Returns:

nil: no such condition yet
"True" string: ready
"False" string: not ready
# File lib/dapp/kube/kubernetes/client/resource/pod.rb, line 9
def ready_condition_status
  rd = self.ready_condition
  return nil unless rd
  return rd['status']
end
restart_policy() click to toggle source
# File lib/dapp/kube/kubernetes/client/resource/pod.rb, line 54
def restart_policy
  spec
    .fetch('spec', {})
    .fetch('restartPolicy', nil)
end