@@ -120,13 +120,19 @@ func NewValidationReconciler(
120120 }
121121
122122 for _ , ref := range flow .Spec .GlobalOutputRefs {
123- if output := resources .Fluentd .ClusterOutputs .FindByName (ref ); output != nil {
123+ switch output := resources .Fluentd .ClusterOutputs .FindByName (ref ); {
124+ case output == nil :
125+ flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("dangling global output reference: %s" , ref ))
126+
127+ case output .Status .ProblemsCount > 0 :
128+ flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("global output reference: %s has problems" , output .Name ))
129+
130+ default :
124131 flow .Status .Active = utils .BoolPointer (true )
125132 output .Status .Active = utils .BoolPointer (true )
126- } else {
127- flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("dangling global output reference: %s" , ref ))
128133 }
129134 }
135+
130136 flow .Status .ProblemsCount = len (flow .Status .Problems )
131137 }
132138
@@ -146,11 +152,12 @@ func NewValidationReconciler(
146152 switch output := resources .Fluentd .ClusterOutputs .FindByName (ref ); {
147153 case output == nil :
148154 flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("dangling global output reference: %s" , ref ))
149- continue
150155
151156 case output .Spec .Protected :
152157 flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("global output reference is protected: %s" , ref ))
153- continue
158+
159+ case output .Status .ProblemsCount > 0 :
160+ flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("global output reference: %s has problems" , output .Name ))
154161
155162 default :
156163 output .Status .Active = utils .BoolPointer (true )
@@ -159,11 +166,16 @@ func NewValidationReconciler(
159166 }
160167
161168 for _ , ref := range flow .Spec .LocalOutputRefs {
162- if output := resources .Fluentd .Outputs .FindByNamespacedName (flow .Namespace , ref ); output != nil {
169+ switch output := resources .Fluentd .Outputs .FindByNamespacedName (flow .Namespace , ref ); {
170+ case output == nil :
171+ flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("dangling local output reference: %s" , ref ))
172+
173+ case output .Status .ProblemsCount > 0 :
174+ flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("local output reference: %s has problems" , output .Name ))
175+
176+ default :
163177 output .Status .Active = utils .BoolPointer (true )
164178 hasValidOutput = true
165- } else {
166- flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("dangling local output reference: %s" , ref ))
167179 }
168180 }
169181
@@ -185,13 +197,19 @@ func NewValidationReconciler(
185197 flow .Status .Problems = nil
186198
187199 for _ , ref := range flow .Spec .GlobalOutputRefs {
188- if output := resources .SyslogNG .ClusterOutputs .FindByName (ref ); output != nil {
200+ switch output := resources .SyslogNG .ClusterOutputs .FindByName (ref ); {
201+ case output == nil :
202+ flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("dangling global output reference: %s" , ref ))
203+
204+ case output .Status .ProblemsCount > 0 :
205+ flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("global output reference: %s has problems" , output .Name ))
206+
207+ default :
189208 flow .Status .Active = utils .BoolPointer (true )
190209 output .Status .Active = utils .BoolPointer (true )
191- } else {
192- flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("dangling global output reference: %s" , ref ))
193210 }
194211 }
212+
195213 flow .Status .ProblemsCount = len (flow .Status .Problems )
196214 }
197215
@@ -207,11 +225,12 @@ func NewValidationReconciler(
207225 switch output := resources .SyslogNG .ClusterOutputs .FindByName (ref ); {
208226 case output == nil :
209227 flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("dangling global output reference: %s" , ref ))
210- continue
211228
212229 case output .Spec .Protected :
213230 flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("global output reference is protected: %s" , ref ))
214- continue
231+
232+ case output .Status .ProblemsCount > 0 :
233+ flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("global output reference: %s has problems" , output .Name ))
215234
216235 default :
217236 output .Status .Active = utils .BoolPointer (true )
@@ -220,11 +239,16 @@ func NewValidationReconciler(
220239 }
221240
222241 for _ , ref := range flow .Spec .LocalOutputRefs {
223- if output := resources .SyslogNG .Outputs .FindByNamespacedName (flow .Namespace , ref ); output != nil {
242+ switch output := resources .SyslogNG .Outputs .FindByNamespacedName (flow .Namespace , ref ); {
243+ case output == nil :
244+ flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("dangling local output reference: %s" , ref ))
245+
246+ case output .Status .ProblemsCount > 0 :
247+ flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("local output reference: %s has problems" , output .Name ))
248+
249+ default :
224250 output .Status .Active = utils .BoolPointer (true )
225251 hasValidOutput = true
226- } else {
227- flow .Status .Problems = append (flow .Status .Problems , fmt .Sprintf ("dangling local output reference: %s" , ref ))
228252 }
229253 }
230254
@@ -313,6 +337,8 @@ func NewValidationReconciler(
313337
314338 if ! resources .Logging .WatchAllNamespaces () {
315339 resources .Logging .Status .WatchNamespaces = resources .WatchNamespaces
340+ } else {
341+ resources .Logging .Status .WatchNamespaces = []string {"*" }
316342 }
317343
318344 if resources .Logging .Spec .WatchNamespaceSelector != nil &&
0 commit comments