rebase: bump sigs.k8s.io/controller-runtime

Bumps the k8s-dependencies group with 1 update: [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime).


Updates `sigs.k8s.io/controller-runtime` from 0.20.1 to 0.20.2
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.20.1...v0.20.2)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2025-02-17 20:46:28 +00:00 committed by mergify[bot]
parent b05d467679
commit 280002f0cc
7 changed files with 92 additions and 90 deletions

6
go.mod
View File

@ -44,7 +44,7 @@ require (
k8s.io/mount-utils v0.32.2 k8s.io/mount-utils v0.32.2
k8s.io/pod-security-admission v0.32.2 k8s.io/pod-security-admission v0.32.2
k8s.io/utils v0.0.0-20241210054802-24370beab758 k8s.io/utils v0.0.0-20241210054802-24370beab758
sigs.k8s.io/controller-runtime v0.20.1 sigs.k8s.io/controller-runtime v0.20.2
) )
require ( require (
@ -88,7 +88,7 @@ require (
github.com/docker/go-units v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/euank/go-kmsg-parser v2.0.0+incompatible // indirect github.com/euank/go-kmsg-parser v2.0.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/evanphx/json-patch/v5 v5.9.11 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect
@ -192,7 +192,7 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.32.0 // indirect k8s.io/apiextensions-apiserver v0.32.1 // indirect
k8s.io/apiserver v0.32.2 // indirect k8s.io/apiserver v0.32.2 // indirect
k8s.io/component-base v0.32.2 // indirect k8s.io/component-base v0.32.2 // indirect
k8s.io/component-helpers v0.32.2 // indirect k8s.io/component-helpers v0.32.2 // indirect

8
go.sum
View File

@ -1582,8 +1582,8 @@ github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMi
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U=
github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU=
github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
@ -3676,8 +3676,8 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
sigs.k8s.io/controller-runtime v0.2.2/go.mod h1:9dyohw3ZtoXQuV1e766PHUn+cmrRCIcBh6XIMFNMZ+I= sigs.k8s.io/controller-runtime v0.2.2/go.mod h1:9dyohw3ZtoXQuV1e766PHUn+cmrRCIcBh6XIMFNMZ+I=
sigs.k8s.io/controller-runtime v0.20.1 h1:JbGMAG/X94NeM3xvjenVUaBjy6Ui4Ogd/J5ZtjZnHaE= sigs.k8s.io/controller-runtime v0.20.2 h1:/439OZVxoEc02psi1h4QO3bHzTgu49bb347Xp4gW1pc=
sigs.k8s.io/controller-runtime v0.20.1/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU= sigs.k8s.io/controller-runtime v0.20.2/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE=

View File

@ -103,8 +103,8 @@ func pruneAryNulls(ary *partialArray, options *ApplyOptions) *partialArray {
return ary return ary
} }
var errBadJSONDoc = fmt.Errorf("Invalid JSON Document") var ErrBadJSONDoc = fmt.Errorf("Invalid JSON Document")
var errBadJSONPatch = fmt.Errorf("Invalid JSON Patch") var ErrBadJSONPatch = fmt.Errorf("Invalid JSON Patch")
var errBadMergeTypes = fmt.Errorf("Mismatched JSON Documents") var errBadMergeTypes = fmt.Errorf("Mismatched JSON Documents")
// MergeMergePatches merges two merge patches together, such that // MergeMergePatches merges two merge patches together, such that
@ -121,11 +121,11 @@ func MergePatch(docData, patchData []byte) ([]byte, error) {
func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) {
if !json.Valid(docData) { if !json.Valid(docData) {
return nil, errBadJSONDoc return nil, ErrBadJSONDoc
} }
if !json.Valid(patchData) { if !json.Valid(patchData) {
return nil, errBadJSONPatch return nil, ErrBadJSONPatch
} }
options := NewApplyOptions() options := NewApplyOptions()
@ -143,7 +143,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) {
patchErr := patch.UnmarshalJSON(patchData) patchErr := patch.UnmarshalJSON(patchData)
if isSyntaxError(docErr) { if isSyntaxError(docErr) {
return nil, errBadJSONDoc return nil, ErrBadJSONDoc
} }
if isSyntaxError(patchErr) { if isSyntaxError(patchErr) {
@ -151,7 +151,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) {
} }
if docErr == nil && doc.obj == nil { if docErr == nil && doc.obj == nil {
return nil, errBadJSONDoc return nil, ErrBadJSONDoc
} }
if patchErr == nil && patch.obj == nil { if patchErr == nil && patch.obj == nil {
@ -175,7 +175,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) {
if json.Valid(patchData) { if json.Valid(patchData) {
return patchData, nil return patchData, nil
} }
return nil, errBadJSONPatch return nil, ErrBadJSONPatch
} }
pruneAryNulls(patchAry, options) pruneAryNulls(patchAry, options)
@ -183,7 +183,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) {
out, patchErr := json.Marshal(patchAry.nodes) out, patchErr := json.Marshal(patchAry.nodes)
if patchErr != nil { if patchErr != nil {
return nil, errBadJSONPatch return nil, ErrBadJSONPatch
} }
return out, nil return out, nil
@ -256,12 +256,12 @@ func createObjectMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) {
err := unmarshal(originalJSON, &originalDoc) err := unmarshal(originalJSON, &originalDoc)
if err != nil { if err != nil {
return nil, errBadJSONDoc return nil, ErrBadJSONDoc
} }
err = unmarshal(modifiedJSON, &modifiedDoc) err = unmarshal(modifiedJSON, &modifiedDoc)
if err != nil { if err != nil {
return nil, errBadJSONDoc return nil, ErrBadJSONDoc
} }
dest, err := getDiff(originalDoc, modifiedDoc) dest, err := getDiff(originalDoc, modifiedDoc)
@ -286,17 +286,17 @@ func createArrayMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) {
err := unmarshal(originalJSON, &originalDocs) err := unmarshal(originalJSON, &originalDocs)
if err != nil { if err != nil {
return nil, errBadJSONDoc return nil, ErrBadJSONDoc
} }
err = unmarshal(modifiedJSON, &modifiedDocs) err = unmarshal(modifiedJSON, &modifiedDocs)
if err != nil { if err != nil {
return nil, errBadJSONDoc return nil, ErrBadJSONDoc
} }
total := len(originalDocs) total := len(originalDocs)
if len(modifiedDocs) != total { if len(modifiedDocs) != total {
return nil, errBadJSONDoc return nil, ErrBadJSONDoc
} }
result := []json.RawMessage{} result := []json.RawMessage{}

View File

@ -2,13 +2,13 @@ package jsonpatch
import ( import (
"bytes" "bytes"
"errors"
"fmt" "fmt"
"strconv" "strconv"
"strings" "strings"
"unicode" "unicode"
"github.com/evanphx/json-patch/v5/internal/json" "github.com/evanphx/json-patch/v5/internal/json"
"github.com/pkg/errors"
) )
const ( const (
@ -461,7 +461,7 @@ func (o Operation) Path() (string, error) {
return op, nil return op, nil
} }
return "unknown", errors.Wrapf(ErrMissing, "operation missing path field") return "unknown", fmt.Errorf("operation missing path field: %w", ErrMissing)
} }
// From reads the "from" field of the Operation. // From reads the "from" field of the Operation.
@ -478,7 +478,7 @@ func (o Operation) From() (string, error) {
return op, nil return op, nil
} }
return "unknown", errors.Wrapf(ErrMissing, "operation, missing from field") return "unknown", fmt.Errorf("operation, missing from field: %w", ErrMissing)
} }
func (o Operation) value() *lazyNode { func (o Operation) value() *lazyNode {
@ -511,7 +511,7 @@ func (o Operation) ValueInterface() (interface{}, error) {
return v, nil return v, nil
} }
return nil, errors.Wrapf(ErrMissing, "operation, missing value field") return nil, fmt.Errorf("operation, missing value field: %w", ErrMissing)
} }
func isArray(buf []byte) bool { func isArray(buf []byte) bool {
@ -610,7 +610,7 @@ func (d *partialDoc) get(key string, options *ApplyOptions) (*lazyNode, error) {
v, ok := d.obj[key] v, ok := d.obj[key]
if !ok { if !ok {
return v, errors.Wrapf(ErrMissing, "unable to get nonexistent key: %s", key) return v, fmt.Errorf("unable to get nonexistent key: %s: %w", key, ErrMissing)
} }
return v, nil return v, nil
} }
@ -625,7 +625,7 @@ func (d *partialDoc) remove(key string, options *ApplyOptions) error {
if options.AllowMissingPathOnRemove { if options.AllowMissingPathOnRemove {
return nil return nil
} }
return errors.Wrapf(ErrMissing, "unable to remove nonexistent key: %s", key) return fmt.Errorf("unable to remove nonexistent key: %s: %w", key, ErrMissing)
} }
idx := -1 idx := -1
for i, k := range d.keys { for i, k := range d.keys {
@ -649,10 +649,10 @@ func (d *partialArray) set(key string, val *lazyNode, options *ApplyOptions) err
if idx < 0 { if idx < 0 {
if !options.SupportNegativeIndices { if !options.SupportNegativeIndices {
return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex)
} }
if idx < -len(d.nodes) { if idx < -len(d.nodes) {
return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex)
} }
idx += len(d.nodes) idx += len(d.nodes)
} }
@ -669,7 +669,7 @@ func (d *partialArray) add(key string, val *lazyNode, options *ApplyOptions) err
idx, err := strconv.Atoi(key) idx, err := strconv.Atoi(key)
if err != nil { if err != nil {
return errors.Wrapf(err, "value was not a proper array index: '%s'", key) return fmt.Errorf("value was not a proper array index: '%s': %w", key, err)
} }
sz := len(d.nodes) + 1 sz := len(d.nodes) + 1
@ -679,15 +679,15 @@ func (d *partialArray) add(key string, val *lazyNode, options *ApplyOptions) err
cur := d cur := d
if idx >= len(ary) { if idx >= len(ary) {
return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex)
} }
if idx < 0 { if idx < 0 {
if !options.SupportNegativeIndices { if !options.SupportNegativeIndices {
return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex)
} }
if idx < -len(ary) { if idx < -len(ary) {
return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex)
} }
idx += len(ary) idx += len(ary)
} }
@ -713,16 +713,16 @@ func (d *partialArray) get(key string, options *ApplyOptions) (*lazyNode, error)
if idx < 0 { if idx < 0 {
if !options.SupportNegativeIndices { if !options.SupportNegativeIndices {
return nil, errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) return nil, fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex)
} }
if idx < -len(d.nodes) { if idx < -len(d.nodes) {
return nil, errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) return nil, fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex)
} }
idx += len(d.nodes) idx += len(d.nodes)
} }
if idx >= len(d.nodes) { if idx >= len(d.nodes) {
return nil, errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) return nil, fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex)
} }
return d.nodes[idx], nil return d.nodes[idx], nil
@ -740,18 +740,18 @@ func (d *partialArray) remove(key string, options *ApplyOptions) error {
if options.AllowMissingPathOnRemove { if options.AllowMissingPathOnRemove {
return nil return nil
} }
return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex)
} }
if idx < 0 { if idx < 0 {
if !options.SupportNegativeIndices { if !options.SupportNegativeIndices {
return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex)
} }
if idx < -len(cur.nodes) { if idx < -len(cur.nodes) {
if options.AllowMissingPathOnRemove { if options.AllowMissingPathOnRemove {
return nil return nil
} }
return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex)
} }
idx += len(cur.nodes) idx += len(cur.nodes)
} }
@ -768,7 +768,7 @@ func (d *partialArray) remove(key string, options *ApplyOptions) error {
func (p Patch) add(doc *container, op Operation, options *ApplyOptions) error { func (p Patch) add(doc *container, op Operation, options *ApplyOptions) error {
path, err := op.Path() path, err := op.Path()
if err != nil { if err != nil {
return errors.Wrapf(ErrMissing, "add operation failed to decode path") return fmt.Errorf("add operation failed to decode path: %w", ErrMissing)
} }
// special case, adding to empty means replacing the container with the value given // special case, adding to empty means replacing the container with the value given
@ -809,12 +809,12 @@ func (p Patch) add(doc *container, op Operation, options *ApplyOptions) error {
con, key := findObject(doc, path, options) con, key := findObject(doc, path, options)
if con == nil { if con == nil {
return errors.Wrapf(ErrMissing, "add operation does not apply: doc is missing path: \"%s\"", path) return fmt.Errorf("add operation does not apply: doc is missing path: \"%s\": %w", path, ErrMissing)
} }
err = con.add(key, op.value(), options) err = con.add(key, op.value(), options)
if err != nil { if err != nil {
return errors.Wrapf(err, "error in add for path: '%s'", path) return fmt.Errorf("error in add for path: '%s': %w", path, err)
} }
return nil return nil
@ -867,11 +867,11 @@ func ensurePathExists(pd *container, path string, options *ApplyOptions) error {
if arrIndex < 0 { if arrIndex < 0 {
if !options.SupportNegativeIndices { if !options.SupportNegativeIndices {
return errors.Wrapf(ErrInvalidIndex, "Unable to ensure path for invalid index: %d", arrIndex) return fmt.Errorf("Unable to ensure path for invalid index: %d: %w", arrIndex, ErrInvalidIndex)
} }
if arrIndex < -1 { if arrIndex < -1 {
return errors.Wrapf(ErrInvalidIndex, "Unable to ensure path for negative index other than -1: %d", arrIndex) return fmt.Errorf("Unable to ensure path for negative index other than -1: %d: %w", arrIndex, ErrInvalidIndex)
} }
arrIndex = 0 arrIndex = 0
@ -918,11 +918,11 @@ func validateOperation(op Operation) error {
switch op.Kind() { switch op.Kind() {
case "add", "replace": case "add", "replace":
if _, err := op.ValueInterface(); err != nil { if _, err := op.ValueInterface(); err != nil {
return errors.Wrapf(err, "failed to decode 'value'") return fmt.Errorf("failed to decode 'value': %w", err)
} }
case "move", "copy": case "move", "copy":
if _, err := op.From(); err != nil { if _, err := op.From(); err != nil {
return errors.Wrapf(err, "failed to decode 'from'") return fmt.Errorf("failed to decode 'from': %w", err)
} }
case "remove", "test": case "remove", "test":
default: default:
@ -930,7 +930,7 @@ func validateOperation(op Operation) error {
} }
if _, err := op.Path(); err != nil { if _, err := op.Path(); err != nil {
return errors.Wrapf(err, "failed to decode 'path'") return fmt.Errorf("failed to decode 'path': %w", err)
} }
return nil return nil
@ -941,10 +941,10 @@ func validatePatch(p Patch) error {
if err := validateOperation(op); err != nil { if err := validateOperation(op); err != nil {
opData, infoErr := json.Marshal(op) opData, infoErr := json.Marshal(op)
if infoErr != nil { if infoErr != nil {
return errors.Wrapf(err, "invalid operation") return fmt.Errorf("invalid operation: %w", err)
} }
return errors.Wrapf(err, "invalid operation %s", opData) return fmt.Errorf("invalid operation %s: %w", opData, err)
} }
} }
@ -954,7 +954,7 @@ func validatePatch(p Patch) error {
func (p Patch) remove(doc *container, op Operation, options *ApplyOptions) error { func (p Patch) remove(doc *container, op Operation, options *ApplyOptions) error {
path, err := op.Path() path, err := op.Path()
if err != nil { if err != nil {
return errors.Wrapf(ErrMissing, "remove operation failed to decode path") return fmt.Errorf("remove operation failed to decode path: %w", ErrMissing)
} }
con, key := findObject(doc, path, options) con, key := findObject(doc, path, options)
@ -963,12 +963,12 @@ func (p Patch) remove(doc *container, op Operation, options *ApplyOptions) error
if options.AllowMissingPathOnRemove { if options.AllowMissingPathOnRemove {
return nil return nil
} }
return errors.Wrapf(ErrMissing, "remove operation does not apply: doc is missing path: \"%s\"", path) return fmt.Errorf("remove operation does not apply: doc is missing path: \"%s\": %w", path, ErrMissing)
} }
err = con.remove(key, options) err = con.remove(key, options)
if err != nil { if err != nil {
return errors.Wrapf(err, "error in remove for path: '%s'", path) return fmt.Errorf("error in remove for path: '%s': %w", path, err)
} }
return nil return nil
@ -977,7 +977,7 @@ func (p Patch) remove(doc *container, op Operation, options *ApplyOptions) error
func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) error { func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) error {
path, err := op.Path() path, err := op.Path()
if err != nil { if err != nil {
return errors.Wrapf(err, "replace operation failed to decode path") return fmt.Errorf("replace operation failed to decode path: %w", err)
} }
if path == "" { if path == "" {
@ -986,7 +986,7 @@ func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) erro
if val.which == eRaw { if val.which == eRaw {
if !val.tryDoc() { if !val.tryDoc() {
if !val.tryAry() { if !val.tryAry() {
return errors.Wrapf(err, "replace operation value must be object or array") return fmt.Errorf("replace operation value must be object or array: %w", err)
} }
} else { } else {
val.doc.opts = options val.doc.opts = options
@ -999,7 +999,7 @@ func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) erro
case eDoc: case eDoc:
*doc = val.doc *doc = val.doc
case eRaw: case eRaw:
return errors.Wrapf(err, "replace operation hit impossible case") return fmt.Errorf("replace operation hit impossible case: %w", err)
} }
return nil return nil
@ -1008,17 +1008,17 @@ func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) erro
con, key := findObject(doc, path, options) con, key := findObject(doc, path, options)
if con == nil { if con == nil {
return errors.Wrapf(ErrMissing, "replace operation does not apply: doc is missing path: %s", path) return fmt.Errorf("replace operation does not apply: doc is missing path: %s: %w", path, ErrMissing)
} }
_, ok := con.get(key, options) _, ok := con.get(key, options)
if ok != nil { if ok != nil {
return errors.Wrapf(ErrMissing, "replace operation does not apply: doc is missing key: %s", path) return fmt.Errorf("replace operation does not apply: doc is missing key: %s: %w", path, ErrMissing)
} }
err = con.set(key, op.value(), options) err = con.set(key, op.value(), options)
if err != nil { if err != nil {
return errors.Wrapf(err, "error in remove for path: '%s'", path) return fmt.Errorf("error in remove for path: '%s': %w", path, err)
} }
return nil return nil
@ -1027,43 +1027,43 @@ func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) erro
func (p Patch) move(doc *container, op Operation, options *ApplyOptions) error { func (p Patch) move(doc *container, op Operation, options *ApplyOptions) error {
from, err := op.From() from, err := op.From()
if err != nil { if err != nil {
return errors.Wrapf(err, "move operation failed to decode from") return fmt.Errorf("move operation failed to decode from: %w", err)
} }
if from == "" { if from == "" {
return errors.Wrapf(ErrInvalid, "unable to move entire document to another path") return fmt.Errorf("unable to move entire document to another path: %w", ErrInvalid)
} }
con, key := findObject(doc, from, options) con, key := findObject(doc, from, options)
if con == nil { if con == nil {
return errors.Wrapf(ErrMissing, "move operation does not apply: doc is missing from path: %s", from) return fmt.Errorf("move operation does not apply: doc is missing from path: %s: %w", from, ErrMissing)
} }
val, err := con.get(key, options) val, err := con.get(key, options)
if err != nil { if err != nil {
return errors.Wrapf(err, "error in move for path: '%s'", key) return fmt.Errorf("error in move for path: '%s': %w", key, err)
} }
err = con.remove(key, options) err = con.remove(key, options)
if err != nil { if err != nil {
return errors.Wrapf(err, "error in move for path: '%s'", key) return fmt.Errorf("error in move for path: '%s': %w", key, err)
} }
path, err := op.Path() path, err := op.Path()
if err != nil { if err != nil {
return errors.Wrapf(err, "move operation failed to decode path") return fmt.Errorf("move operation failed to decode path: %w", err)
} }
con, key = findObject(doc, path, options) con, key = findObject(doc, path, options)
if con == nil { if con == nil {
return errors.Wrapf(ErrMissing, "move operation does not apply: doc is missing destination path: %s", path) return fmt.Errorf("move operation does not apply: doc is missing destination path: %s: %w", path, ErrMissing)
} }
err = con.add(key, val, options) err = con.add(key, val, options)
if err != nil { if err != nil {
return errors.Wrapf(err, "error in move for path: '%s'", path) return fmt.Errorf("error in move for path: '%s': %w", path, err)
} }
return nil return nil
@ -1072,7 +1072,7 @@ func (p Patch) move(doc *container, op Operation, options *ApplyOptions) error {
func (p Patch) test(doc *container, op Operation, options *ApplyOptions) error { func (p Patch) test(doc *container, op Operation, options *ApplyOptions) error {
path, err := op.Path() path, err := op.Path()
if err != nil { if err != nil {
return errors.Wrapf(err, "test operation failed to decode path") return fmt.Errorf("test operation failed to decode path: %w", err)
} }
if path == "" { if path == "" {
@ -1091,18 +1091,18 @@ func (p Patch) test(doc *container, op Operation, options *ApplyOptions) error {
return nil return nil
} }
return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) return fmt.Errorf("testing value %s failed: %w", path, ErrTestFailed)
} }
con, key := findObject(doc, path, options) con, key := findObject(doc, path, options)
if con == nil { if con == nil {
return errors.Wrapf(ErrMissing, "test operation does not apply: is missing path: %s", path) return fmt.Errorf("test operation does not apply: is missing path: %s: %w", path, ErrMissing)
} }
val, err := con.get(key, options) val, err := con.get(key, options)
if err != nil && errors.Cause(err) != ErrMissing { if err != nil && errors.Unwrap(err) != ErrMissing {
return errors.Wrapf(err, "error in test for path: '%s'", path) return fmt.Errorf("error in test for path: '%s': %w", path, err)
} }
ov := op.value() ov := op.value()
@ -1111,49 +1111,49 @@ func (p Patch) test(doc *container, op Operation, options *ApplyOptions) error {
if ov.isNull() { if ov.isNull() {
return nil return nil
} }
return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) return fmt.Errorf("testing value %s failed: %w", path, ErrTestFailed)
} else if ov.isNull() { } else if ov.isNull() {
return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) return fmt.Errorf("testing value %s failed: %w", path, ErrTestFailed)
} }
if val.equal(op.value()) { if val.equal(op.value()) {
return nil return nil
} }
return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) return fmt.Errorf("testing value %s failed: %w", path, ErrTestFailed)
} }
func (p Patch) copy(doc *container, op Operation, accumulatedCopySize *int64, options *ApplyOptions) error { func (p Patch) copy(doc *container, op Operation, accumulatedCopySize *int64, options *ApplyOptions) error {
from, err := op.From() from, err := op.From()
if err != nil { if err != nil {
return errors.Wrapf(err, "copy operation failed to decode from") return fmt.Errorf("copy operation failed to decode from: %w", err)
} }
con, key := findObject(doc, from, options) con, key := findObject(doc, from, options)
if con == nil { if con == nil {
return errors.Wrapf(ErrMissing, "copy operation does not apply: doc is missing from path: \"%s\"", from) return fmt.Errorf("copy operation does not apply: doc is missing from path: \"%s\": %w", from, ErrMissing)
} }
val, err := con.get(key, options) val, err := con.get(key, options)
if err != nil { if err != nil {
return errors.Wrapf(err, "error in copy for from: '%s'", from) return fmt.Errorf("error in copy for from: '%s': %w", from, err)
} }
path, err := op.Path() path, err := op.Path()
if err != nil { if err != nil {
return errors.Wrapf(ErrMissing, "copy operation failed to decode path") return fmt.Errorf("copy operation failed to decode path: %w", ErrMissing)
} }
con, key = findObject(doc, path, options) con, key = findObject(doc, path, options)
if con == nil { if con == nil {
return errors.Wrapf(ErrMissing, "copy operation does not apply: doc is missing destination path: %s", path) return fmt.Errorf("copy operation does not apply: doc is missing destination path: %s: %w", path, ErrMissing)
} }
valCopy, sz, err := deepCopy(val, options) valCopy, sz, err := deepCopy(val, options)
if err != nil { if err != nil {
return errors.Wrapf(err, "error while performing deep copy") return fmt.Errorf("error while performing deep copy: %w", err)
} }
(*accumulatedCopySize) += int64(sz) (*accumulatedCopySize) += int64(sz)
@ -1163,7 +1163,7 @@ func (p Patch) copy(doc *container, op Operation, accumulatedCopySize *int64, op
err = con.add(key, valCopy, options) err = con.add(key, valCopy, options)
if err != nil { if err != nil {
return errors.Wrapf(err, "error while adding value during copy") return fmt.Errorf("error while adding value during copy: %w", err)
} }
return nil return nil

6
vendor/modules.txt vendored
View File

@ -295,7 +295,7 @@ github.com/emicklei/go-restful/v3/log
# github.com/euank/go-kmsg-parser v2.0.0+incompatible # github.com/euank/go-kmsg-parser v2.0.0+incompatible
## explicit ## explicit
github.com/euank/go-kmsg-parser/kmsgparser github.com/euank/go-kmsg-parser/kmsgparser
# github.com/evanphx/json-patch/v5 v5.9.0 # github.com/evanphx/json-patch/v5 v5.9.11
## explicit; go 1.18 ## explicit; go 1.18
github.com/evanphx/json-patch/v5 github.com/evanphx/json-patch/v5
github.com/evanphx/json-patch/v5/internal/json github.com/evanphx/json-patch/v5/internal/json
@ -1127,7 +1127,7 @@ k8s.io/api/storage/v1
k8s.io/api/storage/v1alpha1 k8s.io/api/storage/v1alpha1
k8s.io/api/storage/v1beta1 k8s.io/api/storage/v1beta1
k8s.io/api/storagemigration/v1alpha1 k8s.io/api/storagemigration/v1alpha1
# k8s.io/apiextensions-apiserver v0.32.0 => k8s.io/apiextensions-apiserver v0.32.2 # k8s.io/apiextensions-apiserver v0.32.1 => k8s.io/apiextensions-apiserver v0.32.2
## explicit; go 1.23.0 ## explicit; go 1.23.0
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions k8s.io/apiextensions-apiserver/pkg/apis/apiextensions
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
@ -2039,7 +2039,7 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client
# sigs.k8s.io/controller-runtime v0.20.1 # sigs.k8s.io/controller-runtime v0.20.2
## explicit; go 1.23.0 ## explicit; go 1.23.0
sigs.k8s.io/controller-runtime/pkg/cache sigs.k8s.io/controller-runtime/pkg/cache
sigs.k8s.io/controller-runtime/pkg/cache/internal sigs.k8s.io/controller-runtime/pkg/cache/internal

View File

@ -11,6 +11,7 @@ import (
"k8s.io/client-go/util/workqueue" "k8s.io/client-go/util/workqueue"
"k8s.io/utils/clock" "k8s.io/utils/clock"
"k8s.io/utils/ptr" "k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/internal/metrics" "sigs.k8s.io/controller-runtime/pkg/internal/metrics"
) )
@ -132,16 +133,17 @@ func (w *priorityqueue[T]) AddWithOpts(o AddOpts, items ...T) {
defer w.lock.Unlock() defer w.lock.Unlock()
for _, key := range items { for _, key := range items {
after := o.After
if o.RateLimited { if o.RateLimited {
after := w.rateLimiter.When(key) rlAfter := w.rateLimiter.When(key)
if o.After == 0 || after < o.After { if after == 0 || rlAfter < after {
o.After = after after = rlAfter
} }
} }
var readyAt *time.Time var readyAt *time.Time
if o.After > 0 { if after > 0 {
readyAt = ptr.To(w.now().Add(o.After)) readyAt = ptr.To(w.now().Add(after))
w.metrics.retry() w.metrics.retry()
} }
if _, ok := w.items[key]; !ok { if _, ok := w.items[key]; !ok {

View File

@ -88,7 +88,7 @@ func init() {
ActiveWorkers, ActiveWorkers,
// expose process metrics like CPU, Memory, file descriptor usage etc. // expose process metrics like CPU, Memory, file descriptor usage etc.
collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}), collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}),
// expose Go runtime metrics like GC stats, memory stats etc. // expose all Go runtime metrics like GC stats, memory stats etc.
collectors.NewGoCollector(), collectors.NewGoCollector(collectors.WithGoCollectorRuntimeMetrics(collectors.MetricsAll)),
) )
} }