mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
Enable image substitution in the background mode
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
This commit is contained in:
parent
0776b438d3
commit
85dde7e960
2 changed files with 5 additions and 1 deletions
|
@ -50,6 +50,10 @@ func applyPolicy(policy kyverno.ClusterPolicy, resource unstructured.Unstructure
|
||||||
logger.Error(err, "failed to add namespace to ctx")
|
logger.Error(err, "failed to add namespace to ctx")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := ctx.AddImageInfo(&resource); err != nil {
|
||||||
|
logger.Error(err, "unable to add image info to variables context")
|
||||||
|
}
|
||||||
|
|
||||||
engineResponseMutation, err = mutation(policy, resource, logger, resCache, ctx, namespaceLabels)
|
engineResponseMutation, err = mutation(policy, resource, logger, resCache, ctx, namespaceLabels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err, "failed to process mutation rule")
|
logger.Error(err, "failed to process mutation rule")
|
||||||
|
|
|
@ -24,7 +24,7 @@ func ContainsVariablesOtherThanObject(policy kyverno.ClusterPolicy) error {
|
||||||
return fmt.Errorf("invalid variable used at path: spec/rules[%d]/exclude/%s", idx, path)
|
return fmt.Errorf("invalid variable used at path: spec/rules[%d]/exclude/%s", idx, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
filterVars := []string{"request.object", "request.namespace"}
|
filterVars := []string{"request.object", "request.namespace", "images"}
|
||||||
ctx := context.NewContext(filterVars...)
|
ctx := context.NewContext(filterVars...)
|
||||||
|
|
||||||
for _, contextEntry := range rule.Context {
|
for _, contextEntry := range rule.Context {
|
||||||
|
|
Loading…
Add table
Reference in a new issue