Class: Kubernetes::V1Volume

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

Overview

Volume represents a named volume in a pod that may be accessed by any container in the pod.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ V1Volume

Initializes the object



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

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

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

  if attributes.key?(:awsElasticBlockStore)
    self.aws_elastic_block_store = attributes[:awsElasticBlockStore]
  end

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:gcePersistentDisk)
    self.gce_persistent_disk = attributes[:gcePersistentDisk]
  end

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

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

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

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

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

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

  if attributes.key?(:persistentVolumeClaim)
    self.persistent_volume_claim = attributes[:persistentVolumeClaim]
  end

  if attributes.key?(:photonPersistentDisk)
    self.photon_persistent_disk = attributes[:photonPersistentDisk]
  end

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

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

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

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

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

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

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

  return unless attributes.key?(:vsphereVolume)

  self.vsphere_volume = attributes[:vsphereVolume]
end

Instance Attribute Details

#aws_elastic_block_storeObject

AWSElasticBlockStore represents an AWS Disk resource that is attached to a kubelet’s host machine and then exposed to the pod. More info: kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore



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

def aws_elastic_block_store
  @aws_elastic_block_store
end

#azure_diskObject

AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.



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

def azure_disk
  @azure_disk
end

#azure_fileObject

AzureFile represents an Azure File Service mount on the host and bind mount to the pod.



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

def azure_file
  @azure_file
end

#cephfsObject

CephFS represents a Ceph FS mount on the host that shares a pod’s lifetime



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

def cephfs
  @cephfs
end

#cinderObject

Cinder represents a cinder volume attached and mounted on kubelets host machine More info: releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md



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

def cinder
  @cinder
end

#config_mapObject

ConfigMap represents a configMap that should populate this volume



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

def config_map
  @config_map
end

#downward_apiObject

DownwardAPI represents downward API about the pod that should populate this volume



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

def downward_api
  @downward_api
end

#empty_dirObject

EmptyDir represents a temporary directory that shares a pod’s lifetime. More info: kubernetes.io/docs/concepts/storage/volumes#emptydir



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

def empty_dir
  @empty_dir
end

#fcObject

FC represents a Fibre Channel resource that is attached to a kubelet’s host machine and then exposed to the pod.



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

def fc
  @fc
end

#flex_volumeObject

FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.



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

def flex_volume
  @flex_volume
end

#flockerObject

Flocker represents a Flocker volume attached to a kubelet’s host machine. This depends on the Flocker control service being running



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

def flocker
  @flocker
end

#gce_persistent_diskObject

GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet’s host machine and then exposed to the pod. More info: kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk



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

def gce_persistent_disk
  @gce_persistent_disk
end

#git_repoObject

GitRepo represents a git repository at a particular revision. DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod’s container.



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

def git_repo
  @git_repo
end

#glusterfsObject

Glusterfs represents a Glusterfs mount on the host that shares a pod’s lifetime. More info: releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md



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

def glusterfs
  @glusterfs
end

#host_pathObject

HostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: kubernetes.io/docs/concepts/storage/volumes#hostpath



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

def host_path
  @host_path
end

#iscsiObject

ISCSI represents an ISCSI Disk resource that is attached to a kubelet’s host machine and then exposed to the pod. More info: releases.k8s.io/HEAD/examples/volumes/iscsi/README.md



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

def iscsi
  @iscsi
end

#nameObject

Volume’s name. Must be a DNS_LABEL and unique within the pod. More info: kubernetes.io/docs/concepts/overview/working-with-objects/names/#names



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

def name
  @name
end

#nfsObject

NFS represents an NFS mount on the host that shares a pod’s lifetime More info: kubernetes.io/docs/concepts/storage/volumes#nfs



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

def nfs
  @nfs
end

#persistent_volume_claimObject

PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims



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

def persistent_volume_claim
  @persistent_volume_claim
end

#photon_persistent_diskObject

PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine



76
77
78
# File 'lib/kubernetes/models/v1_volume.rb', line 76

def photon_persistent_disk
  @photon_persistent_disk
end

#portworx_volumeObject

PortworxVolume represents a portworx volume attached and mounted on kubelets host machine



79
80
81
# File 'lib/kubernetes/models/v1_volume.rb', line 79

def portworx_volume
  @portworx_volume
end

#projectedObject

Items for all in one resources secrets, configmaps, and downward API



82
83
84
# File 'lib/kubernetes/models/v1_volume.rb', line 82

def projected
  @projected
end

#quobyteObject

Quobyte represents a Quobyte mount on the host that shares a pod’s lifetime



85
86
87
# File 'lib/kubernetes/models/v1_volume.rb', line 85

def quobyte
  @quobyte
end

#rbdObject

RBD represents a Rados Block Device mount on the host that shares a pod’s lifetime. More info: releases.k8s.io/HEAD/examples/volumes/rbd/README.md



88
89
90
# File 'lib/kubernetes/models/v1_volume.rb', line 88

def rbd
  @rbd
end

#scale_ioObject

ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.



91
92
93
# File 'lib/kubernetes/models/v1_volume.rb', line 91

def scale_io
  @scale_io
end

#secretObject

Secret represents a secret that should populate this volume. More info: kubernetes.io/docs/concepts/storage/volumes#secret



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

def secret
  @secret
end

#storageosObject

StorageOS represents a StorageOS volume attached and mounted on Kubernetes nodes.



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

def storageos
  @storageos
end

#vsphere_volumeObject

VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine



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

