Class: Kubernetes::V1PodStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/kubernetes/models/v1_pod_status.rb

Overview

PodStatus represents information about the status of a pod. Status may trail the actual state of a system, especially if the node that hosts the pod cannot contact the control plane.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ V1PodStatus

Initializes the object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/kubernetes/models/v1_pod_status.rb', line 87

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.transform_keys(&:to_sym)

  if attributes.key?(:conditions) && (value = attributes[:conditions]).is_a?(Array)
    self.conditions = value
  end

  if attributes.key?(:containerStatuses) && (value = attributes[:containerStatuses]).is_a?(Array)
    self.container_statuses = value
  end

  self.host_ip = attributes[:hostIP] if attributes.key?(:hostIP)

  if attributes.key?(:initContainerStatuses) && (value = attributes[:initContainerStatuses]).is_a?(Array)
    self.init_container_statuses = value
  end

  self.message = attributes[:message] if attributes.key?(:message)

  if attributes.key?(:nominatedNodeName)
    self.nominated_node_name = attributes[:nominatedNodeName]
  end

  self.phase = attributes[:phase] if attributes.key?(:phase)

  self.pod_ip = attributes[:podIP] if attributes.key?(:podIP)

  self.qos_class = attributes[:qosClass] if attributes.key?(:qosClass)

  self.reason = attributes[:reason] if attributes.key?(:reason)

  self.start_time = attributes[:startTime] if attributes.key?(:startTime)
end

Instance Attribute Details

#conditionsObject



19
20
21
# File 'lib/kubernetes/models/v1_pod_status.rb', line 19

def conditions
  @conditions
end

#container_statusesObject

The list has one entry per container in the manifest. Each entry is currently the output of ‘docker inspect`. More info: kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status



22
23
24
# File 'lib/kubernetes/models/v1_pod_status.rb', line 22

def container_statuses
  @container_statuses
end

#host_ipObject

IP address of the host to which the pod is assigned. Empty if not yet scheduled.



25
26
27
# File 'lib/kubernetes/models/v1_pod_status.rb', line 25

def host_ip
  @host_ip
end

#init_container_statusesObject

The list has one entry per init container in the manifest. The most recent successful init container will have ready = true, the most recently started container will have startTime set. More info: kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status



28
29
30
# File 'lib/kubernetes/models/v1_pod_status.rb', line 28

def init_container_statuses
  @init_container_statuses
end

#messageObject

A human readable message indicating details about why the pod is in this condition.



31
32
33
# File 'lib/kubernetes/models/v1_pod_status.rb', line 31

def message
  @message
end

#nominated_node_nameObject

nominatedNodeName is set only when this pod preempts other pods on the node, but it cannot be scheduled right away as preemption victims receive their graceful termination periods. This field does not guarantee that the pod will be scheduled on this node. Scheduler may decide to place the pod elsewhere if other nodes become available sooner. Scheduler may also decide to give the resources on this node to a higher priority pod that is created after preemption. As a result, this field may be different than PodSpec.nodeName when the pod is scheduled.



34
35
36
# File 'lib/kubernetes/models/v1_pod_status.rb', line 34

def nominated_node_name
  @nominated_node_name
end

#phaseObject

The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. The conditions array, the reason and message fields, and the individual container status arrays contain more detail about the pod’s status. There are five possible phase values: Pending: The pod has been accepted by the Kubernetes system, but one or more of the container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while. Running: The pod has been bound to a node, and all of the containers have been created. At least one container is still running, or is in the process of starting or restarting. Succeeded: All containers in the pod have terminated in success, and will not be restarted. Failed: All containers in the pod have terminated, and at least one container has terminated in failure. The container either exited with non-zero status or was terminated by the system. Unknown: For some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod. More info: kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase



37
38
39
# File 'lib/kubernetes/models/v1_pod_status.rb', line 37

def phase
  @phase
end

#pod_ipObject

IP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.



40
41
42
# File 'lib/kubernetes/models/v1_pod_status.rb', line 40

def pod_ip
  @pod_ip
end

#qos_classObject

The Quality of Service (QOS) classification assigned to the pod based on resource requirements See PodQOSClass type for available QOS classes More info: git.k8s.io/community/contributors/design-proposals/node/resource-qos.md



43
44
45
# File 'lib/kubernetes/models/v1_pod_status.rb', line 43

def qos_class
  @qos_class
end

#reasonObject

A brief CamelCase message indicating details about why the pod is in this state. e.g. ‘Evicted’



46
47
48
# File 'lib/kubernetes/models/v1_pod_status.rb', line 46

def reason
  @reason
end

#start_timeObject

RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod.



49
50
51
# File 'lib/kubernetes/models/v1_pod_status.rb', line 49

def start_time
  @start_time
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/kubernetes/models/v1_pod_status.rb', line 52

def self.attribute_map
  {
    conditions: :conditions,
    container_statuses: :containerStatuses,
    host_ip: :hostIP,
    init_container_statuses: :initContainerStatuses,
    message: :message,
    nominated_node_name: :nominatedNodeName,
    phase: :phase,
    pod_ip: :podIP,
    qos_class: :qosClass,
    reason: :reason,
    start_time: :startTime
  }
end

.swagger_typesObject

Attribute type mapping.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/kubernetes/models/v1_pod_status.rb', line 69

def self.swagger_types
  {
    conditions: :'Array<V1PodCondition>',
    container_statuses: :'Array<V1ContainerStatus>',
    host_ip: :String,
    init_container_statuses: :'Array<V1ContainerStatus>',
    message: :String,
    nominated_node_name: :String,
    phase: :String,
    pod_ip: :String,
    qos_class: :String,
    reason: :String,
    start_time: :DateTime
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/kubernetes/models/v1_pod_status.rb', line 138

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    conditions == other.conditions &&
    container_statuses == other.container_statuses &&
    host_ip == other.host_ip &&
    init_container_statuses == other.init_container_statuses &&
    message == other.message &&
    nominated_node_name == other.nominated_node_name &&
    phase == other.phase &&
    pod_ip == other.pod_ip &&
    qos_class == other.qos_class &&
    reason == other.reason &&
    start_time == other.start_time
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/kubernetes/models/v1_pod_status.rb', line 195

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = Kubernetes.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value



262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/kubernetes/models/v1_pod_status.rb', line 262

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/kubernetes/models/v1_pod_status.rb', line 171

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
                          _deserialize(Regexp.last_match(1), v)
                        end)
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(other) ⇒ Boolean

See Also:

  • `==` method


157
158
159
# File 'lib/kubernetes/models/v1_pod_status.rb', line 157

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.



163
164
165
166
# File 'lib/kubernetes/models/v1_pod_status.rb', line 163

def hash
  [conditions, container_statuses, host_ip, init_container_statuses, message,
   nominated_node_name, phase, pod_ip, qos_class, reason, start_time].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?



126
127
128
# File 'lib/kubernetes/models/v1_pod_status.rb', line 126

def list_invalid_properties
  []
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)



241
242
243
# File 'lib/kubernetes/models/v1_pod_status.rb', line 241

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash



247
248
249
250
251
252
253
254
255
256
# File 'lib/kubernetes/models/v1_pod_status.rb', line 247

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = send(attr)
    next if value.nil?

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object



235
236
237
# File 'lib/kubernetes/models/v1_pod_status.rb', line 235

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid



132
133
134
# File 'lib/kubernetes/models/v1_pod_status.rb', line 132

def valid?
  true
end