From 44fabd4abcbebea765a7f86c87d9b9811b774f8c Mon Sep 17 00:00:00 2001 From: Timofei Larkin Date: Mon, 4 Aug 2025 14:12:37 +0300 Subject: [PATCH] [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 --- packages/apps/versions_map | 6 ++- packages/apps/virtual-machine/Chart.yaml | 2 +- packages/apps/virtual-machine/Makefile | 4 +- .../apps/virtual-machine/values.schema.json | 53 +------------------ packages/apps/vm-instance/Chart.yaml | 2 +- packages/apps/vm-instance/Makefile | 4 +- packages/apps/vm-instance/values.schema.json | 53 +------------------ 7 files changed, 12 insertions(+), 112 deletions(-) diff --git a/packages/apps/versions_map b/packages/apps/versions_map index 95b80bb3..2b8cb331 100644 --- a/packages/apps/versions_map +++ b/packages/apps/versions_map @@ -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 diff --git a/packages/apps/virtual-machine/Chart.yaml b/packages/apps/virtual-machine/Chart.yaml index 68b5e986..e58f6a0c 100644 --- a/packages/apps/virtual-machine/Chart.yaml +++ b/packages/apps/virtual-machine/Chart.yaml @@ -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 diff --git a/packages/apps/virtual-machine/Makefile b/packages/apps/virtual-machine/Makefile index 4bbfcd8c..5234bd85 100644 --- a/packages/apps/virtual-machine/Makefile +++ b/packages/apps/virtual-machine/Makefile @@ -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 diff --git a/packages/apps/virtual-machine/values.schema.json b/packages/apps/virtual-machine/values.schema.json index 92b7da9e..2d328886 100644 --- a/packages/apps/virtual-machine/values.schema.json +++ b/packages/apps/virtual-machine/values.schema.json @@ -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": { diff --git a/packages/apps/vm-instance/Chart.yaml b/packages/apps/vm-instance/Chart.yaml index 28733b49..3adb6a85 100644 --- a/packages/apps/vm-instance/Chart.yaml +++ b/packages/apps/vm-instance/Chart.yaml @@ -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 diff --git a/packages/apps/vm-instance/Makefile b/packages/apps/vm-instance/Makefile index 3a21209b..38d781ae 100644 --- a/packages/apps/vm-instance/Makefile +++ b/packages/apps/vm-instance/Makefile @@ -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 diff --git a/packages/apps/vm-instance/values.schema.json b/packages/apps/vm-instance/values.schema.json index 05b49a0d..c411e3ab 100644 --- a/packages/apps/vm-instance/values.schema.json +++ b/packages/apps/vm-instance/values.schema.json @@ -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": {