mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
c46cb06d95
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
23 lines
708 B
Go
23 lines
708 B
Go
package engine
|
|
|
|
import (
|
|
"github.com/go-logr/logr"
|
|
"github.com/kyverno/kyverno/pkg/autogen"
|
|
engineapi "github.com/kyverno/kyverno/pkg/engine/api"
|
|
"github.com/kyverno/kyverno/pkg/engine/internal"
|
|
)
|
|
|
|
// GenerateResponse checks for validity of generate rule on the resource
|
|
func (e *engine) generateResponse(
|
|
logger logr.Logger,
|
|
policyContext engineapi.PolicyContext,
|
|
) engineapi.PolicyResponse {
|
|
resp := engineapi.NewPolicyResponse()
|
|
for _, rule := range autogen.ComputeRules(policyContext.Policy(), "") {
|
|
logger := internal.LoggerWithRule(logger, rule)
|
|
if ruleResp := e.filterRule(rule, logger, policyContext); ruleResp != nil {
|
|
resp.Rules = append(resp.Rules, *ruleResp)
|
|
}
|
|
}
|
|
return resp
|
|
}
|