def vsphere_volume
  @vsphere_volume
end

Class Method Details

.attribute_mapObject

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



103
104
105
106
107
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
# File 'lib/kubernetes/models/v1_volume.rb', line 103

def self.attribute_map
  {
    aws_elastic_block_store: :awsElasticBlockStore,
    azure_disk: :azureDisk,
    azure_file: :azureFile,
    cephfs: :cephfs,
    cinder: :cinder,
    config_map: :configMap,
    downward_api: :downwardAPI,
    empty_dir: :emptyDir,
    fc: :fc,
    flex_volume: :flexVolume,
    flocker: :flocker,
    gce_persistent_disk: :gcePersistentDisk,
    git_repo: :gitRepo,
    glusterfs: :glusterfs,
    host_path: :hostPath,
    iscsi: :iscsi,
    name: :name,
    nfs: :nfs,
    persistent_volume_claim: :persistentVolumeClaim,
    photon_persistent_disk: :photonPersistentDisk,
    portworx_volume: :portworxVolume,
    projected: :projected,
    quobyte: :quobyte,
    rbd: :rbd,
    scale_io: :scaleIO,
    secret: :secret,
    storageos: :storageos,
    vsphere_volume: :vsphereVolume
  }
end

.swagger_typesObject

Attribute type mapping.



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
162
163
164
165
166
167
168
# File 'lib/kubernetes/models/v1_volume.rb', line 137

def self.swagger_types
  {
    aws_elastic_block_store: :V1AWSElasticBlockStoreVolumeSource,
    azure_disk: :V1AzureDiskVolumeSource,
    azure_file: :V1AzureFileVolumeSource,
    cephfs: :V1CephFSVolumeSource,
    cinder: :V1CinderVolumeSource,
    config_map: :V1ConfigMapVolumeSource,
    downward_api: :V1DownwardAPIVolumeSource,
    empty_dir: :V1EmptyDirVolumeSource,
    fc: :V1FCVolumeSource,
    flex_volume: :V1FlexVolumeSource,
    flocker: :V1FlockerVolumeSource,
    gce_persistent_disk: :V1GCEPersistentDiskVolumeSource,
    git_repo: :V1GitRepoVolumeSource,
    glusterfs: :V1GlusterfsVolumeSource,
    host_path: :V1HostPathVolumeSource,
    iscsi: :V1ISCSIVolumeSource,
    name: :String,
    nfs: :V1NFSVolumeSource,
    persistent_volume_claim: :V1PersistentVolumeClaimVolumeSource,
    photon_persistent_disk: :V1PhotonPersistentDiskVolumeSource,
    portworx_volume: :V1PortworxVolumeSource,
    projected: :V1ProjectedVolumeSource,
    quobyte: :V1QuobyteVolumeSource,
    rbd: :V1RBDVolumeSource,
    scale_io: :V1ScaleIOVolumeSource,
    secret: :V1SecretVolumeSource,
    storageos: :V1StorageOSVolumeSource,
    vsphere_volume: :V1VsphereVirtualDiskVolumeSource
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.



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

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

  self.class == other.class &&
    aws_elastic_block_store == other.aws_elastic_block_store &&
    azure_disk == other.azure_disk &&
    azure_file == other.azure_file &&
    cephfs == other.cephfs &&
    cinder == other.cinder &&
    config_map == other.config_map &&
    downward_api == other.downward_api &&
    empty_dir == other.empty_dir &&
    fc == other.fc &&
    flex_volume == other.flex_volume &&
    flocker == other.flocker &&
    gce_persistent_disk == other.gce_persistent_disk &&
    git_repo == other.git_repo &&
    glusterfs == other.glusterfs &&
    host_path == other.host_path &&
    iscsi == other.iscsi &&
    name == other.name &&
    nfs == other.nfs &&
    persistent_volume_claim == other.persistent_volume_claim &&
    photon_persistent_disk == other.photon_persistent_disk &&
    portworx_volume == other.portworx_volume &&
    projected == other.projected &&
    quobyte == other.quobyte &&
    rbd == other.rbd &&
    scale_io == other.scale_io &&
    secret == other.secret &&
    storageos == other.storageos &&
    vsphere_volume == other.vsphere_volume
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type



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_volume.rb', line 338

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

#_to_hash(value) ⇒ Hash

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



405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/kubernetes/models/v1_volume.rb', line 405

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



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

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

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

  self
end

#eql?(other) ⇒ Boolean

See Also:

  • `==` method


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

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.



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

def hash
  [aws_elastic_block_store, azure_disk, azure_file, cephfs, cinder, config_map, downward_api,
   empty_dir, fc, flex_volume, flocker, gce_persistent_disk, git_repo, glusterfs, host_path, iscsi, name, nfs, persistent_volume_claim, photon_persistent_disk, portworx_volume, projected, quobyte, rbd, scale_io, secret, storageos, vsphere_volume].hash
end

#list_invalid_propertiesObject

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



247
248
249
250
251
252
# File 'lib/kubernetes/models/v1_volume.rb', line 247

def list_invalid_properties
  invalid_properties = []
  invalid_properties.push("invalid value for 'name', name cannot be nil.") if @name.nil?

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)



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

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash



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

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

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

#to_sString

Returns the string representation of the object



378
379
380
# File 'lib/kubernetes/models/v1_volume.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



256
257
258
259
260
# File 'lib/kubernetes/models/v1_volume.rb', line 256

def valid?
  return false if @name.nil?

  true
end