Class: Zilla::IoK8sApiCoreV1PodStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/zilla/models/io_k8s_api_core_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 = {}) ⇒ IoK8sApiCoreV1PodStatus

Initializes the object

Parameters:

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

    Model attributes in the form of hash



108
109
110
111
112
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 108

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    raise ArgumentError,
          'The input argument (attributes) must be a hash in `Zilla::IoK8sApiCoreV1PodStatus` initialize method'
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) do |(k, v), h|
    unless self.class.attribute_map.key?(k.to_sym)
      raise ArgumentError,
            "`#{k}` is not a valid attribute in `Zilla::IoK8sApiCoreV1PodStatus`. 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
  end

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

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

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

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

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

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

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

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

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

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

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

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

  return unless attributes.key?(:start_time)

  self.start_time = attributes[:start_time]
end

Instance Attribute Details

#conditionsObject



20
21
22
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 20

def conditions
  @conditions
end

#container_statusesObject

The list has one entry per container in the manifest. More info: kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status



23
24
25
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 23

def container_statuses
  @container_statuses
end

#ephemeral_container_statusesObject

Status for any ephemeral containers that have run in this pod.



26
27
28
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 26

def ephemeral_container_statuses
  @ephemeral_container_statuses
end

#host_ipObject

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



29
30
31
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 29

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



32
33
34
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 32

def init_container_statuses
  @init_container_statuses
end

#messageObject

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



35
36
37
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 35

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.



38
39
40
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 38

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



41
42
43
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 41

def phase
  @phase
end

#pod_ipObject

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



44
45
46
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 44

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.



47
48
49
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 47

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: git.k8s.io/community/contributors/design-proposals/node/resource-qos.md



50
51
52
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 50

def qos_class
  @qos_class
end

#reasonObject

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



53
54
55
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 53

def reason
  @reason
end

#start_timeObject

Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.



56
57
58
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 56

def start_time
  @start_time
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



78
79
80
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 78

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 59

def self.attribute_map
  {
    conditions: :conditions,
    container_statuses: :containerStatuses,
    ephemeral_container_statuses: :ephemeralContainerStatuses,
    host_ip: :hostIP,
    init_container_statuses: :initContainerStatuses,
    message: :message,
    nominated_node_name: :nominatedNodeName,
    phase: :phase,
    pod_ip: :podIP,
    pod_ips: :podIPs,
    qos_class: :qosClass,
    reason: :reason,
    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



212
213
214
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 212

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

.openapi_nullableObject

List of attributes with nullable: true



102
103
104
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 102

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

.openapi_typesObject

Attribute type mapping.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 83

def self.openapi_types
  {
    conditions: :'Array<IoK8sApiCoreV1PodCondition>',
    container_statuses: :'Array<IoK8sApiCoreV1ContainerStatus>',
    ephemeral_container_statuses: :'Array<IoK8sApiCoreV1ContainerStatus>',
    host_ip: :String,
    init_container_statuses: :'Array<IoK8sApiCoreV1ContainerStatus>',
    message: :String,
    nominated_node_name: :String,
    phase: :String,
    pod_ip: :String,
    pod_ips: :'Array<IoK8sApiCoreV1PodIP>',
    qos_class: :String,
    reason: :String,
    start_time: :Time
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 177

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

  self.class == other.class &&
    conditions == other.conditions &&
    container_statuses == other.container_statuses &&
    ephemeral_container_statuses == other.ephemeral_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 &&
    pod_ips == other.pod_ips &&
    qos_class == other.qos_class &&
    reason == other.reason &&
    start_time == other.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



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 246

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 = Zilla.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



317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 317

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



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 219

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

  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      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)
        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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


198
199
200
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 198

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



204
205
206
207
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 204

def hash
  [conditions, container_statuses, ephemeral_container_statuses, host_ip, init_container_statuses, message,
   nominated_node_name, phase, pod_ip, pod_ips, qos_class, reason, 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



165
166
167
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 165

def list_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



293
294
295
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 293

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



299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 299

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = 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



287
288
289
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 287

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



171
172
173
# File 'lib/zilla/models/io_k8s_api_core_v1_pod_status.rb', line 171

def valid?
  true
end