| 76 | } |
| 77 | |
| 78 | func 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 | |
| 108 | func GetReadinessProbesFromContainers(containers []*userconfig.Container) map[string]kcore.Probe { |
| 109 | probes := map[string]kcore.Probe{} |