Merge pull request #855 from BTLzdravtech/main
Fixes inverted boolean logic in isProblemPod/isProblemDeployment checks and improves init container exit code handling.
This commit is contained in:
commit
4e0e6b55cd
1 changed files with 6 additions and 3 deletions
|
|
@ -472,7 +472,7 @@ func (a *Agent) collectPods(ctx context.Context) ([]agentsk8s.Pod, error) {
|
||||||
if !a.namespaceAllowed(pod.Namespace) {
|
if !a.namespaceAllowed(pod.Namespace) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !a.cfg.IncludeAllPods && !isProblemPod(pod) {
|
if !a.cfg.IncludeAllPods && isProblemPod(pod) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -545,7 +545,10 @@ func isProblemPod(pod corev1.Pod) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, cs := range pod.Status.InitContainerStatuses {
|
for _, cs := range pod.Status.InitContainerStatuses {
|
||||||
if cs.State.Waiting != nil || cs.State.Terminated != nil {
|
if cs.State.Terminated != nil && cs.State.Terminated.ExitCode != 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if cs.State.Waiting != nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if !cs.Ready && (cs.State.Running == nil) {
|
if !cs.Ready && (cs.State.Running == nil) {
|
||||||
|
|
@ -601,7 +604,7 @@ func (a *Agent) collectDeployments(ctx context.Context) ([]agentsk8s.Deployment,
|
||||||
if !a.namespaceAllowed(dep.Namespace) {
|
if !a.namespaceAllowed(dep.Namespace) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !isProblemDeployment(dep) {
|
if isProblemDeployment(dep) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue