mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 07:57:07 +00:00
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: shuting <shuting@nirmata.com>
20 lines
520 B
Go
20 lines
520 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 && rule.Status != response.RuleStatusSkip {
|
|
msg := fmt.Sprintf("policy %s.%s: %s", er.Policy.GetName(), rule.Name, rule.Message)
|
|
warnings = append(warnings, msg)
|
|
}
|
|
}
|
|
}
|
|
return warnings
|
|
}
|