1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-09 17:37:12 +00:00
kyverno/pkg/webhooks/utils/warning.go
Charles-Edouard Brétéché f0fa50b27e
refactor: webhook block and unit tests (#4531)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-09-08 08:36:31 +00:00

20 lines
478 B
Go

package utils
import (
"fmt"
"github.com/kyverno/kyverno/pkg/engine/response"
)
func GetWarningMessages(engineResponses []*response.EngineResponse) []string {
var warnings []string
for _, er := range engineResponses {
for _, rule := range er.PolicyResponse.Rules {
if rule.Status != response.RuleStatusPass {
msg := fmt.Sprintf("policy %s.%s: %s", er.Policy.GetName(), rule.Name, rule.Message)
warnings = append(warnings, msg)
}
}
}
return warnings
}