2022-09-07 16:01:42 +02:00
|
|
|
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 {
|
2022-10-17 13:45:57 +02:00
|
|
|
if rule.Status != response.RuleStatusPass && rule.Status != response.RuleStatusSkip {
|
2022-09-07 16:01:42 +02:00
|
|
|
msg := fmt.Sprintf("policy %s.%s: %s", er.Policy.GetName(), rule.Name, rule.Message)
|
|
|
|
warnings = append(warnings, msg)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return warnings
|
|
|
|
}
|