[virtual-machine] Disable instanceType validation

Workaround for #1299. If a Cozystack installation provides custom
instance types for virtual machines, the static validation rules prevent
such instance types from being used, as they are included in the OpenAPI
schema of the Cozystack API server and then once more applied in the
dependent HelmRelease, offering users no easy way to remedy this in
runtime.

[virtual-machine] Disable instanceType validation to enable using custom
instance types.

Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
This commit is contained in:
Timofei Larkin
2025-08-04 14:12:37 +03:00
parent 8ddbe32ea1
commit 44fabd4abc
7 changed files with 12 additions and 112 deletions

View File

@@ -174,7 +174,8 @@ virtual-machine 0.10.2 632224a3
virtual-machine 0.11.0 4369b031
virtual-machine 0.12.0 acd4663a
virtual-machine 0.12.1 909208ba
virtual-machine 0.12.2 HEAD
virtual-machine 0.12.2 8ddbe32e
virtual-machine 0.12.3 HEAD
vm-disk 0.1.0 d971f2ff
vm-disk 0.1.1 6130f43d
vm-disk 0.1.2 632224a3
@@ -193,7 +194,8 @@ vm-instance 0.7.2 632224a3
vm-instance 0.8.0 4369b031
vm-instance 0.9.0 acd4663a
vm-instance 0.10.0 909208ba
vm-instance 0.10.1 HEAD
vm-instance 0.10.1 8ddbe32e
vm-instance 0.10.2 HEAD
vpn 0.1.0 263e47be
vpn 0.2.0 53f2365e
vpn 0.3.0 6c5cf5bf

View File

@@ -17,7 +17,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.12.2
version: 0.12.3
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to

View File

@@ -3,8 +3,8 @@ include ../../../scripts/package.mk
generate:
readme-generator-for-helm -v values.yaml -s values.schema.json -r README.md
yq -o json -i '.properties.gpus.items.type = "object" | .properties.gpus.default = []' values.schema.json
INSTANCE_TYPES=$$(yq e '.metadata.name' -o=json -r ../../system/kubevirt-instancetypes/templates/instancetypes.yaml | yq 'split(" ") | . + [""]' -o json) \
&& yq -i -o json ".properties.instanceType.enum = $${INSTANCE_TYPES}" values.schema.json
# INSTANCE_TYPES=$$(yq e '.metadata.name' -o=json -r ../../system/kubevirt-instancetypes/templates/instancetypes.yaml | yq 'split(" ") | . + [""]' -o json) \
# && yq -i -o json ".properties.instanceType.enum = $${INSTANCE_TYPES}" values.schema.json
PREFERENCES=$$(yq e '.metadata.name' -o=json -r ../../system/kubevirt-instancetypes/templates/preferences.yaml | yq 'split(" ") | . + [""]' -o json) \
&& yq -i -o json ".properties.instanceProfile.enum = $${PREFERENCES}" values.schema.json
yq -i -o json '.properties.externalPorts.items.type = "integer"' values.schema.json

View File

@@ -93,58 +93,7 @@
"instanceType": {
"default": "u1.medium",
"description": "Virtual Machine instance type",
"type": "string",
"enum": [
"cx1.2xlarge",
"cx1.4xlarge",
"cx1.8xlarge",
"cx1.large",
"cx1.medium",
"cx1.xlarge",
"gn1.2xlarge",
"gn1.4xlarge",
"gn1.8xlarge",
"gn1.xlarge",
"m1.2xlarge",
"m1.4xlarge",
"m1.8xlarge",
"m1.large",
"m1.xlarge",
"n1.2xlarge",
"n1.4xlarge",
"n1.8xlarge",
"n1.large",
"n1.medium",
"n1.xlarge",
"o1.2xlarge",
"o1.4xlarge",
"o1.8xlarge",
"o1.large",
"o1.medium",
"o1.micro",
"o1.nano",
"o1.small",
"o1.xlarge",
"rt1.2xlarge",
"rt1.4xlarge",
"rt1.8xlarge",
"rt1.large",
"rt1.medium",
"rt1.micro",
"rt1.small",
"rt1.xlarge",
"u1.2xlarge",
"u1.2xmedium",
"u1.4xlarge",
"u1.8xlarge",
"u1.large",
"u1.medium",
"u1.micro",
"u1.nano",
"u1.small",
"u1.xlarge",
""
]
"type": "string"
},
"resources": {
"properties": {

View File

@@ -17,7 +17,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.10.1
version: 0.10.2
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to

View File

@@ -4,8 +4,8 @@ generate:
readme-generator-for-helm -v values.yaml -s values.schema.json -r README.md
yq -o json -i '.properties.disks.items.type = "object" | .properties.disks.default = []' values.schema.json
yq -o json -i '.properties.gpus.items.type = "object" | .properties.gpus.default = []' values.schema.json
INSTANCE_TYPES=$$(yq e '.metadata.name' -o=json -r ../../system/kubevirt-instancetypes/templates/instancetypes.yaml | yq 'split(" ") | . + [""]' -o json) \
&& yq -i -o json ".properties.instanceType.enum = $${INSTANCE_TYPES}" values.schema.json
#INSTANCE_TYPES=$$(yq e '.metadata.name' -o=json -r ../../system/kubevirt-instancetypes/templates/instancetypes.yaml | yq 'split(" ") | . + [""]' -o json) \
# && yq -i -o json ".properties.instanceType.enum = $${INSTANCE_TYPES}" values.schema.json
PREFERENCES=$$(yq e '.metadata.name' -o=json -r ../../system/kubevirt-instancetypes/templates/preferences.yaml | yq 'split(" ") | . + [""]' -o json) \
&& yq -i -o json ".properties.instanceProfile.enum = $${PREFERENCES}" values.schema.json
yq -i -o json '.properties.externalPorts.items.type = "integer"' values.schema.json

View File

@@ -101,58 +101,7 @@
"instanceType": {
"default": "u1.medium",
"description": "Virtual Machine instance type",
"type": "string",
"enum": [
"cx1.2xlarge",
"cx1.4xlarge",
"cx1.8xlarge",
"cx1.large",
"cx1.medium",
"cx1.xlarge",
"gn1.2xlarge",
"gn1.4xlarge",
"gn1.8xlarge",
"gn1.xlarge",
"m1.2xlarge",
"m1.4xlarge",
"m1.8xlarge",
"m1.large",
"m1.xlarge",
"n1.2xlarge",
"n1.4xlarge",
"n1.8xlarge",
"n1.large",
"n1.medium",
"n1.xlarge",
"o1.2xlarge",
"o1.4xlarge",
"o1.8xlarge",
"o1.large",
"o1.medium",
"o1.micro",
"o1.nano",
"o1.small",
"o1.xlarge",
"rt1.2xlarge",
"rt1.4xlarge",
"rt1.8xlarge",
"rt1.large",
"rt1.medium",
"rt1.micro",
"rt1.small",
"rt1.xlarge",
"u1.2xlarge",
"u1.2xmedium",
"u1.4xlarge",
"u1.8xlarge",
"u1.large",
"u1.medium",
"u1.micro",
"u1.nano",
"u1.small",
"u1.xlarge",
""
]
"type": "string"
},
"resources": {
"properties": {