Class: Kubernetes::V1CSIDriverSpec

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

Overview

CSIDriverSpec is the specification of a CSIDriver.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ V1CSIDriverSpec

Initializes the object

Parameters:

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

    Model attributes in the form of hash



94
95
96
97
98
99
100
101
102
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 94

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#attach_requiredObject

attachRequired indicates this CSI volume driver requires an attach operation (because it implements the CSI ControllerPublishVolume() method), and that the Kubernetes attach detach controller should call the attach volume interface which checks the volumeattachment status and waits until the volume is attached before proceeding to mounting. The CSI external-attacher coordinates with CSI volume driver and updates the volumeattachment status when the attach operation is complete. If the value is specified to false, the attach operation will be skipped. Otherwise the attach operation will be called. This field is immutable.



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

def attach_required
  @attach_required
end

#fs_group_policyObject

fsGroupPolicy defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details. This field was immutable in Kubernetes < 1.29 and now is mutable. Defaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume’s access mode contains ReadWriteOnce.



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

def fs_group_policy
  @fs_group_policy
end

#node_allocatable_update_period_secondsObject

nodeAllocatableUpdatePeriodSeconds specifies the interval between periodic updates of the CSINode allocatable capacity for this driver. When set, both periodic updates and updates triggered by capacity-related failures are enabled. If not set, no updates occur (neither periodic nor upon detecting capacity-related failures), and the allocatable.count remains static. The minimum allowed value for this field is 10 seconds. This is a beta feature and requires the MutableCSINodeAllocatableCount feature gate to be enabled. This field is mutable.



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

def node_allocatable_update_period_seconds
  @node_allocatable_update_period_seconds
end

#pod_info_on_mountObject

podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations, if set to true. If set to false, pod information will not be passed on mount. Default is false. The CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext. The following VolumeContext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. "csi.storage.k8s.io/pod.name": pod.Name "csi.storage.k8s.io/pod.namespace": pod.Namespace "csi.storage.k8s.io/pod.uid": string(pod.UID) "csi.storage.k8s.io/ephemeral": "true" if the volume is an ephemeral inline volume defined by a CSIVolumeSource, otherwise "false" "csi.storage.k8s.io/ephemeral" is a new feature in Kubernetes 1.16. It is only required for drivers which support both the "Persistent" and "Ephemeral" VolumeLifecycleMode. Other drivers can leave pod info disabled and/or ignore this field. As Kubernetes 1.15 doesn’t support this field, drivers can only support one mode when deployed on such a cluster and the deployment determines which mode that is, for example via a command line parameter of the driver. This field was immutable in Kubernetes < 1.29 and now is mutable.



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

def pod_info_on_mount
  @pod_info_on_mount
end

#requires_republishObject

requiresRepublish indicates the CSI driver wants ‘NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false. Note: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.



32
33
34
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 32

def requires_republish
  @requires_republish
end

#se_linux_mountObject

