@@ -38,6 +38,10 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
3838
3939 for _ , c := range pod .Status .InitContainerStatuses {
4040 if t := c .State .Terminated ; t != nil {
41+ if t .ExitCode == 0 {
42+ continue
43+ }
44+
4145 if q := t .FinishedAt .Time ; q .After (last ) {
4246 if ! q .Before (current ) {
4347 current = q
@@ -46,10 +50,6 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
4650 continue
4751 }
4852
49- if t .ExitCode == 0 {
50- continue
51- }
52-
5353 log .Str ("member" , memberStatus .ID ).
5454 Str ("pod" , pod .GetName ()).
5555 Str ("container" , c .Name ).
@@ -64,6 +64,10 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
6464
6565 r .metrics .IncMemberInitContainerRestarts (memberStatus .ID , c .Name , t .Reason , t .ExitCode )
6666 } else if t := c .LastTerminationState .Terminated ; t != nil {
67+ if t .ExitCode == 0 {
68+ continue
69+ }
70+
6771 if q := t .FinishedAt .Time ; q .After (last ) {
6872 if ! q .Before (current ) {
6973 current = q
@@ -72,10 +76,6 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
7276 continue
7377 }
7478
75- if t .ExitCode == 0 {
76- continue
77- }
78-
7979 log .Str ("member" , memberStatus .ID ).
8080 Str ("pod" , pod .GetName ()).
8181 Str ("container" , c .Name ).
@@ -94,6 +94,10 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
9494
9595 for _ , c := range pod .Status .ContainerStatuses {
9696 if t := c .State .Terminated ; t != nil {
97+ if t .ExitCode == 0 {
98+ continue
99+ }
100+
97101 if q := t .FinishedAt .Time ; q .After (last ) {
98102 if ! q .Before (current ) {
99103 current = q
@@ -102,10 +106,6 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
102106 continue
103107 }
104108
105- if t .ExitCode == 0 {
106- continue
107- }
108-
109109 log .Str ("member" , memberStatus .ID ).
110110 Str ("pod" , pod .GetName ()).
111111 Str ("container" , c .Name ).
@@ -120,6 +120,10 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
120120
121121 r .metrics .IncMemberContainerRestarts (memberStatus .ID , c .Name , t .Reason , t .ExitCode )
122122 } else if t := c .LastTerminationState .Terminated ; t != nil {
123+ if t .ExitCode == 0 {
124+ continue
125+ }
126+
123127 if q := t .FinishedAt .Time ; q .After (last ) {
124128 if ! q .Before (current ) {
125129 current = q
@@ -128,10 +132,6 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
128132 continue
129133 }
130134
131- if t .ExitCode == 0 {
132- continue
133- }
134-
135135 log .Str ("member" , memberStatus .ID ).
136136 Str ("pod" , pod .GetName ()).
137137 Str ("container" , c .Name ).
@@ -150,6 +150,10 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
150150
151151 for _ , c := range pod .Status .EphemeralContainerStatuses {
152152 if t := c .State .Terminated ; t != nil {
153+ if t .ExitCode == 0 {
154+ continue
155+ }
156+
153157 if q := t .FinishedAt .Time ; q .After (last ) {
154158 if ! q .Before (current ) {
155159 current = q
@@ -158,10 +162,6 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
158162 continue
159163 }
160164
161- if t .ExitCode == 0 {
162- continue
163- }
164-
165165 log .Str ("member" , memberStatus .ID ).
166166 Str ("pod" , pod .GetName ()).
167167 Str ("container" , c .Name ).
@@ -176,6 +176,10 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
176176
177177 r .metrics .IncMemberEphemeralContainerRestarts (memberStatus .ID , c .Name , t .Reason , t .ExitCode )
178178 } else if t := c .LastTerminationState .Terminated ; t != nil {
179+ if t .ExitCode == 0 {
180+ continue
181+ }
182+
179183 if q := t .FinishedAt .Time ; q .After (last ) {
180184 if ! q .Before (current ) {
181185 current = q
@@ -184,10 +188,6 @@ func (r *Resources) failedContainerHandler(log logging.Logger, memberStatus api.
184188 continue
185189 }
186190
187- if t .ExitCode == 0 {
188- continue
189- }
190-
191191 log .Str ("member" , memberStatus .ID ).
192192 Str ("pod" , pod .GetName ()).
193193 Str ("container" , c .Name ).
0 commit comments