mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-16 12:40:43 +00:00
fix: Check for the client being nil before applying a mutation (#10726)
Signed-off-by: aerosouund <aerosound161@gmail.com> Co-authored-by: shuting <shuting@nirmata.com>
This commit is contained in:
parent
8109f2194e
commit
f618717f75
1 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,7 @@ package engine
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
|
@ -36,6 +37,9 @@ func (e *engine) mutate(
|
|||
return nil, nil
|
||||
}
|
||||
if !policyContext.AdmissionOperation() && rule.HasMutateExisting() {
|
||||
if e.client == nil {
|
||||
return nil, fmt.Errorf("Handler factory requires a client but a nil client was passed, likely due to a bug or unsupported operation.")
|
||||
}
|
||||
return mutation.NewMutateExistingHandler(e.client)
|
||||
}
|
||||
return mutation.NewMutateResourceHandler()
|
||||
|
|
Loading…
Add table
Reference in a new issue