diff --git a/packages/apps/virtual-machine/Chart.yaml b/packages/apps/virtual-machine/Chart.yaml index 22fb1c8c..b4ad45b5 100644 --- a/packages/apps/virtual-machine/Chart.yaml +++ b/packages/apps/virtual-machine/Chart.yaml @@ -17,10 +17,10 @@ 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.8.2 +version: 0.9.0 # 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 # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.8.2" +appVersion: 0.9.0 diff --git a/packages/apps/virtual-machine/Makefile b/packages/apps/virtual-machine/Makefile index 567a3813..f3de3546 100644 --- a/packages/apps/virtual-machine/Makefile +++ b/packages/apps/virtual-machine/Makefile @@ -2,6 +2,7 @@ include ../../../scripts/package.mk generate: readme-generator -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.optional=true | .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) \ diff --git a/packages/apps/virtual-machine/README.md b/packages/apps/virtual-machine/README.md index 29b22401..305ec727 100644 --- a/packages/apps/virtual-machine/README.md +++ b/packages/apps/virtual-machine/README.md @@ -47,6 +47,7 @@ virtctl ssh @ | `systemDisk.image` | The base image for the virtual machine. Allowed values: `ubuntu`, `cirros`, `alpine`, `fedora` and `talos` | `ubuntu` | | `systemDisk.storage` | The size of the disk allocated for the virtual machine | `5Gi` | | `systemDisk.storageClass` | StorageClass used to store the data | `replicated` | +| `gpus` | List of GPUs to attach | `[]` | | `resources.cpu` | The number of CPU cores allocated to the virtual machine | `""` | | `resources.memory` | The amount of memory allocated to the virtual machine | `""` | | `sshKeys` | List of SSH public keys for authentication. Can be a single key or a list of keys. | `[]` | diff --git a/packages/apps/virtual-machine/templates/vm.yaml b/packages/apps/virtual-machine/templates/vm.yaml index d952483e..6cb0aa8b 100644 --- a/packages/apps/virtual-machine/templates/vm.yaml +++ b/packages/apps/virtual-machine/templates/vm.yaml @@ -69,6 +69,12 @@ spec: memory: {{ .Values.resources.memory | quote }} {{- end }} devices: + {{- if .Values.gpus }} + gpus: + {{- range $i, $gpu := .Values.gpus }} + - deviceName: {{ $gpu.name }} + {{- end }} + {{- end }} disks: - disk: bus: scsi diff --git a/packages/apps/virtual-machine/values.schema.json b/packages/apps/virtual-machine/values.schema.json index 02b60675..ed81bc0a 100644 --- a/packages/apps/virtual-machine/values.schema.json +++ b/packages/apps/virtual-machine/values.schema.json @@ -164,6 +164,14 @@ } } }, + "gpus": { + "type": "array", + "description": "List of GPUs to attach", + "default": [], + "items": { + "type": "object" + } + }, "resources": { "type": "object", "properties": { diff --git a/packages/apps/virtual-machine/values.yaml b/packages/apps/virtual-machine/values.yaml index 0d651378..fb7eef3e 100644 --- a/packages/apps/virtual-machine/values.yaml +++ b/packages/apps/virtual-machine/values.yaml @@ -26,6 +26,12 @@ systemDisk: storage: 5Gi storageClass: replicated +## @param gpus [array] List of GPUs to attach +## Example: +## gpus: +## - name: nvidia.com/GA102GL_A10 +gpus: [] + ## @param resources.cpu The number of CPU cores allocated to the virtual machine ## @param resources.memory The amount of memory allocated to the virtual machine resources: diff --git a/packages/apps/vm-instance/Chart.yaml b/packages/apps/vm-instance/Chart.yaml index a54c1d39..5f70145f 100644 --- a/packages/apps/vm-instance/Chart.yaml +++ b/packages/apps/vm-instance/Chart.yaml @@ -17,10 +17,10 @@ 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.5.1 +version: 0.6.0 # 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 # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.5.1" +appVersion: 0.6.0 diff --git a/packages/apps/vm-instance/Makefile b/packages/apps/vm-instance/Makefile index a9aee79c..5b2aebab 100644 --- a/packages/apps/vm-instance/Makefile +++ b/packages/apps/vm-instance/Makefile @@ -3,6 +3,7 @@ include ../../../scripts/package.mk generate: readme-generator -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.optional=true | .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) \ diff --git a/packages/apps/vm-instance/README.md b/packages/apps/vm-instance/README.md index 53d9f614..42ecec5f 100644 --- a/packages/apps/vm-instance/README.md +++ b/packages/apps/vm-instance/README.md @@ -45,6 +45,7 @@ virtctl ssh @ | `instanceType` | Virtual Machine instance type | `u1.medium` | | `instanceProfile` | Virtual Machine prefferences profile | `ubuntu` | | `disks` | List of disks to attach | `[]` | +| `gpus` | List of GPUs to attach | `[]` | | `resources.cpu` | The number of CPU cores allocated to the virtual machine | `""` | | `resources.memory` | The amount of memory allocated to the virtual machine | `""` | | `sshKeys` | List of SSH public keys for authentication. Can be a single key or a list of keys. | `[]` | diff --git a/packages/apps/vm-instance/templates/vm.yaml b/packages/apps/vm-instance/templates/vm.yaml index 843ae221..bd73807a 100644 --- a/packages/apps/vm-instance/templates/vm.yaml +++ b/packages/apps/vm-instance/templates/vm.yaml @@ -41,10 +41,16 @@ spec: memory: {{ .Values.resources.memory | quote }} {{- end }} devices: + {{- if .Values.gpus }} + gpus: + {{- range $i, $gpu := .Values.gpus }} + - deviceName: {{ $gpu.name }} + {{- end }} + {{- end }} disks: {{- range $i, $disk := .Values.disks }} - - name: disk-{{ .name }} - {{- $disk := lookup "cdi.kubevirt.io/v1beta1" "DataVolume" $.Release.Namespace (printf "vm-disk-%s" .name) }} + - name: disk-{{ $disk.name }} + {{- $disk := lookup "cdi.kubevirt.io/v1beta1" "DataVolume" $.Release.Namespace (printf "vm-disk-%s" $disk.name) }} {{- if $disk }} {{- if and (hasKey $disk.metadata.annotations "vm-disk.cozystack.io/optical") (eq (index $disk.metadata.annotations "vm-disk.cozystack.io/optical") "true") }} cdrom: {} diff --git a/packages/apps/vm-instance/values.schema.json b/packages/apps/vm-instance/values.schema.json index 40560861..d289ef76 100644 --- a/packages/apps/vm-instance/values.schema.json +++ b/packages/apps/vm-instance/values.schema.json @@ -145,6 +145,14 @@ "type": "object" } }, + "gpus": { + "type": "array", + "description": "List of GPUs to attach", + "default": [], + "items": { + "type": "object" + } + }, "resources": { "type": "object", "properties": { diff --git a/packages/apps/vm-instance/values.yaml b/packages/apps/vm-instance/values.yaml index 418ba7e8..245558c9 100644 --- a/packages/apps/vm-instance/values.yaml +++ b/packages/apps/vm-instance/values.yaml @@ -24,6 +24,12 @@ instanceProfile: ubuntu ## - name: example-data disks: [] +## @param gpus [array] List of GPUs to attach +## Example: +## gpus: +## - name: nvidia.com/GA102GL_A10 +gpus: [] + ## @param resources.cpu The number of CPU cores allocated to the virtual machine ## @param resources.memory The amount of memory allocated to the virtual machine resources: