mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
fix rule type for mutate and generate rules (#10554)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
This commit is contained in:
parent
52ec560ffb
commit
68df5af40e
4 changed files with 8 additions and 8 deletions
|
@ -70,10 +70,10 @@ func (e *engine) filterRule(
|
|||
key, err := cache.MetaNamespaceKeyFunc(exception)
|
||||
if err != nil {
|
||||
logger.Error(err, "failed to compute policy exception key", "namespace", exception.GetNamespace(), "name", exception.GetName())
|
||||
return engineapi.RuleError(rule.Name, engineapi.Validation, "failed to compute exception key", err)
|
||||
return engineapi.RuleError(rule.Name, ruleType, "failed to compute exception key", err)
|
||||
} else {
|
||||
logger.V(3).Info("policy rule skipped due to policy exception", "exception", key)
|
||||
return engineapi.RuleSkip(rule.Name, engineapi.Validation, "rule skipped due to policy exception "+key).WithException(exception)
|
||||
return engineapi.RuleSkip(rule.Name, ruleType, "rule skipped due to policy exception "+key).WithException(exception)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,11 +43,11 @@ func (h mutateExistingHandler) Process(
|
|||
key, err := cache.MetaNamespaceKeyFunc(exception)
|
||||
if err != nil {
|
||||
logger.Error(err, "failed to compute policy exception key", "namespace", exception.GetNamespace(), "name", exception.GetName())
|
||||
return resource, handlers.WithError(rule, engineapi.Validation, "failed to compute exception key", err)
|
||||
return resource, handlers.WithError(rule, engineapi.Mutation, "failed to compute exception key", err)
|
||||
} else {
|
||||
logger.V(3).Info("policy rule skipped due to policy exception", "exception", key)
|
||||
return resource, handlers.WithResponses(
|
||||
engineapi.RuleSkip(rule.Name, engineapi.Validation, "rule skipped due to policy exception "+key).WithException(exception),
|
||||
engineapi.RuleSkip(rule.Name, engineapi.Mutation, "rule skipped due to policy exception "+key).WithException(exception),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,11 +74,11 @@ func (h mutateImageHandler) Process(
|
|||
key, err := cache.MetaNamespaceKeyFunc(exception)
|
||||
if err != nil {
|
||||
logger.Error(err, "failed to compute policy exception key", "namespace", exception.GetNamespace(), "name", exception.GetName())
|
||||
return resource, handlers.WithError(rule, engineapi.Validation, "failed to compute exception key", err)
|
||||
return resource, handlers.WithError(rule, engineapi.Mutation, "failed to compute exception key", err)
|
||||
} else {
|
||||
logger.V(3).Info("policy rule skipped due to policy exception", "exception", key)
|
||||
return resource, handlers.WithResponses(
|
||||
engineapi.RuleSkip(rule.Name, engineapi.Validation, "rule skipped due to policy exception "+key).WithException(exception),
|
||||
engineapi.RuleSkip(rule.Name, engineapi.Mutation, "rule skipped due to policy exception "+key).WithException(exception),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,11 +36,11 @@ func (h mutateResourceHandler) Process(
|
|||
key, err := cache.MetaNamespaceKeyFunc(exception)
|
||||
if err != nil {
|
||||
logger.Error(err, "failed to compute policy exception key", "namespace", exception.GetNamespace(), "name", exception.GetName())
|
||||
return resource, handlers.WithError(rule, engineapi.Validation, "failed to compute exception key", err)
|
||||
return resource, handlers.WithError(rule, engineapi.Mutation, "failed to compute exception key", err)
|
||||
} else {
|
||||
logger.V(3).Info("policy rule skipped due to policy exception", "exception", key)
|
||||
return resource, handlers.WithResponses(
|
||||
engineapi.RuleSkip(rule.Name, engineapi.Validation, "rule skipped due to policy exception "+key).WithException(exception),
|
||||
engineapi.RuleSkip(rule.Name, engineapi.Mutation, "rule skipped due to policy exception "+key).WithException(exception),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue