This is more of a question, then a bug; but it's a bit of both...
I am looking at this line. Notice the logic here:
-
if there is a namespace defined, use it via listNamespacedSecret.
-
if there is not, read all namespaces via listSecretForAllNamespaces.
This is an interesting choice. We can obviously read the wrong thing easily and expose data from a secret that users never intended for (this is also easily reproducible).
On the other hand, if we take a step back, we only call listSecretForAllNamespaces because we think the namespace might be null. The future of this bug and discussion should really happen after this one.
For the time being, I am leaving it here as a place-holder and will get back to it.