Skip to content

Conversation

@Mohdcode
Copy link
Contributor

@Mohdcode Mohdcode commented May 9, 2025

Related Issue(s)

kyverno/kyverno#12085

Description

add best-practices-vpol
dir with prefix add would be converted after the generatePolicy crd release

Checklist

  • I have read the policy contribution guidelines.
  • I have added test manifests and resources covering both positive and negative tests that prove this policy works as intended.
  • I have added the artifacthub-pkg.yml file and have verified it is complete and correct.

Mohd Kamaal and others added 3 commits May 6, 2025 17:49
@Mohdcode Mohdcode marked this pull request as draft May 9, 2025 12:32
Mohd Kamaal added 3 commits May 11, 2025 23:28
Signed-off-by: Mohd Kamaal <[email protected]>
Signed-off-by: Mohd Kamaal <[email protected]>
Signed-off-by: Mohd Kamaal <[email protected]>
@Mohdcode Mohdcode marked this pull request as ready for review May 19, 2025 19:16
@Mohdcode
Copy link
Contributor Author

would be ready for review once this issue gets completed kyverno/kyverno#13089

realshuting
realshuting previously approved these changes Sep 10, 2025
@realshuting
Copy link
Member

@Mohdcode - there's an issue on CRD support:

Error: failed to run test (failed to apply policies on resource bad-flowschema (failed to map gvk to gvr flowcontrol.apiserver.k8s.io/v1beta2, Kind=FlowSchema (no matches for kind "FlowSchema" in version "flowcontrol.apiserver.k8s.io/v1beta2")

Does this CLI test run in-cluster? And there's another issue for supporting CRDs off-cluster in CLI kyverno/kyverno#13427.

@Mohdcode
Copy link
Contributor Author

Mohdcode commented Sep 10, 2025

The test fails off-cluster, but it passes on a real cluster. You're right, we need support for CRDs.
I think i should close this issue we can just cover it into crds support issue.

JimBugwadia
JimBugwadia previously approved these changes Oct 20, 2025
@JimBugwadia
Copy link
Member

@Mohdcode - can you please address the test failures so we can get this merged?

Looks like there is an API version mismatch:

Error: failed to run test (failed to apply policies on resource bad-flowschema (failed to map gvk to gvr flowcontrol.apiserver.k8s.io/v1beta2, Kind=FlowSchema (no matches for kind "FlowSchema" in version "flowcontrol.apiserver.k8s.io/v1beta2")
))

@Mohdcode
Copy link
Contributor Author

Kyverno CLI maintains a static GVK-to-GVR mapping. Because of this limitation, the CLI fails when testing resources whose API versions or kinds aren’t listed there.
Our policy relies on those specific apiVersions and resources, so this is a CLI limitation that needs to be addressed.
I tried implementing a dynamic way to fetch the API discovery data (to make the mapping automatically up-to-date) but wasn’t successful. I’d appreciate guidance or direction on how to make this discovery dynamic instead of relying on the static JSON file.

@JimBugwadia
Copy link
Member

@Mohdcode - do we want to allow passing in a mapping?

cc: @fjogeleit @eddycharly

Copy link
Contributor

@MariamFahmy98 MariamFahmy98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add the new directory to the CI so that the chainsaw tests are executed?

@Mohdcode Mohdcode dismissed stale reviews from JimBugwadia and realshuting via 32062ce November 30, 2025 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants