Skip to content

Commit

Permalink
Fix error check
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Conner <kev.conner@gmail.com>

Kubernetes-commit: e7e1fb7234264b6f0785ad9fdd29e90c5da36002
  • Loading branch information
knrc authored and k8s-publishing-bot committed Oct 21, 2024
1 parent 0b01a72 commit a69b1ea
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/admission/plugin/policy/mutating/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ func (d *dispatcher) dispatchInvocations(
}

invocationKey, invocationKeyErr := keyFor(invocation)
if invocationKeyErr != nil {
// This should never happen. It occurs if there is a programming
// error causing the Param not to be a valid object.
return nil, k8serrors.NewInternalError(invocationKeyErr)
}
if reinvokeCtx.IsReinvoke() && !policyReinvokeCtx.ShouldReinvoke(invocationKey) {
continue
}
Expand All @@ -170,12 +175,6 @@ func (d *dispatcher) dispatchInvocations(
// Mutations for a single invocation of a MutatingAdmissionPolicy are evaluated
// in order.
for mutationIndex := range invocation.Policy.Spec.Mutations {
if invocationKeyErr != nil {
// This should never happen. It occurs if there is a programming
// error causing the Param not to be a valid object.
return nil, k8serrors.NewInternalError(invocationKeyErr)
}

lastVersionedAttr = versionedAttr
if versionedAttr.VersionedObject == nil { // Do not call patchers if there is no object to patch.
continue
Expand Down

0 comments on commit a69b1ea

Please sign in to comment.