seLinuxMount specifies if the CSI driver supports "-o context" mount option. When "true", the CSI driver must ensure that all volumes provided by this CSI driver can be mounted separately with different ‘-o context` options. This is typical for storage backends that provide volumes as filesystems on block devices or as independent shared volumes. Kubernetes will call NodeStage / NodePublish with "-o context=xyz" mount option when mounting a ReadWriteOncePod volume used in Pod that has explicitly set SELinux context. In the future, it may be expanded to other volume AccessModes. In any case, Kubernetes will ensure that the volume is mounted only with a single SELinux context. When "false", Kubernetes won’t pass any special SELinux mount options to the driver. This is typical for volumes that represent subdirectories of a bigger shared filesystem. Default is "false".



35
36
37
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 35

def se_linux_mount
  @se_linux_mount
end

#service_account_token_in_secretsObject

serviceAccountTokenInSecrets is an opt-in for CSI drivers to indicate that service account tokens should be passed via the Secrets field in NodePublishVolumeRequest instead of the VolumeContext field. The CSI specification provides a dedicated Secrets field for sensitive information like tokens, which is the appropriate mechanism for handling credentials. This addresses security concerns where sensitive tokens were being logged as part of volume context. When "true", kubelet will pass the tokens only in the Secrets field with the key "csi.storage.k8s.io/serviceAccount.tokens". The CSI driver must be updated to read tokens from the Secrets field instead of VolumeContext. When "false" or not set, kubelet will pass the tokens in VolumeContext with the key "csi.storage.k8s.io/serviceAccount.tokens" (existing behavior). This maintains backward compatibility with existing CSI drivers. This field can only be set when TokenRequests is configured. The API server will reject CSIDriver specs that set this field without TokenRequests. Default behavior if unset is to pass tokens in the VolumeContext field.



38
39
40
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 38

def 
  @service_account_token_in_secrets
end

#storage_capacityObject

storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information, if set to true. The check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object. Alternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published. This field was immutable in Kubernetes <= 1.22 and now is mutable.



41
42
43
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 41

def storage_capacity
  @storage_capacity
end

#token_requestsObject

tokenRequests indicates the CSI driver needs pods’ service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: "csi.storage.k8s.io/serviceAccount.tokens": { "<audience>": { "token": <token>, "expirationTimestamp": <expiration timestamp in RFC3339>, }, … } Note: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.



44
45
46
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 44

def token_requests
  @token_requests
end

#volume_lifecycle_modesObject

volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is "Persistent", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism. The other mode is "Ephemeral". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume. For more information about implementing this mode, see kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future. This field is beta. This field is immutable.



47
48
49
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 47

def volume_lifecycle_modes
  @volume_lifecycle_modes
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 50

def self.attribute_map
  {
    :'attach_required' => :'attachRequired',
    :'fs_group_policy' => :'fsGroupPolicy',
    :'node_allocatable_update_period_seconds' => :'nodeAllocatableUpdatePeriodSeconds',
    :'pod_info_on_mount' => :'podInfoOnMount',
    :'requires_republish' => :'requiresRepublish',
    :'se_linux_mount' => :'seLinuxMount',
    :'service_account_token_in_secrets' => :'serviceAccountTokenInSecrets',
    :'storage_capacity' => :'storageCapacity',
    :'token_requests' => :'tokenRequests',
    :'volume_lifecycle_modes' => :'volumeLifecycleModes'
  }
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



197
198
199
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 197

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

.openapi_nullableObject

List of attributes with nullable: true



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

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

.openapi_typesObject

Attribute type mapping.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 71

def self.openapi_types
  {
    :'attach_required' => :'Boolean',
    :'fs_group_policy' => :'String',
    :'node_allocatable_update_period_seconds' => :'Integer',
    :'pod_info_on_mount' => :'Boolean',
    :'requires_republish' => :'Boolean',
    :'se_linux_mount' => :'Boolean',
    :'service_account_token_in_secrets' => :'Boolean',
    :'storage_capacity' => :'Boolean',
    :'token_requests' => :'Array<StorageV1TokenRequest>',
    :'volume_lifecycle_modes' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 167

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      attach_required == o.attach_required &&
      fs_group_policy == o.fs_group_policy &&
      node_allocatable_update_period_seconds == o.node_allocatable_update_period_seconds &&
      pod_info_on_mount == o.pod_info_on_mount &&
      requires_republish == o.requires_republish &&
      se_linux_mount == o.se_linux_mount &&
       == o. &&
      storage_capacity == o.storage_capacity &&
      token_requests == o.token_requests &&
      volume_lifecycle_modes == o.volume_lifecycle_modes
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



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

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



298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 298

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



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 204

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


184
185
186
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 184

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



190
191
192
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 190

def hash
  [attach_required, fs_group_policy, node_allocatable_update_period_seconds, pod_info_on_mount, requires_republish, se_linux_mount, , storage_capacity, token_requests, volume_lifecycle_modes].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



154
155
156
157
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 154

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



274
275
276
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 274

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



280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 280

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



268
269
270
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 268

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



161
162
163
# File 'lib/kubernetes/models/v1_csi_driver_spec.rb', line 161

def valid?
  true
end