Skip to content

Commit

Permalink
Merge pull request #128618 from knrc/error-check-fix
Browse files Browse the repository at this point in the history
Fix error check

Kubernetes-commit: e1e92bc40373fa01be05c64e1aee3bdee5d74040
  • Loading branch information
k8s-publishing-bot committed Nov 8, 2024
2 parents 0b01a72 + a69b1ea commit b8357e7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ require (
gopkg.in/evanphx/json-patch.v4 v4.12.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/square/go-jose.v2 v2.6.0
k8s.io/api v0.0.0-20241108114314-0869e9d258da
k8s.io/api v0.0.0-20241108114315-3f43b5a94246
k8s.io/apimachinery v0.0.0-20241108022104-96b97de8d6ba
k8s.io/client-go v0.0.0-20241108115824-fcfb2ba0165b
k8s.io/client-go v0.0.0-20241108115827-ec126553e25c
k8s.io/component-base v0.0.0-20241108123300-35b74786c418
k8s.io/klog/v2 v2.130.1
k8s.io/kms v0.0.0-20241107031913-7a7a59ea9c74
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,12 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.0.0-20241108114314-0869e9d258da h1:0IBD100isGkMfDCeLrXtOqsmKKeiy3Uj85sI50Aff7U=
k8s.io/api v0.0.0-20241108114314-0869e9d258da/go.mod h1:jw6pQTESH9mdZL2vOK3twojvpPxipl5TpLZpPyl5ZYU=
k8s.io/api v0.0.0-20241108114315-3f43b5a94246 h1:lTiwDILcPkCelpoYPkQ0jt8tmY0/s6Q9sM2mq2qie8g=
k8s.io/api v0.0.0-20241108114315-3f43b5a94246/go.mod h1:jw6pQTESH9mdZL2vOK3twojvpPxipl5TpLZpPyl5ZYU=
k8s.io/apimachinery v0.0.0-20241108022104-96b97de8d6ba h1:ghB5Iygt6Ge8UyIwW7C1kJx4kP7AUTCL9Qg6GCsUUOY=
k8s.io/apimachinery v0.0.0-20241108022104-96b97de8d6ba/go.mod h1:HqhdaJUgQqky29T1V0o2yFkt/pZqLFIDyn9Zi/8rxoY=
k8s.io/client-go v0.0.0-20241108115824-fcfb2ba0165b h1:lS1fax+8b6ixc5eVrH2wdX0ZsJPL3aUgi5/S4WlESgI=
k8s.io/client-go v0.0.0-20241108115824-fcfb2ba0165b/go.mod h1:luyD5FCao3u3FeN1L5HS36g83otuzs6cdlUNsYdQ6dw=
k8s.io/client-go v0.0.0-20241108115827-ec126553e25c h1:oFkwLbL3wiQ1J3kiXB3e8RekXFhWB4G3jtWxX4qz/fk=
k8s.io/client-go v0.0.0-20241108115827-ec126553e25c/go.mod h1:qdg0yiHKZF4DimKIPqdu9N9y1VLkHDn8Jtbsblkf6O0=
k8s.io/component-base v0.0.0-20241108123300-35b74786c418 h1:QwfJ5xnagesBw1NsW9GQ1egcdSfNsWOyPb/2RkdZUic=
k8s.io/component-base v0.0.0-20241108123300-35b74786c418/go.mod h1:xoGVbsAaeyCMTUz4Ck1TA3Tz7SSE9Suryx+nCTkuChM=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
Expand Down
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 b8357e7

Please sign in to comment.