Skip to content

Commit f517f04

Browse files
authored
feat: add hypervisor probe (#335)
1 parent 23dee76 commit f517f04

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

internal/utils/compose.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/samber/lo"
1313
v1 "k8s.io/api/core/v1"
1414
"k8s.io/apimachinery/pkg/api/resource"
15+
"k8s.io/apimachinery/pkg/util/intstr"
1516
"k8s.io/utils/ptr"
1617
)
1718

@@ -501,6 +502,35 @@ func composeHypervisorContainer(spec *v1.PodSpec, pool *tfv1.GPUPool, enableVect
501502
spec.Containers[0].Resources.Limits = hypervisorDefaultLimits
502503
}
503504

505+
if spec.Containers[0].LivenessProbe == nil {
506+
spec.Containers[0].LivenessProbe = &v1.Probe{
507+
ProbeHandler: v1.ProbeHandler{
508+
HTTPGet: &v1.HTTPGetAction{
509+
Path: "/healthz",
510+
Port: intstr.FromInt(int(port)),
511+
},
512+
},
513+
InitialDelaySeconds: 15,
514+
PeriodSeconds: 20,
515+
TimeoutSeconds: 5,
516+
FailureThreshold: 5,
517+
}
518+
}
519+
if spec.Containers[0].ReadinessProbe == nil {
520+
spec.Containers[0].ReadinessProbe = &v1.Probe{
521+
ProbeHandler: v1.ProbeHandler{
522+
HTTPGet: &v1.HTTPGetAction{
523+
Path: "/readyz",
524+
Port: intstr.FromInt(int(port)),
525+
},
526+
},
527+
InitialDelaySeconds: 5,
528+
PeriodSeconds: 15,
529+
TimeoutSeconds: 5,
530+
FailureThreshold: 2,
531+
}
532+
}
533+
504534
// TODO HypervisorVerifyServiceAccountEnabledEnvVar and Public Key
505535
}
506536

0 commit comments

Comments
 (0)