fix: handle namespace match with namespaceSelector
Explanation
This PR fixes the case where a generating policy matches namspaces and at the same time, namespaceSelector is used. In that case, we should get the labels directly from the namespace.
Related issue
Closes #14317
Milestone of this PR
Documentation (required for features)
My PR contains new or altered behavior to Kyverno.
-
I have sent the draft PR to add or update the documentation and the link is:
What type of PR is this
Proposed Changes
Proof Manifests
Checklist
-
I have read the contributing guidelines. -
I have read the PR documentation guide and followed the process including adding proof manifests to this PR. -
This is a bug fix and I have added unit tests that prove my fix is effective. -
This is a feature and I have added CLI tests that are applicable. -
My PR needs to be cherry picked to a specific release branch which is . -
My PR contains new or altered behavior to Kyverno and -
CLI support should be added and my PR doesn't contain that functionality.
-