mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-15 17:51:20 +00:00
3ff83c7bdd
* refactor: context loading and engine methods Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
18 lines
402 B
Go
18 lines
402 B
Go
package internal
|
|
|
|
import (
|
|
"context"
|
|
|
|
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
|
engineapi "github.com/kyverno/kyverno/pkg/engine/api"
|
|
)
|
|
|
|
func LoadContext(
|
|
ctx context.Context,
|
|
engine engineapi.Engine,
|
|
pContext engineapi.PolicyContext,
|
|
rule kyvernov1.Rule,
|
|
) error {
|
|
loader := engine.ContextLoader(pContext.Policy(), rule)
|
|
return loader(ctx, rule.Context, pContext.JSONContext())
|
|
}
|