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



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
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/kubernetes/models/v1_pod_status.rb', line 147

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?(:'node_allocatable_resource_claim_statuses')
    if (value = attributes[:'node_allocatable_resource_claim_statuses']).is_a?(Array)
      self.node_allocatable_resource_claim_statuses = value
    end
  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

#node_allocatable_resource_claim_statusesObject

NodeAllocatableResourceClaimStatuses contains the status of node-allocatable resources that were allocated for this pod through DRA claims. This includes resources currently reported in v1.Node ‘status.allocatable` that are not extended resources (see kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include "cpu", "memory", "ephemeral-storage", and hugepages.



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

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



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

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.



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

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



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

def phase
  @phase
end

#pod_ipObject

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



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

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.



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

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



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

def qos_class
  @qos_class
end

#reasonObject

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



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

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.



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

def resize
  @resize
end

#resource_claim_statusesObject

Status of resource claims.



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

def resource_claim_statuses
  @resource_claim_statuses
end

#resourcesObject

Returns the value of attribute resources.



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

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.



78
79
80
# File 'lib/kubernetes/models/v1_pod_status.rb', line 78

def start_time
  @start_time
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



108
109
110
# File 'lib/kubernetes/models/v1_pod_status.rb', line 108

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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

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',
    :'node_allocatable_resource_claim_statuses' => :'nodeAllocatableResourceClaimStatuses',
    :'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



319
320
321
# File 'lib/kubernetes/models/v1_pod_status.rb', line 319

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

.openapi_nullableObject

List of attributes with nullable: true



140
141
142
143
# File 'lib/kubernetes/models/v1_pod_status.rb', line 140

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

.openapi_typesObject

Attribute type mapping.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/kubernetes/models/v1_pod_status.rb', line 113

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',
    :'node_allocatable_resource_claim_statuses' => :'Array<V1NodeAllocatableResourceClaimStatus>',
    :'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



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/kubernetes/models/v1_pod_status.rb', line 278

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 &&
      node_allocatable_resource_claim_statuses == o.node_allocatable_resource_claim_statuses &&
      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



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
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/kubernetes/models/v1_pod_status.rb', line 349

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



420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/kubernetes/models/v1_pod_status.rb', line 420

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



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/kubernetes/models/v1_pod_status.rb', line 326

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


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

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



312
313
314
# File 'lib/kubernetes/models/v1_pod_status.rb', line 312

def hash
  [allocated_resources, conditions, container_statuses, ephemeral_container_statuses, extended_resource_claim_status, host_ip, host_ips, init_container_statuses, message, node_allocatable_resource_claim_statuses, 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



265
266
267
268
# File 'lib/kubernetes/models/v1_pod_status.rb', line 265

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



396
397
398
# File 'lib/kubernetes/models/v1_pod_status.rb', line 396

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



402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/kubernetes/models/v1_pod_status.rb', line 402

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



390
391
392
# File 'lib/kubernetes/models/v1_pod_status.rb', line 390

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



272
273
274
# File 'lib/kubernetes/models/v1_pod_status.rb', line 272

def valid?
  true
end