Commit 11ad9a1
committed
aws/eni: Fix max results cutoff in
`GetDetachedNetworkInterfaces` has a `maxResults` parameter which is set from [`GarbageCollectionParams.MaxPerInterval`](https://github.com/cilium/cilium/blob/6d1aa98670fe046fe3ac5a2b4167cfece416603e/pkg/aws/eni/eni_gc.go#L29-L31). Which in turn is set from the [`ENIGarbageCollectionMaxPerInterval`](https://github.com/cilium/cilium/blob/6d1aa98670fe046fe3ac5a2b4167cfece416603e/pkg/defaults/defaults.go#L391-L393) const to 25.
The goal of this parameter is to cap the length of the returned `result`. But with the way it is currently used, `GetDetachedNetworkInterfaces` can actually return a `result` of length up to 49. This is because for each page, we append all ENIs from `output.NetworkInterfaces` to `result` and only after that check for the length of `result`. so if at the beginning of a page iteration `result` is a slice of length 24 and the new page has 25 ENIs, then they will all be appended to `result` before the length check will `break` out of the paginator loop as `result` will be of length 24+25=49.
Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>GetDetachedNetworkInterfaces
1 parent c1bceb7 commit 11ad9a1
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
233 | 236 | | |
234 | 237 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
0 commit comments