From 132177b47538f507c7d0f6b369a94d235863a02e Mon Sep 17 00:00:00 2001 From: tunahanertekin Date: Thu, 7 Sep 2023 15:05:52 +0300 Subject: [PATCH 1/6] refactor(labels): add label keys for specifying mig instances for services --- internal/shared.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/shared.go b/internal/shared.go index c50af6d0..9eb40f3f 100644 --- a/internal/shared.go +++ b/internal/shared.go @@ -31,6 +31,13 @@ const ( TARGET_VDI_LABEL_KEY = "robolaunch.io/target-vdi" ) +// MIG instance labels eg. mig-1g.5gb +const ( + VDI_MIG_INSTANCE_LABEL_KEY = "robolaunch.io/vdi-mig-instance" + IDE_MIG_INSTANCE_LABEL_KEY = "robolaunch.io/ide-mig-instance" + LAUNCHMANAGER_MIG_INSTANCE_LABEL_KEY = "robolaunch.io/lm-mig-instance" +) + // Special escape labels const ( ROBOT_DEV_SUITE_OWNED = "robolaunch.io/dev-suite-owned" From 5154edbf3a68d00471e01245f972028ec7dac2fd Mon Sep 17 00:00:00 2001 From: tunahanertekin Date: Thu, 7 Sep 2023 15:13:33 +0300 Subject: [PATCH 2/6] refactor(api): add field for gpu instance name --- pkg/api/roboscale.io/v1alpha1/dev_types.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/api/roboscale.io/v1alpha1/dev_types.go b/pkg/api/roboscale.io/v1alpha1/dev_types.go index 7b595d1c..37228568 100644 --- a/pkg/api/roboscale.io/v1alpha1/dev_types.go +++ b/pkg/api/roboscale.io/v1alpha1/dev_types.go @@ -191,6 +191,9 @@ type RobotIDEStatus struct { // VDI resource limits. type Resources struct { + // GPU instance that will be allocated. eg. mig-1g.5gb. Defaults to "gpu". + // +kubebuilder:default="gpu" + GPUInstance string `json:"gpuInstance,omitempty"` // GPU core number that will be allocated. GPUCore int `json:"gpuCore,omitempty"` // CPU resource limit. From 53fc1877c1c1da37cec7302fb49b139529eac76b Mon Sep 17 00:00:00 2001 From: tunahanertekin Date: Thu, 7 Sep 2023 15:16:41 +0300 Subject: [PATCH 3/6] refactor(api): update default value of gpu instance --- pkg/api/roboscale.io/v1alpha1/dev_types.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/api/roboscale.io/v1alpha1/dev_types.go b/pkg/api/roboscale.io/v1alpha1/dev_types.go index 37228568..d0e80510 100644 --- a/pkg/api/roboscale.io/v1alpha1/dev_types.go +++ b/pkg/api/roboscale.io/v1alpha1/dev_types.go @@ -191,8 +191,8 @@ type RobotIDEStatus struct { // VDI resource limits. type Resources struct { - // GPU instance that will be allocated. eg. mig-1g.5gb. Defaults to "gpu". - // +kubebuilder:default="gpu" + // GPU instance that will be allocated. eg. nvidia.com/mig-1g.5gb. Defaults to "nvidia.com/gpu". + // +kubebuilder:default="nvidia.com/gpu" GPUInstance string `json:"gpuInstance,omitempty"` // GPU core number that will be allocated. GPUCore int `json:"gpuCore,omitempty"` From 1f98cf186bf3c9d4c47b319b5faa11b9339130f1 Mon Sep 17 00:00:00 2001 From: tunahanertekin Date: Thu, 7 Sep 2023 15:18:18 +0300 Subject: [PATCH 4/6] refactor(resources): apply gpu instance type --- internal/resources/robot_vdi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/resources/robot_vdi.go b/internal/resources/robot_vdi.go index 126eebc2..683fb78e 100644 --- a/internal/resources/robot_vdi.go +++ b/internal/resources/robot_vdi.go @@ -312,7 +312,7 @@ func GetRobotVDIIngress(robotVDI *robotv1alpha1.RobotVDI, ingressNamespacedName func getResourceLimits(resources robotv1alpha1.Resources) corev1.ResourceList { resourceLimits := corev1.ResourceList{} if resources.GPUCore != 0 { - resourceLimits["nvidia.com/gpu"] = resource.MustParse(strconv.Itoa(resources.GPUCore)) + resourceLimits[corev1.ResourceName(resources.GPUInstance)] = resource.MustParse(strconv.Itoa(resources.GPUCore)) } if resources.CPU != "" { resourceLimits["cpu"] = resource.MustParse(resources.CPU) From 2bc5122d8e49917b9b937a909209a9d8d43ea478 Mon Sep 17 00:00:00 2001 From: tunahanertekin Date: Thu, 7 Sep 2023 15:18:55 +0300 Subject: [PATCH 5/6] refactor(labels): remove label keys --- internal/shared.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/internal/shared.go b/internal/shared.go index 9eb40f3f..c50af6d0 100644 --- a/internal/shared.go +++ b/internal/shared.go @@ -31,13 +31,6 @@ const ( TARGET_VDI_LABEL_KEY = "robolaunch.io/target-vdi" ) -// MIG instance labels eg. mig-1g.5gb -const ( - VDI_MIG_INSTANCE_LABEL_KEY = "robolaunch.io/vdi-mig-instance" - IDE_MIG_INSTANCE_LABEL_KEY = "robolaunch.io/ide-mig-instance" - LAUNCHMANAGER_MIG_INSTANCE_LABEL_KEY = "robolaunch.io/lm-mig-instance" -) - // Special escape labels const ( ROBOT_DEV_SUITE_OWNED = "robolaunch.io/dev-suite-owned" From ee2d8f8c8a554d637f0dcbe8ca19fe15e7346b3c Mon Sep 17 00:00:00 2001 From: tunahanertekin Date: Thu, 7 Sep 2023 15:22:57 +0300 Subject: [PATCH 6/6] build(manifests): :whale: update internal manifests --- .../crd/bases/robot.roboscale.io_launchmanagers.yaml | 5 +++++ .../crd/bases/robot.roboscale.io_robotartifacts.yaml | 10 ++++++++++ .../crd/bases/robot.roboscale.io_robotdevsuites.yaml | 10 ++++++++++ config/crd/bases/robot.roboscale.io_robotides.yaml | 5 +++++ config/crd/bases/robot.roboscale.io_robots.yaml | 10 ++++++++++ config/crd/bases/robot.roboscale.io_robotvdis.yaml | 5 +++++ config/manager/kustomization.yaml | 4 ++-- 7 files changed, 47 insertions(+), 2 deletions(-) diff --git a/config/crd/bases/robot.roboscale.io_launchmanagers.yaml b/config/crd/bases/robot.roboscale.io_launchmanagers.yaml index 8fd81e88..43565f37 100644 --- a/config/crd/bases/robot.roboscale.io_launchmanagers.yaml +++ b/config/crd/bases/robot.roboscale.io_launchmanagers.yaml @@ -188,6 +188,11 @@ spec: gpuCore: description: GPU core number that will be allocated. type: integer + gpuInstance: + default: nvidia.com/gpu + description: GPU instance that will be allocated. eg. + nvidia.com/mig-1g.5gb. Defaults to "nvidia.com/gpu". + type: string memory: description: Memory resource limit. pattern: ^([0-9])+(Mi|Gi)$ diff --git a/config/crd/bases/robot.roboscale.io_robotartifacts.yaml b/config/crd/bases/robot.roboscale.io_robotartifacts.yaml index f62e7233..71f07eba 100644 --- a/config/crd/bases/robot.roboscale.io_robotartifacts.yaml +++ b/config/crd/bases/robot.roboscale.io_robotartifacts.yaml @@ -319,6 +319,11 @@ spec: gpuCore: description: GPU core number that will be allocated. type: integer + gpuInstance: + default: nvidia.com/gpu + description: GPU instance that will be allocated. eg. + nvidia.com/mig-1g.5gb. Defaults to "nvidia.com/gpu". + type: string memory: description: Memory resource limit. pattern: ^([0-9])+(Mi|Gi)$ @@ -371,6 +376,11 @@ spec: gpuCore: description: GPU core number that will be allocated. type: integer + gpuInstance: + default: nvidia.com/gpu + description: GPU instance that will be allocated. eg. + nvidia.com/mig-1g.5gb. Defaults to "nvidia.com/gpu". + type: string memory: description: Memory resource limit. pattern: ^([0-9])+(Mi|Gi)$ diff --git a/config/crd/bases/robot.roboscale.io_robotdevsuites.yaml b/config/crd/bases/robot.roboscale.io_robotdevsuites.yaml index c6bce88f..a35d6b28 100644 --- a/config/crd/bases/robot.roboscale.io_robotdevsuites.yaml +++ b/config/crd/bases/robot.roboscale.io_robotdevsuites.yaml @@ -129,6 +129,11 @@ spec: gpuCore: description: GPU core number that will be allocated. type: integer + gpuInstance: + default: nvidia.com/gpu + description: GPU instance that will be allocated. eg. nvidia.com/mig-1g.5gb. + Defaults to "nvidia.com/gpu". + type: string memory: description: Memory resource limit. pattern: ^([0-9])+(Mi|Gi)$ @@ -181,6 +186,11 @@ spec: gpuCore: description: GPU core number that will be allocated. type: integer + gpuInstance: + default: nvidia.com/gpu + description: GPU instance that will be allocated. eg. nvidia.com/mig-1g.5gb. + Defaults to "nvidia.com/gpu". + type: string memory: description: Memory resource limit. pattern: ^([0-9])+(Mi|Gi)$ diff --git a/config/crd/bases/robot.roboscale.io_robotides.yaml b/config/crd/bases/robot.roboscale.io_robotides.yaml index 7015f8bf..b9c03ecb 100644 --- a/config/crd/bases/robot.roboscale.io_robotides.yaml +++ b/config/crd/bases/robot.roboscale.io_robotides.yaml @@ -73,6 +73,11 @@ spec: gpuCore: description: GPU core number that will be allocated. type: integer + gpuInstance: + default: nvidia.com/gpu + description: GPU instance that will be allocated. eg. nvidia.com/mig-1g.5gb. + Defaults to "nvidia.com/gpu". + type: string memory: description: Memory resource limit. pattern: ^([0-9])+(Mi|Gi)$ diff --git a/config/crd/bases/robot.roboscale.io_robots.yaml b/config/crd/bases/robot.roboscale.io_robots.yaml index b112e29c..5ae518d3 100644 --- a/config/crd/bases/robot.roboscale.io_robots.yaml +++ b/config/crd/bases/robot.roboscale.io_robots.yaml @@ -340,6 +340,11 @@ spec: gpuCore: description: GPU core number that will be allocated. type: integer + gpuInstance: + default: nvidia.com/gpu + description: GPU instance that will be allocated. eg. + nvidia.com/mig-1g.5gb. Defaults to "nvidia.com/gpu". + type: string memory: description: Memory resource limit. pattern: ^([0-9])+(Mi|Gi)$ @@ -392,6 +397,11 @@ spec: gpuCore: description: GPU core number that will be allocated. type: integer + gpuInstance: + default: nvidia.com/gpu + description: GPU instance that will be allocated. eg. + nvidia.com/mig-1g.5gb. Defaults to "nvidia.com/gpu". + type: string memory: description: Memory resource limit. pattern: ^([0-9])+(Mi|Gi)$ diff --git a/config/crd/bases/robot.roboscale.io_robotvdis.yaml b/config/crd/bases/robot.roboscale.io_robotvdis.yaml index 64c4226a..f63abbbc 100644 --- a/config/crd/bases/robot.roboscale.io_robotvdis.yaml +++ b/config/crd/bases/robot.roboscale.io_robotvdis.yaml @@ -85,6 +85,11 @@ spec: gpuCore: description: GPU core number that will be allocated. type: integer + gpuInstance: + default: nvidia.com/gpu + description: GPU instance that will be allocated. eg. nvidia.com/mig-1g.5gb. + Defaults to "nvidia.com/gpu". + type: string memory: description: Memory resource limit. pattern: ^([0-9])+(Mi|Gi)$ diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 0131efb2..cc9639cc 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: robolaunchio/robot-controller-manager - newTag: v0.2.6-alpha.2 + newName: robolaunchio/robot-controller-manager-dev + newTag: platform-v0.7.0