Class: Kubernetes::V1PodSpec

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

Overview

PodSpec is a description of a pod.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ V1PodSpec

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 248

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Kubernetes::V1PodSpec` 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::V1PodSpec`. 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?(:'active_deadline_seconds')
    self.active_deadline_seconds = attributes[:'active_deadline_seconds']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#active_deadline_secondsObject

Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer.



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

def active_deadline_seconds
  @active_deadline_seconds
end

#affinityObject

Returns the value of attribute affinity.



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

def affinity
  @affinity
end

#automount_service_account_tokenObject

AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.



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

def 
  @automount_service_account_token
end

#containersObject

List of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least one container in a Pod. Cannot be updated.



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

def containers
  @containers
end

#dns_configObject

Returns the value of attribute dns_config.



30
31
32
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 30

def dns_config
  @dns_config
end

#dns_policyObject

Set DNS policy for the pod. Defaults to "ClusterFirst". Valid values are ‘ClusterFirstWithHostNet’, ‘ClusterFirst’, ‘Default’ or ‘None’. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to ‘ClusterFirstWithHostNet’.



33
34
35
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 33

def dns_policy
  @dns_policy
end

EnableServiceLinks indicates whether information about services should be injected into pod’s environment variables, matching the syntax of Docker links. Optional: Defaults to true.



36
37
38
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 36

def enable_service_links
  @enable_service_links
end

#ephemeral_containersObject

List of ephemeral containers run in this pod. Ephemeral containers may be run in an existing pod to perform user-initiated actions such as debugging. This list cannot be specified when creating a pod, and it cannot be modified by updating the pod spec. In order to add an ephemeral container to an existing pod, use the pod’s ephemeralcontainers subresource.



39
40
41
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 39

def ephemeral_containers
  @ephemeral_containers
end

#host_aliasesObject

HostAliases is an optional list of hosts and IPs that will be injected into the pod’s hosts file if specified.



42
43
44
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 42

def host_aliases
  @host_aliases
end

#host_ipcObject

Use the host’s ipc namespace. Optional: Default to false.



45
46
47
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 45

def host_ipc
  @host_ipc
end

#host_networkObject

