(condition *latest.HookWaitConfig, podContainer *selector.SelectedPodContainer)
| 110 | } |
| 111 | |
| 112 | func isWaitConditionTrue(condition *latest.HookWaitConfig, podContainer *selector.SelectedPodContainer) bool { |
| 113 | if selector.IsPodTerminating(podContainer.Pod) { |
| 114 | return false |
| 115 | } |
| 116 | |
| 117 | for _, cs := range podContainer.Pod.Status.InitContainerStatuses { |
| 118 | if cs.Name == podContainer.Container.Name { |
| 119 | if condition.Running && cs.State.Running != nil && cs.Ready { |
| 120 | return true |
| 121 | } |
| 122 | if condition.TerminatedWithCode != nil && cs.State.Terminated != nil && cs.State.Terminated.ExitCode == *condition.TerminatedWithCode { |
| 123 | return true |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | for _, cs := range podContainer.Pod.Status.ContainerStatuses { |
| 128 | if cs.Name == podContainer.Container.Name { |
| 129 | if condition.Running && cs.State.Running != nil && cs.Ready { |
| 130 | return true |
| 131 | } |
| 132 | if condition.TerminatedWithCode != nil && cs.State.Terminated != nil && cs.State.Terminated.ExitCode == *condition.TerminatedWithCode { |
| 133 | return true |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | return false |
| 139 | } |
no test coverage detected