From 99337187f6c945e19a8fbe8ddabd3847ae654d3c Mon Sep 17 00:00:00 2001 From: catttam Date: Tue, 31 Oct 2023 11:48:10 +0100 Subject: [PATCH] Fixed enable SGX on exposed services --- pkg/backends/k8s.go | 1 + pkg/utils/expose.go | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/backends/k8s.go b/pkg/backends/k8s.go index 4d89e38c..eeef1829 100644 --- a/pkg/backends/k8s.go +++ b/pkg/backends/k8s.go @@ -127,6 +127,7 @@ func (k *KubeBackend) CreateService(service types.Service) error { MaxScale: service.Expose.MaxScale, MinScale: service.Expose.MinScale, CpuThreshold: service.Expose.CpuThreshold, + EnableSGX: service.EnableSGX, } utils.CreateExpose(exposeConf, k.kubeClientset, *k.config) } diff --git a/pkg/utils/expose.go b/pkg/utils/expose.go index 8fdcbdb4..b602718c 100644 --- a/pkg/utils/expose.go +++ b/pkg/utils/expose.go @@ -42,7 +42,6 @@ type Expose struct { Port int ` binding:"required" default:"80"` CpuThreshold int32 `default:"80"` EnableSGX bool - EnableGPU bool } // / Main function that creates all the kubernetes components @@ -232,6 +231,8 @@ func getPodTemplateSpec(e Expose) v1.PodTemplateSpec { Requests: v1.ResourceList{ "cpu": *cores, }, + // Empty Limits list initialized in case enabling SGX is needed + Limits: v1.ResourceList{}, }, }, }, @@ -244,11 +245,6 @@ func getPodTemplateSpec(e Expose) v1.PodTemplateSpec { template.Spec.Containers[0].Resources.Limits["sgx.intel.com/enclave"] = sgx } - if e.EnableGPU { - gpu, _ := resource.ParseQuantity("1") - template.Spec.Containers[0].Resources.Limits["nvidia.com/gpu"] = gpu - } - return template }