1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

Merge pull request #2364 from NoSkillGirl/2363/gvk_bug_cli

Fix | Support gvk in CLI for policies applied on cluster
This commit is contained in:
Pooja Singh 2021-09-06 19:02:31 +05:30 committed by GitHub
commit 745838ff26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,6 +33,10 @@ func GetResources(policies []*v1.ClusterPolicy, resourcePaths []string, dClient
for _, policy := range policies {
for _, rule := range policy.Spec.Rules {
for _, kind := range rule.MatchResources.Kinds {
if strings.Contains(kind, "/") {
lastElement := kind[strings.LastIndex(kind, "/")+1:]
resourceTypesMap[lastElement] = true
}
resourceTypesMap[kind] = true
}
}