mirror of
https://github.com/kyverno/kyverno.git
synced 2025-01-20 18:52:16 +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:
commit
745838ff26
1 changed files with 4 additions and 0 deletions
|
@ -33,6 +33,10 @@ func GetResources(policies []*v1.ClusterPolicy, resourcePaths []string, dClient
|
||||||
for _, policy := range policies {
|
for _, policy := range policies {
|
||||||
for _, rule := range policy.Spec.Rules {
|
for _, rule := range policy.Spec.Rules {
|
||||||
for _, kind := range rule.MatchResources.Kinds {
|
for _, kind := range rule.MatchResources.Kinds {
|
||||||
|
if strings.Contains(kind, "/") {
|
||||||
|
lastElement := kind[strings.LastIndex(kind, "/")+1:]
|
||||||
|
resourceTypesMap[lastElement] = true
|
||||||
|
}
|
||||||
resourceTypesMap[kind] = true
|
resourceTypesMap[kind] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue