Skip to content

Commit

Permalink
Listen on any addr, default to hostPath when no image PVC provided (#108
Browse files Browse the repository at this point in the history
)

* listen on any addr

* always use nvidia resource requests

* images volume default to host path
  • Loading branch information
nickpetrovic authored Mar 22, 2024
1 parent 479089b commit 6aa1be7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion internal/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (g *Gateway) registerServices() error {

// Gateway entry point
func (g *Gateway) Start() error {
listener, err := net.Listen("tcp", fmt.Sprintf("0.0.0.0:%d", g.config.GatewayService.GRPCPort))
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", g.config.GatewayService.GRPCPort))
if err != nil {
log.Fatalf("Failed to listen: %v", err)
}
Expand Down
25 changes: 17 additions & 8 deletions internal/scheduler/pool_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ func (wpc *LocalKubernetesWorkerPoolController) createWorkerJob(workerId string,
workerMemory = wpc.config.Worker.DefaultWorkerMemoryRequest
}

if gpuType != "" && wpc.workerPool.Runtime == "nvidia" {
// We only support nvidia for now
if gpuType != "" {
resourceRequests[corev1.ResourceName("nvidia.com/gpu")] = *resource.NewQuantity(int64(gpuCount), resource.DecimalSI)
}

Expand Down Expand Up @@ -267,14 +268,22 @@ func (wpc *LocalKubernetesWorkerPoolController) getWorkerVolumes(workerMemory in
}
}

volumeSource := corev1.VolumeSource{}
if wpc.config.Worker.ImagePVCName != "" {
volumeSource.PersistentVolumeClaim = &corev1.PersistentVolumeClaimVolumeSource{
ClaimName: wpc.config.Worker.ImagePVCName,
}
} else {
volumeSource.HostPath = &corev1.HostPathVolumeSource{
Path: defaultImagesPath,
Type: &hostPathType,
}
}

return append(volumes,
corev1.Volume{
Name: imagesVolumeName,
VolumeSource: corev1.VolumeSource{
PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
ClaimName: wpc.config.Worker.ImagePVCName,
},
},
Name: imagesVolumeName,
VolumeSource: volumeSource,
},
)
}
Expand All @@ -288,7 +297,7 @@ func (wpc *LocalKubernetesWorkerPoolController) getWorkerVolumeMounts() []corev1
},
{
Name: imagesVolumeName,
MountPath: "/images",
MountPath: defaultImagesPath,
ReadOnly: false,
},
{
Expand Down
2 changes: 1 addition & 1 deletion internal/worker/runc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func NewRunCServer(containerInstances *common.SafeMap[*ContainerInstance], image
}

func (s *RunCServer) Start() error {
listener, err := net.Listen("tcp", fmt.Sprintf("0.0.0.0:%d", defaultWorkerServerPort))
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", defaultWorkerServerPort))
if err != nil {
log.Fatalf("failed to listen: %v\n", err)
}
Expand Down

0 comments on commit 6aa1be7

Please sign in to comment.