Host networking requested for this pod. Use the host’s network namespace. When using HostNetwork you should specify ports so the scheduler is aware. When ‘hostNetwork` is true, specified `hostPort` fields in port definitions must match `containerPort`, and unspecified `hostPort` fields in port definitions are defaulted to match `containerPort`. Default to false.



48
49
50
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 48

def host_network
  @host_network
end

#host_pidObject

Use the host’s pid namespace. Optional: Default to false.



51
52
53
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 51

def host_pid
  @host_pid
end

#host_usersObject

Use the host’s user namespace. Optional: Default to true. If set to true or not present, the pod will be run in the host user namespace, useful for when the pod needs a feature only available to the host user namespace, such as loading a kernel module with CAP_SYS_MODULE. When set to false, a new userns is created for the pod. Setting false is useful for mitigating container breakout vulnerabilities even allowing users to run their containers as root without actually having root privileges on the host. This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature.



54
55
56
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 54

def host_users
  @host_users
end

#hostnameObject

Specifies the hostname of the Pod If not specified, the pod’s hostname will be set to a system-defined value.



57
58
59
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 57

def hostname
  @hostname
end

#hostname_overrideObject

HostnameOverride specifies an explicit override for the pod’s hostname as perceived by the pod. This field only specifies the pod’s hostname and does not affect its DNS records. When this field is set to a non-empty string: - It takes precedence over the values set in ‘hostname` and `subdomain`. - The Pod’s hostname will be set to this value. - ‘setHostnameAsFQDN` must be nil or set to false. - `hostNetwork` must be set to false. This field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters. Requires the HostnameOverride feature gate to be enabled.



60
61
62
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 60

def hostname_override
  @hostname_override
end

#image_pull_secretsObject

ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. More info: kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod



63
64
65
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 63

def image_pull_secrets
  @image_pull_secrets
end

#init_containersObject

List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed. Cannot be updated. More info: kubernetes.io/docs/concepts/workloads/pods/init-containers/



66
67
68
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 66

def init_containers
  @init_containers
end

#node_nameObject

NodeName indicates in which node this pod is scheduled. If empty, this pod is a candidate for scheduling by the scheduler defined in schedulerName. Once this field is set, the kubelet for this node becomes responsible for the lifecycle of this pod. This field should not be used to express a desire for the pod to be scheduled on a specific node. kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodename



69
70
71
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 69

def node_name
  @node_name
end

#node_selectorObject

NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node’s labels for the pod to be scheduled on that node. More info: kubernetes.io/docs/concepts/configuration/assign-pod-node/



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

def node_selector
  @node_selector
end

#osObject

Returns the value of attribute os.



74
75
76
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 74

def os
  @os
end

#overheadObject

Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md



77
78
79
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 77

def overhead
  @overhead
end

#preemption_policyObject

PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.



80
81
82
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 80

def preemption_policy
  @preemption_policy
end

#priorityObject

The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.



83
84
85
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 83

def priority
  @priority
end

#priority_class_nameObject

If specified, indicates the pod’s priority. "system-node-critical" and "system-cluster-critical" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default.



86
87
88
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 86

def priority_class_name
  @priority_class_name
end

#readiness_gatesObject

If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to "True" More info: git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates



89
90
91
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 89

def readiness_gates
  @readiness_gates
end

#resource_claimsObject

ResourceClaims defines which ResourceClaims must be allocated and reserved before the Pod is allowed to start. The resources will be made available to those containers which consume them by name. This is a stable field but requires that the DynamicResourceAllocation feature gate is enabled. This field is immutable.



92
93
94
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 92

def resource_claims
  @resource_claims
end

#resourcesObject

Returns the value of attribute resources.



94
95
96
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 94

def resources
  @resources
end

#restart_policyObject

Restart policy for all containers within the pod. One of Always, OnFailure, Never. In some contexts, only a subset of those values may be permitted. Default to Always. More info: kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy



97
98
99
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 97

def restart_policy
  @restart_policy
end

#runtime_class_nameObject

RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: git.k8s.io/enhancements/keps/sig-node/585-runtime-class



100
101
102
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 100

def runtime_class_name
  @runtime_class_name
end

#scheduler_nameObject

If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.



103
104
105
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 103

def scheduler_name
  @scheduler_name
end

#scheduling_gatesObject

SchedulingGates is an opaque list of values that if specified will block scheduling the pod. If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the scheduler will not attempt to schedule the pod. SchedulingGates can only be set at pod creation time, and be removed only afterwards.



106
107
108
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 106

def scheduling_gates
  @scheduling_gates
end

#security_contextObject

Returns the value of attribute security_context.



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

def security_context
  @security_context
end

#service_accountObject

DeprecatedServiceAccount is a deprecated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.



111
112
113
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 111

def 
  @service_account
end

#service_account_nameObject

ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/



114
115
116
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 114

def 
  @service_account_name
end

#set_hostname_as_fqdnObject

If true the pod’s hostname will be configured as the pod’s FQDN, rather than the leaf name (the default). In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters to FQDN. If a pod does not have FQDN, this has no effect. Default to false.



117
118
119
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 117

def set_hostname_as_fqdn
  @set_hostname_as_fqdn
end

#share_process_namespaceObject

Share a single process namespace between all of the containers in a pod. When this is set containers will be able to view and signal processes from other containers in the same pod, and the first process in each container will not be assigned PID 1. HostPID and ShareProcessNamespace cannot both be set. Optional: Default to false.



120
121
122
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 120

def share_process_namespace
  @share_process_namespace
end

#subdomainObject

If specified, the fully qualified Pod hostname will be "<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>". If not specified, the pod will not have a domainname at all.



123
124
125
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 123

def subdomain
  @subdomain
end

#termination_grace_period_secondsObject

Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.



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

def termination_grace_period_seconds
  @termination_grace_period_seconds
end

#tolerationsObject

If specified, the pod’s tolerations.



129
130
131
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 129

def tolerations
  @tolerations
end

#topology_spread_constraintsObject

TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed.



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

def topology_spread_constraints
  @topology_spread_constraints
end

#volumesObject

List of volumes that can be mounted by containers belonging to the pod. More info: kubernetes.io/docs/concepts/storage/volumes



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

def volumes
  @volumes
end

#workload_refObject

Returns the value of attribute workload_ref.



137
138
139
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 137

def workload_ref
  @workload_ref
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



188
189
190
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 188

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



140
141
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
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 140

def self.attribute_map
  {
    :'active_deadline_seconds' => :'activeDeadlineSeconds',
    :'affinity' => :'affinity',
    :'automount_service_account_token' => :'automountServiceAccountToken',
    :'containers' => :'containers',
    :'dns_config' => :'dnsConfig',
    :'dns_policy' => :'dnsPolicy',
    :'enable_service_links' => :'enableServiceLinks',
    :'ephemeral_containers' => :'ephemeralContainers',
    :'host_aliases' => :'hostAliases',
    :'host_ipc' => :'hostIPC',
    :'host_network' => :'hostNetwork',
    :'host_pid' => :'hostPID',
    :'host_users' => :'hostUsers',
    :'hostname' => :'hostname',
    :'hostname_override' => :'hostnameOverride',
    :'image_pull_secrets' => :'imagePullSecrets',
    :'init_containers' => :'initContainers',
    :'node_name' => :'nodeName',
    :'node_selector' => :'nodeSelector',
    :'os' => :'os',
    :'overhead' => :'overhead',
    :'preemption_policy' => :'preemptionPolicy',
    :'priority' => :'priority',
    :'priority_class_name' => :'priorityClassName',
    :'readiness_gates' => :'readinessGates',
    :'resource_claims' => :'resourceClaims',
    :'resources' => :'resources',
    :'restart_policy' => :'restartPolicy',
    :'runtime_class_name' => :'runtimeClassName',
    :'scheduler_name' => :'schedulerName',
    :'scheduling_gates' => :'schedulingGates',
    :'security_context' => :'securityContext',
    :'service_account' => :'serviceAccount',
    :'service_account_name' => :'serviceAccountName',
    :'set_hostname_as_fqdn' => :'setHostnameAsFQDN',
    :'share_process_namespace' => :'shareProcessNamespace',
    :'subdomain' => :'subdomain',
    :'termination_grace_period_seconds' => :'terminationGracePeriodSeconds',
    :'tolerations' => :'tolerations',
    :'topology_spread_constraints' => :'topologySpreadConstraints',
    :'volumes' => :'volumes',
    :'workload_ref' => :'workloadRef'
  }
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



538
539
540
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 538

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

.openapi_nullableObject

List of attributes with nullable: true



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

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

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 193

def self.openapi_types
  {
    :'active_deadline_seconds' => :'Integer',
    :'affinity' => :'V1Affinity',
    :'automount_service_account_token' => :'Boolean',
    :'containers' => :'Array<V1Container>',
    :'dns_config' => :'V1PodDNSConfig',
    :'dns_policy' => :'String',
    :'enable_service_links' => :'Boolean',
    :'ephemeral_containers' => :'Array<V1EphemeralContainer>',
    :'host_aliases' => :'Array<V1HostAlias>',
    :'host_ipc' => :'Boolean',
    :'host_network' => :'Boolean',
    :'host_pid' => :'Boolean',
    :'host_users' => :'Boolean',
    :'hostname' => :'String',
    :'hostname_override' => :'String',
    :'image_pull_secrets' => :'Array<V1LocalObjectReference>',
    :'init_containers' => :'Array<V1Container>',
    :'node_name' => :'String',
    :'node_selector' => :'Hash<String, String>',
    :'os' => :'V1PodOS',
    :'overhead' => :'Hash<String, String>',
    :'preemption_policy' => :'String',
    :'priority' => :'Integer',
    :'priority_class_name' => :'String',
    :'readiness_gates' => :'Array<V1PodReadinessGate>',
    :'resource_claims' => :'Array<V1PodResourceClaim>',
    :'resources' => :'V1ResourceRequirements',
    :'restart_policy' => :'String',
    :'runtime_class_name' => :'String',
    :'scheduler_name' => :'String',
    :'scheduling_gates' => :'Array<V1PodSchedulingGate>',
    :'security_context' => :'V1PodSecurityContext',
    :'service_account' => :'String',
    :'service_account_name' => :'String',
    :'set_hostname_as_fqdn' => :'Boolean',
    :'share_process_namespace' => :'Boolean',
    :'subdomain' => :'String',
    :'termination_grace_period_seconds' => :'Integer',
    :'tolerations' => :'Array<V1Toleration>',
    :'topology_spread_constraints' => :'Array<V1TopologySpreadConstraint>',
    :'volumes' => :'Array<V1Volume>',
    :'workload_ref' => :'V1WorkloadReference'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 476

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      active_deadline_seconds == o.active_deadline_seconds &&
      affinity == o.affinity &&
       == o. &&
      containers == o.containers &&
      dns_config == o.dns_config &&
      dns_policy == o.dns_policy &&
      enable_service_links == o.enable_service_links &&
      ephemeral_containers == o.ephemeral_containers &&
      host_aliases == o.host_aliases &&
      host_ipc == o.host_ipc &&
      host_network == o.host_network &&
      host_pid == o.host_pid &&
      host_users == o.host_users &&
      hostname == o.hostname &&
      hostname_override == o.hostname_override &&
      image_pull_secrets == o.image_pull_secrets &&
      init_containers == o.init_containers &&
      node_name == o.node_name &&
      node_selector == o.node_selector &&
      os == o.os &&
      overhead == o.overhead &&
      preemption_policy == o.preemption_policy &&
      priority == o.priority &&
      priority_class_name == o.priority_class_name &&
      readiness_gates == o.readiness_gates &&
      resource_claims == o.resource_claims &&
      resources == o.resources &&
      restart_policy == o.restart_policy &&
      runtime_class_name == o.runtime_class_name &&
      scheduler_name == o.scheduler_name &&
      scheduling_gates == o.scheduling_gates &&
      security_context == o.security_context &&
       == o. &&
       == o. &&
      set_hostname_as_fqdn == o.set_hostname_as_fqdn &&
      share_process_namespace == o.share_process_namespace &&
      subdomain == o.subdomain &&
      termination_grace_period_seconds == o.termination_grace_period_seconds &&
      tolerations == o.tolerations &&
      topology_spread_constraints == o.topology_spread_constraints &&
      volumes == o.volumes &&
      workload_ref == o.workload_ref
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



568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 568

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



639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 639

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



545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 545

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


525
526
527
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 525

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



531
532
533
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 531

def hash
  [active_deadline_seconds, affinity, , containers, dns_config, dns_policy, enable_service_links, ephemeral_containers, host_aliases, host_ipc, host_network, host_pid, host_users, hostname, hostname_override, image_pull_secrets, init_containers, node_name, node_selector, os, overhead, preemption_policy, priority, priority_class_name, readiness_gates, resource_claims, resources, restart_policy, runtime_class_name, scheduler_name, scheduling_gates, security_context, , , set_hostname_as_fqdn, share_process_namespace, subdomain, termination_grace_period_seconds, tolerations, topology_spread_constraints, volumes, workload_ref].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



458
459
460
461
462
463
464
465
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 458

def list_invalid_properties
  invalid_properties = Array.new
  if @containers.nil?
    invalid_properties.push('invalid value for "containers", containers cannot be nil.')
  end

  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



615
616
617
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 615

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



621
622
623
624
625
626
627
628
629
630
631
632
633
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 621

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



609
610
611
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 609

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



469
470
471
472
# File 'lib/kubernetes/models/v1_pod_spec.rb', line 469

def valid?
  return false if @containers.nil?
  true
end