@@ -148,16 +148,17 @@ func (r LoggingResourceRepository) ClusterFlowsFor(ctx context.Context, logging
148148 return nil , err
149149 }
150150
151- sort .Slice (list .Items , func (i , j int ) bool {
152- return lessByNamespacedName (& list .Items [i ], & list .Items [j ])
153- })
154-
155151 var res []v1beta1.ClusterFlow
156152 for _ , i := range list .Items {
157153 if i .Spec .LoggingRef == logging .Spec .LoggingRef {
158154 res = append (res , i )
159155 }
160156 }
157+
158+ sort .Slice (res , func (i , j int ) bool {
159+ return lessByNamespacedName (& res [i ], & res [j ])
160+ })
161+
161162 return res , nil
162163}
163164
@@ -167,16 +168,17 @@ func (r LoggingResourceRepository) ClusterOutputsFor(ctx context.Context, loggin
167168 return nil , err
168169 }
169170
170- sort .Slice (list .Items , func (i , j int ) bool {
171- return lessByNamespacedName (& list .Items [i ], & list .Items [j ])
172- })
173-
174171 var res []v1beta1.ClusterOutput
175172 for _ , i := range list .Items {
176173 if i .Spec .LoggingRef == logging .Spec .LoggingRef {
177174 res = append (res , i )
178175 }
179176 }
177+
178+ sort .Slice (res , func (i , j int ) bool {
179+ return lessByNamespacedName (& res [i ], & res [j ])
180+ })
181+
180182 return res , nil
181183}
182184
@@ -186,16 +188,17 @@ func (r LoggingResourceRepository) FlowsInNamespaceFor(ctx context.Context, name
186188 return nil , err
187189 }
188190
189- sort .Slice (list .Items , func (i , j int ) bool {
190- return lessByNamespacedName (& list .Items [i ], & list .Items [j ])
191- })
192-
193191 var res []v1beta1.Flow
194192 for _ , i := range list .Items {
195193 if i .Spec .LoggingRef == logging .Spec .LoggingRef {
196194 res = append (res , i )
197195 }
198196 }
197+
198+ sort .Slice (res , func (i , j int ) bool {
199+ return lessByNamespacedName (& res [i ], & res [j ])
200+ })
201+
199202 return res , nil
200203}
201204
@@ -205,16 +208,16 @@ func (r LoggingResourceRepository) OutputsInNamespaceFor(ctx context.Context, na
205208 return nil , err
206209 }
207210
208- sort .Slice (list .Items , func (i , j int ) bool {
209- return lessByNamespacedName (& list .Items [i ], & list .Items [j ])
210- })
211-
212211 var res []v1beta1.Output
213212 for _ , i := range list .Items {
214213 if i .Spec .LoggingRef == logging .Spec .LoggingRef {
215214 res = append (res , i )
216215 }
217216 }
217+
218+ sort .Slice (res , func (i , j int ) bool {
219+ return lessByNamespacedName (& res [i ], & res [j ])
220+ })
218221 return res , nil
219222}
220223
@@ -224,16 +227,16 @@ func (r LoggingResourceRepository) SyslogNGClusterFlowsFor(ctx context.Context,
224227 return nil , err
225228 }
226229
227- sort .Slice (list .Items , func (i , j int ) bool {
228- return lessByNamespacedName (& list .Items [i ], & list .Items [j ])
229- })
230-
231230 var res []v1beta1.SyslogNGClusterFlow
232231 for _ , i := range list .Items {
233232 if i .Spec .LoggingRef == logging .Spec .LoggingRef {
234233 res = append (res , i )
235234 }
236235 }
236+
237+ sort .Slice (res , func (i , j int ) bool {
238+ return lessByNamespacedName (& res [i ], & res [j ])
239+ })
237240 return res , nil
238241}
239242
@@ -243,16 +246,15 @@ func (r LoggingResourceRepository) SyslogNGClusterOutputsFor(ctx context.Context
243246 return nil , err
244247 }
245248
246- sort .Slice (list .Items , func (i , j int ) bool {
247- return lessByNamespacedName (& list .Items [i ], & list .Items [j ])
248- })
249-
250249 var res []v1beta1.SyslogNGClusterOutput
251250 for _ , i := range list .Items {
252251 if i .Spec .LoggingRef == logging .Spec .LoggingRef {
253252 res = append (res , i )
254253 }
255254 }
255+ sort .Slice (res , func (i , j int ) bool {
256+ return lessByNamespacedName (& res [i ], & res [j ])
257+ })
256258 return res , nil
257259}
258260
@@ -262,16 +264,15 @@ func (r LoggingResourceRepository) SyslogNGFlowsInNamespaceFor(ctx context.Conte
262264 return nil , err
263265 }
264266
265- sort .Slice (list .Items , func (i , j int ) bool {
266- return lessByNamespacedName (& list .Items [i ], & list .Items [j ])
267- })
268-
269267 var res []v1beta1.SyslogNGFlow
270268 for _ , i := range list .Items {
271269 if i .Spec .LoggingRef == logging .Spec .LoggingRef {
272270 res = append (res , i )
273271 }
274272 }
273+ sort .Slice (res , func (i , j int ) bool {
274+ return lessByNamespacedName (& res [i ], & res [j ])
275+ })
275276 return res , nil
276277}
277278
@@ -281,16 +282,15 @@ func (r LoggingResourceRepository) SyslogNGOutputsInNamespaceFor(ctx context.Con
281282 return nil , err
282283 }
283284
284- sort .Slice (list .Items , func (i , j int ) bool {
285- return lessByNamespacedName (& list .Items [i ], & list .Items [j ])
286- })
287-
288285 var res []v1beta1.SyslogNGOutput
289286 for _ , i := range list .Items {
290287 if i .Spec .LoggingRef == logging .Spec .LoggingRef {
291288 res = append (res , i )
292289 }
293290 }
291+ sort .Slice (res , func (i , j int ) bool {
292+ return lessByNamespacedName (& res [i ], & res [j ])
293+ })
294294 return res , nil
295295}
296296
@@ -305,16 +305,15 @@ func (r LoggingResourceRepository) NodeAgentsFor(ctx context.Context, logging v1
305305 return nil , err
306306 }
307307
308- sort .Slice (list .Items , func (i , j int ) bool {
309- return lessByNamespacedName (& list .Items [i ], & list .Items [j ])
310- })
311-
312308 var res []v1beta1.NodeAgent
313309 for _ , i := range list .Items {
314310 if i .Spec .LoggingRef == logging .Spec .LoggingRef {
315311 res = append (res , i )
316312 }
317313 }
314+ sort .Slice (res , func (i , j int ) bool {
315+ return lessByNamespacedName (& res [i ], & res [j ])
316+ })
318317 return res , nil
319318}
320319
@@ -324,16 +323,15 @@ func (r LoggingResourceRepository) FluentbitsFor(ctx context.Context, logging v1
324323 return nil , err
325324 }
326325
327- sort .Slice (list .Items , func (i , j int ) bool {
328- return lessByNamespacedName (& list .Items [i ], & list .Items [j ])
329- })
330-
331326 var res []v1beta1.FluentbitAgent
332327 for _ , i := range list .Items {
333328 if i .Spec .LoggingRef == logging .Spec .LoggingRef {
334329 res = append (res , i )
335330 }
336331 }
332+ sort .Slice (res , func (i , j int ) bool {
333+ return lessByNamespacedName (& res [i ], & res [j ])
334+ })
337335 return res , nil
338336}
339337
@@ -343,16 +341,15 @@ func (r LoggingResourceRepository) LoggingRoutesFor(ctx context.Context, logging
343341 return nil , err
344342 }
345343
346- sort .Slice (list .Items , func (i , j int ) bool {
347- return lessByNamespacedName (& list .Items [i ], & list .Items [j ])
348- })
349-
350344 var res []v1beta1.LoggingRoute
351345 for _ , i := range list .Items {
352346 if i .Spec .Source == logging .Spec .LoggingRef {
353347 res = append (res , i )
354348 }
355349 }
350+ sort .Slice (res , func (i , j int ) bool {
351+ return lessByNamespacedName (& res [i ], & res [j ])
352+ })
356353 return res , nil
357354}
358355
0 commit comments