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

Function GetLifecycleSpec

pkg/workloads/helpers.go:78–106  ·  view source on GitHub ↗
(preStop *userconfig.PreStop)

Source from the content-addressed store, hash-verified

76}
77
78func GetLifecycleSpec(preStop *userconfig.PreStop) *kcore.Lifecycle {
79 if preStop == nil {
80 return nil
81 }
82
83 var httpGetAction *kcore.HTTPGetAction
84 var execAction *kcore.ExecAction
85
86 if preStop.HTTPGet != nil {
87 httpGetAction = &kcore.HTTPGetAction{
88 Path: strings.TrimPrefix(preStop.HTTPGet.Path, "/"), // the leading / is automatically added by k8s
89 Port: intstr.IntOrString{
90 IntVal: preStop.HTTPGet.Port,
91 },
92 }
93 }
94 if preStop.Exec != nil {
95 execAction = &kcore.ExecAction{
96 Command: preStop.Exec.Command,
97 }
98 }
99
100 return &kcore.Lifecycle{
101 PreStop: &kcore.Handler{
102 HTTPGet: httpGetAction,
103 Exec: execAction,
104 },
105 }
106}
107
108func GetReadinessProbesFromContainers(containers []*userconfig.Container) map[string]kcore.Probe {
109 probes := map[string]kcore.Probe{}

Callers 1

userPodContainersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected