mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
bb06901119
* fix mutate preprocessing for anchors Signed-off-by: Jim Bugwadia <jim@nirmata.com> * make fmt Signed-off-by: Jim Bugwadia <jim@nirmata.com> Co-authored-by: shuting <shutting06@gmail.com>
20 lines
649 B
Go
20 lines
649 B
Go
package mutate
|
|
|
|
import (
|
|
commonAnchors "github.com/kyverno/kyverno/pkg/engine/anchor"
|
|
)
|
|
|
|
// getAnchorAndElementsFromMap gets the condition anchor map and resource map without anchor
|
|
func getAnchorAndElementsFromMap(anchorsMap map[string]interface{}) (map[string]interface{}, map[string]interface{}) {
|
|
anchors := make(map[string]interface{})
|
|
elementsWithoutanchor := make(map[string]interface{})
|
|
for key, value := range anchorsMap {
|
|
if commonAnchors.IsConditionAnchor(key) {
|
|
anchors[key] = value
|
|
} else if !commonAnchors.IsAddIfNotPresentAnchor(key) {
|
|
elementsWithoutanchor[key] = value
|
|
}
|
|
}
|
|
|
|
return anchors, elementsWithoutanchor
|
|
}
|