Skip to content

Commit

Permalink
Fixed enable SGX on exposed services
Browse files Browse the repository at this point in the history
  • Loading branch information
catttam committed Oct 31, 2023
1 parent 83222e9 commit 9933718
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions pkg/backends/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
8 changes: 2 additions & 6 deletions pkg/utils/expose.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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{},
},
},
},
Expand All @@ -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
}

Expand Down

0 comments on commit 9933718

Please sign in to comment.