Class: Kubevirt::V1VirtualMachineInstanceSpec
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Kubevirt::V1VirtualMachineInstanceSpec
- Defined in:
- lib/kubevirt/models/v1_virtual_machine_instance_spec.rb
Overview
VirtualMachineInstanceSpec is a description of a VirtualMachineInstance.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#access_credentials ⇒ Object
Specifies a set of public keys to inject into the vm guest.
-
#affinity ⇒ Object
Returns the value of attribute affinity.
-
#architecture ⇒ Object
Specifies the architecture of the vm guest you are attempting to run.
-
#dns_config ⇒ Object
Returns the value of attribute dns_config.
-
#dns_policy ⇒ Object
Set DNS policy for the pod.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#eviction_strategy ⇒ Object
EvictionStrategy describes the strategy to follow when a node drain occurs.
-
#hostname ⇒ Object
Specifies the hostname of the vmi If not specified, the hostname will be set to the name of the vmi, if dhcp or cloud-init is configured properly.
-
#liveness_probe ⇒ Object
Returns the value of attribute liveness_probe.
-
#networks ⇒ Object
List of networks that can be attached to a vm’s virtual interface.
-
#node_selector ⇒ Object
NodeSelector is a selector which must be true for the vmi to fit on a node.
-
#priority_class_name ⇒ Object
If specified, indicates the pod’s priority.
-
#readiness_probe ⇒ Object
Returns the value of attribute readiness_probe.
-
#resource_claims ⇒ Object
ResourceClaims define which ResourceClaims must be allocated and reserved before the VMI, hence virt-launcher pod is allowed to start.
-
#scheduler_name ⇒ Object
If specified, the VMI will be dispatched by specified scheduler.
-
#start_strategy ⇒ Object
StartStrategy can be set to "Paused" if Virtual Machine should be started in paused state.
-
#subdomain ⇒ Object
If specified, the fully qualified vmi hostname will be "<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>".
-
#termination_grace_period_seconds ⇒ Object
Grace period observed after signalling a VirtualMachineInstance to stop after which the VirtualMachineInstance is force terminated.
-
#tolerations ⇒ Object
If toleration is specified, obey all the toleration rules.
-
#topology_spread_constraints ⇒ Object
TopologySpreadConstraints describes how a group of VMIs will be spread across a given topology domains.
-
#volumes ⇒ Object
List of volumes that can be mounted by disks belonging to the vmi.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.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
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ V1VirtualMachineInstanceSpec
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ V1VirtualMachineInstanceSpec
Initializes the object
171 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 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 171 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Kubevirt::V1VirtualMachineInstanceSpec` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Kubevirt::V1VirtualMachineInstanceSpec`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'access_credentials') if (value = attributes[:'access_credentials']).is_a?(Array) self.access_credentials = value end end if attributes.key?(:'affinity') self.affinity = attributes[:'affinity'] end if attributes.key?(:'architecture') self.architecture = attributes[:'architecture'] 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?(:'domain') self.domain = attributes[:'domain'] else self.domain = nil end if attributes.key?(:'eviction_strategy') self.eviction_strategy = attributes[:'eviction_strategy'] end if attributes.key?(:'hostname') self.hostname = attributes[:'hostname'] end if attributes.key?(:'liveness_probe') self.liveness_probe = attributes[:'liveness_probe'] end if attributes.key?(:'networks') if (value = attributes[:'networks']).is_a?(Array) self.networks = value end end if attributes.key?(:'node_selector') if (value = attributes[:'node_selector']).is_a?(Hash) self.node_selector = value end end if attributes.key?(:'priority_class_name') self.priority_class_name = attributes[:'priority_class_name'] end if attributes.key?(:'readiness_probe') self.readiness_probe = attributes[:'readiness_probe'] end if attributes.key?(:'resource_claims') if (value = attributes[:'resource_claims']).is_a?(Array) self.resource_claims = value end end if attributes.key?(:'scheduler_name') self.scheduler_name = attributes[:'scheduler_name'] end if attributes.key?(:'start_strategy') self.start_strategy = attributes[:'start_strategy'] 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 end |
Instance Attribute Details
#access_credentials ⇒ Object
Specifies a set of public keys to inject into the vm guest
20 21 22 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 20 def access_credentials @access_credentials end |
#affinity ⇒ Object
Returns the value of attribute affinity.
22 23 24 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 22 def affinity @affinity end |
#architecture ⇒ Object
Specifies the architecture of the vm guest you are attempting to run. Defaults to the compiled architecture of the KubeVirt components
25 26 27 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 25 def architecture @architecture end |
#dns_config ⇒ Object
Returns the value of attribute dns_config.
27 28 29 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 27 def dns_config @dns_config end |
#dns_policy ⇒ Object
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’. Possible enum values: - ‘"ClusterFirst"` indicates that the pod should use cluster DNS first unless hostNetwork is true, if it is available, then fall back on the default (as determined by kubelet) DNS settings. - `"ClusterFirstWithHostNet"` indicates that the pod should use cluster DNS first, if it is available, then fall back on the default (as determined by kubelet) DNS settings. - `"Default"` indicates that the pod should use the default (as determined by kubelet) DNS settings. - `"None"` indicates that the pod should use empty DNS settings. DNS parameters such as nameservers and search paths should be defined via DNSConfig.
30 31 32 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 30 def dns_policy @dns_policy end |
#domain ⇒ Object
Returns the value of attribute domain.
32 33 34 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 32 def domain @domain end |
#eviction_strategy ⇒ Object
EvictionStrategy describes the strategy to follow when a node drain occurs. The possible options are: - "None": No action will be taken, according to the specified ‘RunStrategy’ the VirtualMachine will be restarted or shutdown. - "LiveMigrate": the VirtualMachineInstance will be migrated instead of being shutdown. - "LiveMigrateIfPossible": the same as "LiveMigrate" but only if the VirtualMachine is Live-Migratable, otherwise it will behave as "None". - "External": the VirtualMachineInstance will be protected and ‘vmi.Status.EvacuationNodeName` will be set on eviction. This is mainly useful for cluster-api-provider-kubevirt (capk) which needs a way for VMI’s to be blocked from eviction, yet signal capk that eviction has been called on the VMI so the capk controller can handle tearing the VMI down. Details can be found in the commit description github.com/kubevirt/kubevirt/commit/c1d77face705c8b126696bac9a3ee3825f27f1fa.
35 36 37 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 35 def eviction_strategy @eviction_strategy end |
#hostname ⇒ Object
Specifies the hostname of the vmi If not specified, the hostname will be set to the name of the vmi, if dhcp or cloud-init is configured properly.
38 39 40 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 38 def hostname @hostname end |
#liveness_probe ⇒ Object
Returns the value of attribute liveness_probe.
40 41 42 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 40 def liveness_probe @liveness_probe end |
#networks ⇒ Object
List of networks that can be attached to a vm’s virtual interface.
43 44 45 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 43 def networks @networks end |
#node_selector ⇒ Object
NodeSelector is a selector which must be true for the vmi to fit on a node. Selector which must match a node’s labels for the vmi to be scheduled on that node. More info: kubernetes.io/docs/concepts/configuration/assign-pod-node/
46 47 48 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 46 def node_selector @node_selector end |
#priority_class_name ⇒ Object
If specified, indicates the pod’s priority. If not specified, the pod priority will be default or zero if there is no default.
49 50 51 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 49 def priority_class_name @priority_class_name end |
#readiness_probe ⇒ Object
Returns the value of attribute readiness_probe.
51 52 53 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 51 def readiness_probe @readiness_probe end |
#resource_claims ⇒ Object
ResourceClaims define which ResourceClaims must be allocated and reserved before the VMI, hence virt-launcher pod is allowed to start. The resources will be made available to the domain which consumes them by name. This is an alpha field and requires enabling the DynamicResourceAllocation feature gate in kubernetes kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/ This field should only be configured if one of the feature-gates GPUsWithDRA or HostDevicesWithDRA is enabled. This feature is in alpha.
54 55 56 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 54 def resource_claims @resource_claims end |
#scheduler_name ⇒ Object
If specified, the VMI will be dispatched by specified scheduler. If not specified, the VMI will be dispatched by default scheduler.
57 58 59 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 57 def scheduler_name @scheduler_name end |
#start_strategy ⇒ Object
StartStrategy can be set to "Paused" if Virtual Machine should be started in paused state.
60 61 62 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 60 def start_strategy @start_strategy end |
#subdomain ⇒ Object
If specified, the fully qualified vmi hostname will be "<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>". If not specified, the vmi will not have a domainname at all. The DNS entry will resolve to the vmi, no matter if the vmi itself can pick up a hostname.
63 64 65 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 63 def subdomain @subdomain end |
#termination_grace_period_seconds ⇒ Object
Grace period observed after signalling a VirtualMachineInstance to stop after which the VirtualMachineInstance is force terminated.
66 67 68 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 66 def termination_grace_period_seconds @termination_grace_period_seconds end |
#tolerations ⇒ Object
If toleration is specified, obey all the toleration rules.
69 70 71 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 69 def tolerations @tolerations end |
#topology_spread_constraints ⇒ Object
TopologySpreadConstraints describes how a group of VMIs will be spread across a given topology domains. K8s scheduler will schedule VMI pods in a way which abides by the constraints.
72 73 74 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 72 def topology_spread_constraints @topology_spread_constraints end |
#volumes ⇒ Object
List of volumes that can be mounted by disks belonging to the vmi.
75 76 77 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 75 def volumes @volumes end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
127 128 129 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 127 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
132 133 134 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 132 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 100 def self.attribute_map { :'access_credentials' => :'accessCredentials', :'affinity' => :'affinity', :'architecture' => :'architecture', :'dns_config' => :'dnsConfig', :'dns_policy' => :'dnsPolicy', :'domain' => :'domain', :'eviction_strategy' => :'evictionStrategy', :'hostname' => :'hostname', :'liveness_probe' => :'livenessProbe', :'networks' => :'networks', :'node_selector' => :'nodeSelector', :'priority_class_name' => :'priorityClassName', :'readiness_probe' => :'readinessProbe', :'resource_claims' => :'resourceClaims', :'scheduler_name' => :'schedulerName', :'start_strategy' => :'startStrategy', :'subdomain' => :'subdomain', :'termination_grace_period_seconds' => :'terminationGracePeriodSeconds', :'tolerations' => :'tolerations', :'topology_spread_constraints' => :'topologySpreadConstraints', :'volumes' => :'volumes' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 371 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{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[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
164 165 166 167 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 164 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
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 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 137 def self.openapi_types { :'access_credentials' => :'Array<V1AccessCredential>', :'affinity' => :'K8sIoApiCoreV1Affinity', :'architecture' => :'String', :'dns_config' => :'K8sIoApiCoreV1PodDNSConfig', :'dns_policy' => :'String', :'domain' => :'V1DomainSpec', :'eviction_strategy' => :'String', :'hostname' => :'String', :'liveness_probe' => :'V1Probe', :'networks' => :'Array<V1Network>', :'node_selector' => :'Hash<String, String>', :'priority_class_name' => :'String', :'readiness_probe' => :'V1Probe', :'resource_claims' => :'Array<K8sIoApiCoreV1PodResourceClaim>', :'scheduler_name' => :'String', :'start_strategy' => :'String', :'subdomain' => :'String', :'termination_grace_period_seconds' => :'Integer', :'tolerations' => :'Array<K8sIoApiCoreV1Toleration>', :'topology_spread_constraints' => :'Array<K8sIoApiCoreV1TopologySpreadConstraint>', :'volumes' => :'Array<V1Volume>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
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 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 330 def ==(o) return true if self.equal?(o) self.class == o.class && access_credentials == o.access_credentials && affinity == o.affinity && architecture == o.architecture && dns_config == o.dns_config && dns_policy == o.dns_policy && domain == o.domain && eviction_strategy == o.eviction_strategy && hostname == o.hostname && liveness_probe == o.liveness_probe && networks == o.networks && node_selector == o.node_selector && priority_class_name == o.priority_class_name && readiness_probe == o.readiness_probe && resource_claims == o.resource_claims && scheduler_name == o.scheduler_name && start_strategy == o.start_strategy && 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 end |
#eql?(o) ⇒ Boolean
358 359 360 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 358 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
364 365 366 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 364 def hash [access_credentials, affinity, architecture, dns_config, dns_policy, domain, eviction_strategy, hostname, liveness_probe, networks, node_selector, priority_class_name, readiness_probe, resource_claims, scheduler_name, start_strategy, subdomain, termination_grace_period_seconds, tolerations, topology_spread_constraints, volumes].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
288 289 290 291 292 293 294 295 296 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 288 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @domain.nil? invalid_properties.push('invalid value for "domain", domain cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 393 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 |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
300 301 302 303 304 305 306 |
# File 'lib/kubevirt/models/v1_virtual_machine_instance_spec.rb', line 300 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' dns_policy_validator = EnumAttributeValidator.new('String', ["ClusterFirst", "ClusterFirstWithHostNet", "Default", "None"]) return false unless dns_policy_validator.valid?(@dns_policy) return false if @domain.nil? true end |