mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
added condition for all and any while getting the resource
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
This commit is contained in:
parent
12530619ce
commit
f5887b49a7
1 changed files with 24 additions and 0 deletions
|
@ -39,6 +39,30 @@ func GetResources(policies []*v1.ClusterPolicy, resourcePaths []string, dClient
|
|||
}
|
||||
resourceTypesMap[kind] = true
|
||||
}
|
||||
|
||||
if rule.MatchResources.Any != nil {
|
||||
for _, resFilter := range rule.MatchResources.Any {
|
||||
for _, kind := range resFilter.ResourceDescription.Kinds {
|
||||
if strings.Contains(kind, "/") {
|
||||
lastElement := kind[strings.LastIndex(kind, "/")+1:]
|
||||
resourceTypesMap[lastElement] = true
|
||||
}
|
||||
resourceTypesMap[kind] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if rule.MatchResources.All != nil {
|
||||
for _, resFilter := range rule.MatchResources.All {
|
||||
for _, kind := range resFilter.ResourceDescription.Kinds {
|
||||
if strings.Contains(kind, "/") {
|
||||
lastElement := kind[strings.LastIndex(kind, "/")+1:]
|
||||
resourceTypesMap[lastElement] = true
|
||||
}
|
||||
resourceTypesMap[kind] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue