Class: Zilla::IoK8sApiStorageV1CSIDriverSpec
- Inherits:
-
Object
- Object
- Zilla::IoK8sApiStorageV1CSIDriverSpec
- Defined in:
- lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb
Overview
CSIDriverSpec is the specification of a CSIDriver.
Instance Attribute Summary collapse
-
#attach_required ⇒ Object
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.
-
#fs_group_policy ⇒ Object
Defines if the underlying volume supports changing ownership and permission of the volume before being mounted.
-
#pod_info_on_mount ⇒ Object
If set to true, podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations.
-
#requires_republish ⇒ Object
RequiresRepublish indicates the CSI driver wants ‘NodePublishVolume` being periodically called to reflect any possible change in the mounted volume.
-
#se_linux_mount ⇒ Object
SELinuxMount specifies if the CSI driver supports "-o context" mount option.
-
#storage_capacity ⇒ Object
If set to true, 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.
-
#token_requests ⇒ Object
TokenRequests indicates the CSI driver needs pods’ service account tokens it is mounting volume for to do necessary authentication.
-
#volume_lifecycle_modes ⇒ Object
volumeLifecycleModes defines what kind of volumes this CSI volume driver supports.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ IoK8sApiStorageV1CSIDriverSpec
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ IoK8sApiStorageV1CSIDriverSpec
Initializes the object
83 84 85 86 87 88 89 90 91 92 93 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 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 83 def initialize(attributes = {}) unless attributes.is_a?(Hash) raise ArgumentError, 'The input argument (attributes) must be a hash in `Zilla::IoK8sApiStorageV1CSIDriverSpec` 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::IoK8sApiStorageV1CSIDriverSpec`. 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 self.attach_required = attributes[:attach_required] if attributes.key?(:attach_required) self.fs_group_policy = attributes[:fs_group_policy] if attributes.key?(:fs_group_policy) self.pod_info_on_mount = attributes[:pod_info_on_mount] if attributes.key?(:pod_info_on_mount) self.requires_republish = attributes[:requires_republish] if attributes.key?(:requires_republish) self.se_linux_mount = attributes[:se_linux_mount] if attributes.key?(:se_linux_mount) self.storage_capacity = attributes[:storage_capacity] if attributes.key?(:storage_capacity) if attributes.key?(:token_requests) && (value = attributes[:token_requests]).is_a?(Array) self.token_requests = value end return unless attributes.key?(:volume_lifecycle_modes) return unless (value = attributes[:volume_lifecycle_modes]).is_a?(Array) self.volume_lifecycle_modes = value end |
Instance Attribute Details
#attach_required ⇒ Object
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 CSIDriverRegistry feature gate is enabled and 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/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 20 def attach_required @attach_required end |
#fs_group_policy ⇒ Object
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 is immutable. 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/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 23 def fs_group_policy @fs_group_policy end |
#pod_info_on_mount ⇒ Object
If set to true, podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations. 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 VolumeConext 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 is immutable.
26 27 28 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 26 def pod_info_on_mount @pod_info_on_mount end |
#requires_republish ⇒ Object
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.
29 30 31 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 29 def requires_republish @requires_republish end |
#se_linux_mount ⇒ Object
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".
32 33 34 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 32 def se_linux_mount @se_linux_mount end |
#storage_capacity ⇒ Object
If set to true, 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. 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.
35 36 37 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 35 def storage_capacity @storage_capacity end |
#token_requests ⇒ Object
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.
38 39 40 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 38 def token_requests @token_requests end |
#volume_lifecycle_modes ⇒ Object
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.
41 42 43 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 41 def volume_lifecycle_modes @volume_lifecycle_modes end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
58 59 60 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 58 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 44 def self.attribute_map { attach_required: :attachRequired, fs_group_policy: :fsGroupPolicy, pod_info_on_mount: :podInfoOnMount, requires_republish: :requiresRepublish, se_linux_mount: :seLinuxMount, storage_capacity: :storageCapacity, token_requests: :tokenRequests, volume_lifecycle_modes: :volumeLifecycleModes } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
165 166 167 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 165 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
77 78 79 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 77 def self.openapi_nullable Set.new([]) end |
.openapi_types ⇒ Object
Attribute type mapping.
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 63 def self.openapi_types { attach_required: :Boolean, fs_group_policy: :String, pod_info_on_mount: :Boolean, requires_republish: :Boolean, se_linux_mount: :Boolean, storage_capacity: :Boolean, token_requests: :'Array<IoK8sApiStorageV1TokenRequest>', volume_lifecycle_modes: :'Array<String>' } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 135 def ==(other) return true if equal?(other) self.class == other.class && attach_required == other.attach_required && fs_group_policy == other.fs_group_policy && pod_info_on_mount == other.pod_info_on_mount && requires_republish == other.requires_republish && se_linux_mount == other.se_linux_mount && storage_capacity == other.storage_capacity && token_requests == other.token_requests && volume_lifecycle_modes == other.volume_lifecycle_modes end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
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 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 199 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
270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 270 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
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 172 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
151 152 153 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 151 def eql?(other) self == other end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
157 158 159 160 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 157 def hash [attach_required, fs_group_policy, pod_info_on_mount, requires_republish, se_linux_mount, storage_capacity, token_requests, volume_lifecycle_modes].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
123 124 125 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 123 def list_invalid_properties [] end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
246 247 248 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 246 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 252 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_s ⇒ String
Returns the string representation of the object
240 241 242 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 240 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
129 130 131 |
# File 'lib/zilla/models/io_k8s_api_storage_v1_csi_driver_spec.rb', line 129 def valid? true end |