MCPcopy Index your code
hub / github.com/cortexlabs/cortex / GetProbeSpec

Function GetProbeSpec

pkg/workloads/helpers.go:34–76  ·  view source on GitHub ↗
(probe *userconfig.Probe)

Source from the content-addressed store, hash-verified

32}
33
34func GetProbeSpec(probe *userconfig.Probe) *kcore.Probe {
35 if probe == nil {
36 return nil
37 }
38
39 var httpGetAction *kcore.HTTPGetAction
40 var tcpSocketAction *kcore.TCPSocketAction
41 var execAction *kcore.ExecAction
42
43 if probe.HTTPGet != nil {
44 httpGetAction = &kcore.HTTPGetAction{
45 Path: probe.HTTPGet.Path,
46 Port: intstr.IntOrString{
47 IntVal: probe.HTTPGet.Port,
48 },
49 }
50 }
51 if probe.TCPSocket != nil {
52 tcpSocketAction = &kcore.TCPSocketAction{
53 Port: intstr.IntOrString{
54 IntVal: probe.TCPSocket.Port,
55 },
56 }
57 }
58 if probe.Exec != nil {
59 execAction = &kcore.ExecAction{
60 Command: probe.Exec.Command,
61 }
62 }
63
64 return &kcore.Probe{
65 Handler: kcore.Handler{
66 HTTPGet: httpGetAction,
67 TCPSocket: tcpSocketAction,
68 Exec: execAction,
69 },
70 InitialDelaySeconds: probe.InitialDelaySeconds,
71 TimeoutSeconds: probe.TimeoutSeconds,
72 PeriodSeconds: probe.PeriodSeconds,
73 SuccessThreshold: probe.SuccessThreshold,
74 FailureThreshold: probe.FailureThreshold,
75 }
76}
77
78func GetLifecycleSpec(preStop *userconfig.PreStop) *kcore.Lifecycle {
79 if preStop == nil {

Callers 2

userPodContainersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected