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

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/kubernetes/models/v1_pod_status.rb', line 142

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Kubernetes::V1PodStatus` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Kubernetes::V1PodStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'allocated_resources')
    if (value = attributes[:'allocated_resources']).is_a?(Hash)
      self.allocated_resources = value
    end
  end

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

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

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

  if attributes.key?(:'extended_resource_claim_status')
    self.extended_resource_claim_status = attributes[:'extended_resource_claim_status']
  end

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

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

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

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

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

  if attributes.key?(:'observed_generation')
    self.observed_generation = attributes[:'observed_generation']
  end

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

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

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

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

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

  if attributes.key?(:'resize')
    self.resize = attributes[:'resize']
  end

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

  if attributes.key?(:'resources')
    self.resources = attributes[:'resources']
  end

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

Instance Attribute Details

#allocated_resourcesObject

AllocatedResources is the total requests allocated for this pod by the node. If pod-level requests are not set, this will be the total requests aggregated across containers in the pod.



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

def allocated_resources
  @allocated_resources
end

#conditionsObject



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

def conditions
  @conditions
end

#container_statusesObject

Statuses of containers in this pod. Each container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status



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

def container_statuses
  @container_statuses
end

#ephemeral_container_statusesObject

Statuses for any ephemeral containers that have run in this pod. Each ephemeral container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status



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

def ephemeral_container_statuses
  @ephemeral_container_statuses
end

#extended_resource_claim_statusObject

Returns the value of attribute extended_resource_claim_status.



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

def extended_resource_claim_status
  @extended_resource_claim_status
end

#host_ipObject

hostIP holds the IP address of the host to which the pod is assigned. Empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns mean that HostIP will not be updated even if there is a node is assigned to pod



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

def host_ip
  @host_ip
end

#host_ipsObject

hostIPs holds the IP addresses allocated to the host. If this field is specified, the first entry must match the hostIP field. This list is empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns means that HostIPs will not be updated even if there is a node is assigned to this pod.



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

def host_ips
  @host_ips
end

#init_container_statusesObject

Statuses of init containers in this pod. The most recent successful non-restartable init container will have ready = true, the most recently started container will have startTime set. Each init container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-and-container-status



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

def init_container_statuses
  @init_container_statuses
end

#messageObject

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



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

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.



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

def nominated_node_name
  @nominated_node_name
end

#observed_generationObject

If set, this represents the .metadata.generation that the pod status was set based upon. The PodObservedGenerationTracking feature gate must be enabled to use this field.



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

def observed_generation
  @observed_generation
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



52
53
54
# File 'lib/kubernetes/models/v1_pod_status.rb', line 52

def phase
  @phase
end

#pod_ipObject

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



55
56
57
# File 'lib/kubernetes/models/v1_pod_status.rb', line 55

def pod_ip
  @pod_ip
end

#pod_ipsObject

podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list is empty if no IPs have been allocated yet.



58
59
60
# File 'lib/kubernetes/models/v1_pod_status.rb', line 58

def pod_ips
  @pod_ips
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: kubernetes.io/docs/concepts/workloads/pods/pod-qos/#quality-of-service-classes



61
62
63
# File 'lib/kubernetes/models/v1_pod_status.rb', line 61

def qos_class
  @qos_class
end

#reasonObject

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



64
65
66
# File 'lib/kubernetes/models/v1_pod_status.rb', line 64

def reason
  @reason
end

#resizeObject

Status of resources resize desired for pod’s containers. It is empty if no resources resize is pending. Any changes to container resources will automatically set this to "Proposed" Deprecated: Resize status is moved to two pod conditions PodResizePending and PodResizeInProgress. PodResizePending will track states where the spec has been resized, but the Kubelet has not yet allocated the resources. PodResizeInProgress will track in-progress resizes, and should be present whenever allocated resources != acknowledged resources.



67
68
69
# File 'lib/kubernetes/models/v1_pod_status.rb', line 67

def resize
  @resize
end

#resource_claim_statusesObject

Status of resource claims.



70
71
72
# File 'lib/kubernetes/models/v1_pod_status.rb', line 70

def resource_claim_statuses
  @resource_claim_statuses
end

#resourcesObject

Returns the value of attribute resources.



72
73
74
# File 'lib/kubernetes/models/v1_pod_status.rb', line 72

def resources
  @resources
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.



75
76
77
# File 'lib/kubernetes/models/v1_pod_status.rb', line 75

def start_time
  @start_time
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



104
105
106
# File 'lib/kubernetes/models/v1_pod_status.rb', line 104

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/kubernetes/models/v1_pod_status.rb', line 78

def self.attribute_map
  {
    :'allocated_resources' => :'allocatedResources',
    :'conditions' => :'conditions',
    :'container_statuses' => :'containerStatuses',
    :'ephemeral_container_statuses' => :'ephemeralContainerStatuses',
    :'extended_resource_claim_status' => :'extendedResourceClaimStatus',
    :'host_ip' => :'hostIP',
    :'host_ips' => :'hostIPs',
    :'init_container_statuses' => :'initContainerStatuses',
    :'message' => :'message',
    :'nominated_node_name' => :'nominatedNodeName',
    :'observed_generation' => :'observedGeneration',
    :'phase' => :'phase',
    :'pod_ip' => :'podIP',
    :'pod_ips' => :'podIPs',
    :'qos_class' => :'qosClass',
    :'reason' => :'reason',
    :'resize' => :'resize',
    :'resource_claim_statuses' => :'resourceClaimStatuses',
    :'resources' => :'resources',
    :'start_time' => :'startTime'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



307
308
309
# File 'lib/kubernetes/models/v1_pod_status.rb', line 307

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



135
136
137
138
# File 'lib/kubernetes/models/v1_pod_status.rb', line 135

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/kubernetes/models/v1_pod_status.rb', line 109

def self.openapi_types
  {
    :'allocated_resources' => :'Hash<String, String>',
    :'conditions' => :'Array<V1PodCondition>',
    :'container_statuses' => :'Array<V1ContainerStatus>',
    :'ephemeral_container_statuses' => :'Array<V1ContainerStatus>',
    :'extended_resource_claim_status' => :'V1PodExtendedResourceClaimStatus',
    :'host_ip' => :'String',
    :'host_ips' => :'Array<V1HostIP>',
    :'init_container_statuses' => :'Array<V1ContainerStatus>',
    :'message' => :'String',
    :'nominated_node_name' => :'String',
    :'observed_generation' => :'Integer',
    :'phase' => :'String',
    :'pod_ip' => :'String',
    :'pod_ips' => :'Array<V1PodIP>',
    :'qos_class' => :'String',
    :'reason' => :'String',
    :'resize' => :'String',
    :'resource_claim_statuses' => :'Array<V1PodResourceClaimStatus>',
    :'resources' => :'V1ResourceRequirements',
    :'start_time' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/kubernetes/models/v1_pod_status.rb', line 267

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      allocated_resources == o.allocated_resources &&
      conditions == o.conditions &&
      container_statuses == o.container_statuses &&
      ephemeral_container_statuses == o.ephemeral_container_statuses &&
      extended_resource_claim_status == o.extended_resource_claim_status &&
      host_ip == o.host_ip &&
      host_ips == o.host_ips &&
      init_container_statuses == o.init_container_statuses &&
      message == o.message &&
      nominated_node_name == o.nominated_node_name &&
      observed_generation == o.observed_generation &&
      phase == o.phase &&
      pod_ip == o.pod_ip &&
      pod_ips == o.pod_ips &&
      qos_class == o.qos_class &&
      reason == o.reason &&
      resize == o.resize &&
      resource_claim_statuses == o.resource_claim_statuses &&
      resources == o.resources &&
      start_time == o.start_time
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/kubernetes/models/v1_pod_status.rb', line 337

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = Kubernetes.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



408
409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/kubernetes/models/v1_pod_status.rb', line 408

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/kubernetes/models/v1_pod_status.rb', line 314

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

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


294
295
296
# File 'lib/kubernetes/models/v1_pod_status.rb', line 294

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



300
301
302
# File 'lib/kubernetes/models/v1_pod_status.rb', line 300

def hash
  [allocated_resources, conditions, container_statuses, ephemeral_container_statuses, extended_resource_claim_status, host_ip, host_ips, init_container_statuses, message, nominated_node_name, observed_generation, phase, pod_ip, pod_ips, qos_class, reason, resize, resource_claim_statuses, resources, start_time].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



254
255
256
257
# File 'lib/kubernetes/models/v1_pod_status.rb', line 254

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



384
385
386
# File 'lib/kubernetes/models/v1_pod_status.rb', line 384

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/kubernetes/models/v1_pod_status.rb', line 390

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



378
379
380
# File 'lib/kubernetes/models/v1_pod_status.rb', line 378

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



261
262
263
# File 'lib/kubernetes/models/v1_pod_status.rb', line 261

def valid?
  true
end