diff --git a/go.mod b/go.mod index e35d70d5a6..78c1358a22 100644 --- a/go.mod +++ b/go.mod @@ -13,8 +13,8 @@ require ( k8s.io/apimachinery v0.31.4 k8s.io/client-go v0.31.4 knative.dev/hack v0.0.0-20250128013659-5f7f0f50e9de - knative.dev/networking v0.0.0-20250128014447-43761241da75 - knative.dev/pkg v0.0.0-20250128013458-efddeac3ec35 + knative.dev/networking v0.0.0-20250204225923-e6fc9bbf3fb0 + knative.dev/pkg v0.0.0-20250203163623-f62a97fc6ad4 sigs.k8s.io/yaml v1.4.0 ) @@ -28,7 +28,7 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.12.1 // indirect - github.com/evanphx/json-patch/v5 v5.9.0 // indirect + github.com/evanphx/json-patch/v5 v5.9.11 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect @@ -62,7 +62,7 @@ require ( github.com/prometheus/procfs v0.15.1 // indirect github.com/prometheus/statsd_exporter v0.22.7 // indirect github.com/rs/dnscache v0.0.0-20230804202142-fc85eb664529 // indirect - github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/pflag v1.0.6 // indirect github.com/x448/float16 v0.8.4 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/automaxprocs v1.6.0 // indirect diff --git a/go.sum b/go.sum index 8f07162b24..d7e43a2def 100644 --- a/go.sum +++ b/go.sum @@ -76,8 +76,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= github.com/evanphx/json-patch v5.9.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.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= +github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU= +github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM= github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -295,8 +295,9 @@ github.com/rs/dnscache v0.0.0-20230804202142-fc85eb664529/go.mod h1:qe5TWALJ8/a1 github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -704,10 +705,10 @@ k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= knative.dev/hack v0.0.0-20250128013659-5f7f0f50e9de h1:9xWkakMP0rpTpEIi9iRfkDsqhe2XbuyJdBkrlPB2Yjs= knative.dev/hack v0.0.0-20250128013659-5f7f0f50e9de/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY= -knative.dev/networking v0.0.0-20250128014447-43761241da75 h1:w+7I7F3MsFRSffw2HPVtjWOudr6HG8rcQRnJyQdoD6Q= -knative.dev/networking v0.0.0-20250128014447-43761241da75/go.mod h1:AIKYMfZydhwXR/60c/3KXEnqEnH6aNEEqulifdqJVcQ= -knative.dev/pkg v0.0.0-20250128013458-efddeac3ec35 h1:FEk78RvL8yTuu/RczMXIo/ahhP8uaR3gPO20ZUymH5w= -knative.dev/pkg v0.0.0-20250128013458-efddeac3ec35/go.mod h1:8hCNDHVxfWH0OBbPGvupXOqxMJPOqVrxC1Ar+/Gd28o= +knative.dev/networking v0.0.0-20250204225923-e6fc9bbf3fb0 h1:BNRQ5/VTWH+I1getnHXxqhFfMYY1WsL69ZljNjMukpQ= +knative.dev/networking v0.0.0-20250204225923-e6fc9bbf3fb0/go.mod h1:4EjAb5Ij83ABbErDmHewyIOUkEoYZqbXa7hf2hbzvUg= +knative.dev/pkg v0.0.0-20250203163623-f62a97fc6ad4 h1:dHkehXNqUAuRtHr0LjGqBC3Uztuj6LcOrOdqCI4c85s= +knative.dev/pkg v0.0.0-20250203163623-f62a97fc6ad4/go.mod h1:T4d91cYeEBb9tpz4JqoqA77Px/rhq529heP6NKoknSI= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/vendor/github.com/evanphx/json-patch/v5/merge.go b/vendor/github.com/evanphx/json-patch/v5/merge.go index f79caf3135..d60afadcf1 100644 --- a/vendor/github.com/evanphx/json-patch/v5/merge.go +++ b/vendor/github.com/evanphx/json-patch/v5/merge.go @@ -103,8 +103,8 @@ func pruneAryNulls(ary *partialArray, options *ApplyOptions) *partialArray { return ary } -var errBadJSONDoc = fmt.Errorf("Invalid JSON Document") -var errBadJSONPatch = fmt.Errorf("Invalid JSON Patch") +var ErrBadJSONDoc = fmt.Errorf("Invalid JSON Document") +var ErrBadJSONPatch = fmt.Errorf("Invalid JSON Patch") var errBadMergeTypes = fmt.Errorf("Mismatched JSON Documents") // 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) { if !json.Valid(docData) { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } if !json.Valid(patchData) { - return nil, errBadJSONPatch + return nil, ErrBadJSONPatch } options := NewApplyOptions() @@ -143,7 +143,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { patchErr := patch.UnmarshalJSON(patchData) if isSyntaxError(docErr) { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } if isSyntaxError(patchErr) { @@ -151,7 +151,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { } if docErr == nil && doc.obj == nil { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } if patchErr == nil && patch.obj == nil { @@ -175,7 +175,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { if json.Valid(patchData) { return patchData, nil } - return nil, errBadJSONPatch + return nil, ErrBadJSONPatch } pruneAryNulls(patchAry, options) @@ -183,7 +183,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { out, patchErr := json.Marshal(patchAry.nodes) if patchErr != nil { - return nil, errBadJSONPatch + return nil, ErrBadJSONPatch } return out, nil @@ -256,12 +256,12 @@ func createObjectMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) { err := unmarshal(originalJSON, &originalDoc) if err != nil { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } err = unmarshal(modifiedJSON, &modifiedDoc) if err != nil { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } dest, err := getDiff(originalDoc, modifiedDoc) @@ -286,17 +286,17 @@ func createArrayMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) { err := unmarshal(originalJSON, &originalDocs) if err != nil { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } err = unmarshal(modifiedJSON, &modifiedDocs) if err != nil { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } total := len(originalDocs) if len(modifiedDocs) != total { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } result := []json.RawMessage{} diff --git a/vendor/github.com/evanphx/json-patch/v5/patch.go b/vendor/github.com/evanphx/json-patch/v5/patch.go index 7a7f71c8b6..83102e5570 100644 --- a/vendor/github.com/evanphx/json-patch/v5/patch.go +++ b/vendor/github.com/evanphx/json-patch/v5/patch.go @@ -2,13 +2,13 @@ package jsonpatch import ( "bytes" + "errors" "fmt" "strconv" "strings" "unicode" "github.com/evanphx/json-patch/v5/internal/json" - "github.com/pkg/errors" ) const ( @@ -461,7 +461,7 @@ func (o Operation) Path() (string, error) { 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. @@ -478,7 +478,7 @@ func (o Operation) From() (string, error) { 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 { @@ -511,7 +511,7 @@ func (o Operation) ValueInterface() (interface{}, error) { 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 { @@ -610,7 +610,7 @@ func (d *partialDoc) get(key string, options *ApplyOptions) (*lazyNode, error) { v, ok := d.obj[key] 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 } @@ -625,7 +625,7 @@ func (d *partialDoc) remove(key string, options *ApplyOptions) error { if options.AllowMissingPathOnRemove { 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 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 !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) { - 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) } @@ -669,7 +669,7 @@ func (d *partialArray) add(key string, val *lazyNode, options *ApplyOptions) err idx, err := strconv.Atoi(key) 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 @@ -679,15 +679,15 @@ func (d *partialArray) add(key string, val *lazyNode, options *ApplyOptions) err cur := d 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 !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) { - 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) } @@ -713,16 +713,16 @@ func (d *partialArray) get(key string, options *ApplyOptions) (*lazyNode, error) if idx < 0 { 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) { - 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) } 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 @@ -740,18 +740,18 @@ func (d *partialArray) remove(key string, options *ApplyOptions) error { if options.AllowMissingPathOnRemove { 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 !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 options.AllowMissingPathOnRemove { 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) } @@ -768,7 +768,7 @@ func (d *partialArray) remove(key string, options *ApplyOptions) error { func (p Patch) add(doc *container, op Operation, options *ApplyOptions) error { path, err := op.Path() 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 @@ -809,12 +809,12 @@ func (p Patch) add(doc *container, op Operation, options *ApplyOptions) error { con, key := findObject(doc, path, options) 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) 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 @@ -867,11 +867,11 @@ func ensurePathExists(pd *container, path string, options *ApplyOptions) error { if arrIndex < 0 { 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 { - 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 @@ -918,11 +918,11 @@ func validateOperation(op Operation) error { switch op.Kind() { case "add", "replace": 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": 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": default: @@ -930,7 +930,7 @@ func validateOperation(op Operation) error { } 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 @@ -941,10 +941,10 @@ func validatePatch(p Patch) error { if err := validateOperation(op); err != nil { opData, infoErr := json.Marshal(op) 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 { path, err := op.Path() 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) @@ -963,12 +963,12 @@ func (p Patch) remove(doc *container, op Operation, options *ApplyOptions) error if options.AllowMissingPathOnRemove { 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) 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 @@ -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 { path, err := op.Path() 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 == "" { @@ -986,7 +986,7 @@ func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) erro if val.which == eRaw { if !val.tryDoc() { 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 { val.doc.opts = options @@ -999,7 +999,7 @@ func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) erro case eDoc: *doc = val.doc case eRaw: - return errors.Wrapf(err, "replace operation hit impossible case") + return fmt.Errorf("replace operation hit impossible case: %w", err) } return nil @@ -1008,17 +1008,17 @@ func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) erro con, key := findObject(doc, path, options) 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) 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) 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 @@ -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 { from, err := op.From() 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 == "" { - 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) 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) 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) 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() 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) 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) 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 @@ -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 { path, err := op.Path() 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 == "" { @@ -1091,18 +1091,18 @@ func (p Patch) test(doc *container, op Operation, options *ApplyOptions) error { 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) 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) - if err != nil && errors.Cause(err) != ErrMissing { - return errors.Wrapf(err, "error in test for path: '%s'", path) + if err != nil && errors.Unwrap(err) != ErrMissing { + return fmt.Errorf("error in test for path: '%s': %w", path, err) } ov := op.value() @@ -1111,49 +1111,49 @@ func (p Patch) test(doc *container, op Operation, options *ApplyOptions) error { if ov.isNull() { 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() { - return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) + return fmt.Errorf("testing value %s failed: %w", path, ErrTestFailed) } if val.equal(op.value()) { 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 { from, err := op.From() 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) 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) 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() 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) 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) 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) @@ -1163,7 +1163,7 @@ func (p Patch) copy(doc *container, op Operation, accumulatedCopySize *int64, op err = con.add(key, valCopy, options) 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 diff --git a/vendor/github.com/spf13/pflag/.editorconfig b/vendor/github.com/spf13/pflag/.editorconfig new file mode 100644 index 0000000000..4492e9f9fe --- /dev/null +++ b/vendor/github.com/spf13/pflag/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.go] +indent_style = tab diff --git a/vendor/github.com/spf13/pflag/.golangci.yaml b/vendor/github.com/spf13/pflag/.golangci.yaml new file mode 100644 index 0000000000..b274f24845 --- /dev/null +++ b/vendor/github.com/spf13/pflag/.golangci.yaml @@ -0,0 +1,4 @@ +linters: + disable-all: true + enable: + - nolintlint diff --git a/vendor/github.com/spf13/pflag/flag.go b/vendor/github.com/spf13/pflag/flag.go index 24a5036e95..7c058de374 100644 --- a/vendor/github.com/spf13/pflag/flag.go +++ b/vendor/github.com/spf13/pflag/flag.go @@ -160,7 +160,7 @@ type FlagSet struct { args []string // arguments after flags argsLenAtDash int // len(args) when a '--' was located when parsing, or -1 if no -- errorHandling ErrorHandling - output io.Writer // nil means stderr; use out() accessor + output io.Writer // nil means stderr; use Output() accessor interspersed bool // allow interspersed option/non-option args normalizeNameFunc func(f *FlagSet, name string) NormalizedName @@ -255,13 +255,20 @@ func (f *FlagSet) normalizeFlagName(name string) NormalizedName { return n(f, name) } -func (f *FlagSet) out() io.Writer { +// Output returns the destination for usage and error messages. os.Stderr is returned if +// output was not set or was set to nil. +func (f *FlagSet) Output() io.Writer { if f.output == nil { return os.Stderr } return f.output } +// Name returns the name of the flag set. +func (f *FlagSet) Name() string { + return f.name +} + // SetOutput sets the destination for usage and error messages. // If output is nil, os.Stderr is used. func (f *FlagSet) SetOutput(output io.Writer) { @@ -358,7 +365,7 @@ func (f *FlagSet) ShorthandLookup(name string) *Flag { } if len(name) > 1 { msg := fmt.Sprintf("can not look up shorthand which is more than one ASCII character: %q", name) - fmt.Fprintf(f.out(), msg) + fmt.Fprintf(f.Output(), msg) panic(msg) } c := name[0] @@ -482,7 +489,7 @@ func (f *FlagSet) Set(name, value string) error { } if flag.Deprecated != "" { - fmt.Fprintf(f.out(), "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated) + fmt.Fprintf(f.Output(), "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated) } return nil } @@ -523,7 +530,7 @@ func Set(name, value string) error { // otherwise, the default values of all defined flags in the set. func (f *FlagSet) PrintDefaults() { usages := f.FlagUsages() - fmt.Fprint(f.out(), usages) + fmt.Fprint(f.Output(), usages) } // defaultIsZeroValue returns true if the default value for this flag represents @@ -758,7 +765,7 @@ func PrintDefaults() { // defaultUsage is the default function to print a usage message. func defaultUsage(f *FlagSet) { - fmt.Fprintf(f.out(), "Usage of %s:\n", f.name) + fmt.Fprintf(f.Output(), "Usage of %s:\n", f.name) f.PrintDefaults() } @@ -844,7 +851,7 @@ func (f *FlagSet) AddFlag(flag *Flag) { _, alreadyThere := f.formal[normalizedFlagName] if alreadyThere { msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name) - fmt.Fprintln(f.out(), msg) + fmt.Fprintln(f.Output(), msg) panic(msg) // Happens only if flags are declared with identical names } if f.formal == nil { @@ -860,7 +867,7 @@ func (f *FlagSet) AddFlag(flag *Flag) { } if len(flag.Shorthand) > 1 { msg := fmt.Sprintf("%q shorthand is more than one ASCII character", flag.Shorthand) - fmt.Fprintf(f.out(), msg) + fmt.Fprintf(f.Output(), msg) panic(msg) } if f.shorthands == nil { @@ -870,7 +877,7 @@ func (f *FlagSet) AddFlag(flag *Flag) { used, alreadyThere := f.shorthands[c] if alreadyThere { msg := fmt.Sprintf("unable to redefine %q shorthand in %q flagset: it's already used for %q flag", c, f.name, used.Name) - fmt.Fprintf(f.out(), msg) + fmt.Fprintf(f.Output(), msg) panic(msg) } f.shorthands[c] = flag @@ -909,7 +916,7 @@ func VarP(value Value, name, shorthand, usage string) { func (f *FlagSet) failf(format string, a ...interface{}) error { err := fmt.Errorf(format, a...) if f.errorHandling != ContinueOnError { - fmt.Fprintln(f.out(), err) + fmt.Fprintln(f.Output(), err) f.usage() } return err @@ -1060,7 +1067,7 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse } if flag.ShorthandDeprecated != "" { - fmt.Fprintf(f.out(), "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated) + fmt.Fprintf(f.Output(), "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated) } err = fn(flag, value) diff --git a/vendor/github.com/spf13/pflag/ip.go b/vendor/github.com/spf13/pflag/ip.go index 3d414ba69f..06b8bcb572 100644 --- a/vendor/github.com/spf13/pflag/ip.go +++ b/vendor/github.com/spf13/pflag/ip.go @@ -16,6 +16,9 @@ func newIPValue(val net.IP, p *net.IP) *ipValue { func (i *ipValue) String() string { return net.IP(*i).String() } func (i *ipValue) Set(s string) error { + if s == "" { + return nil + } ip := net.ParseIP(strings.TrimSpace(s)) if ip == nil { return fmt.Errorf("failed to parse IP: %q", s) diff --git a/vendor/github.com/spf13/pflag/ipnet_slice.go b/vendor/github.com/spf13/pflag/ipnet_slice.go new file mode 100644 index 0000000000..6b541aa879 --- /dev/null +++ b/vendor/github.com/spf13/pflag/ipnet_slice.go @@ -0,0 +1,147 @@ +package pflag + +import ( + "fmt" + "io" + "net" + "strings" +) + +// -- ipNetSlice Value +type ipNetSliceValue struct { + value *[]net.IPNet + changed bool +} + +func newIPNetSliceValue(val []net.IPNet, p *[]net.IPNet) *ipNetSliceValue { + ipnsv := new(ipNetSliceValue) + ipnsv.value = p + *ipnsv.value = val + return ipnsv +} + +// Set converts, and assigns, the comma-separated IPNet argument string representation as the []net.IPNet value of this flag. +// If Set is called on a flag that already has a []net.IPNet assigned, the newly converted values will be appended. +func (s *ipNetSliceValue) Set(val string) error { + + // remove all quote characters + rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "") + + // read flag arguments with CSV parser + ipNetStrSlice, err := readAsCSV(rmQuote.Replace(val)) + if err != nil && err != io.EOF { + return err + } + + // parse ip values into slice + out := make([]net.IPNet, 0, len(ipNetStrSlice)) + for _, ipNetStr := range ipNetStrSlice { + _, n, err := net.ParseCIDR(strings.TrimSpace(ipNetStr)) + if err != nil { + return fmt.Errorf("invalid string being converted to CIDR: %s", ipNetStr) + } + out = append(out, *n) + } + + if !s.changed { + *s.value = out + } else { + *s.value = append(*s.value, out...) + } + + s.changed = true + + return nil +} + +// Type returns a string that uniquely represents this flag's type. +func (s *ipNetSliceValue) Type() string { + return "ipNetSlice" +} + +// String defines a "native" format for this net.IPNet slice flag value. +func (s *ipNetSliceValue) String() string { + + ipNetStrSlice := make([]string, len(*s.value)) + for i, n := range *s.value { + ipNetStrSlice[i] = n.String() + } + + out, _ := writeAsCSV(ipNetStrSlice) + return "[" + out + "]" +} + +func ipNetSliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // Emtpy string would cause a slice with one (empty) entry + if len(val) == 0 { + return []net.IPNet{}, nil + } + ss := strings.Split(val, ",") + out := make([]net.IPNet, len(ss)) + for i, sval := range ss { + _, n, err := net.ParseCIDR(strings.TrimSpace(sval)) + if err != nil { + return nil, fmt.Errorf("invalid string being converted to CIDR: %s", sval) + } + out[i] = *n + } + return out, nil +} + +// GetIPNetSlice returns the []net.IPNet value of a flag with the given name +func (f *FlagSet) GetIPNetSlice(name string) ([]net.IPNet, error) { + val, err := f.getFlagType(name, "ipNetSlice", ipNetSliceConv) + if err != nil { + return []net.IPNet{}, err + } + return val.([]net.IPNet), nil +} + +// IPNetSliceVar defines a ipNetSlice flag with specified name, default value, and usage string. +// The argument p points to a []net.IPNet variable in which to store the value of the flag. +func (f *FlagSet) IPNetSliceVar(p *[]net.IPNet, name string, value []net.IPNet, usage string) { + f.VarP(newIPNetSliceValue(value, p), name, "", usage) +} + +// IPNetSliceVarP is like IPNetSliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPNetSliceVarP(p *[]net.IPNet, name, shorthand string, value []net.IPNet, usage string) { + f.VarP(newIPNetSliceValue(value, p), name, shorthand, usage) +} + +// IPNetSliceVar defines a []net.IPNet flag with specified name, default value, and usage string. +// The argument p points to a []net.IPNet variable in which to store the value of the flag. +func IPNetSliceVar(p *[]net.IPNet, name string, value []net.IPNet, usage string) { + CommandLine.VarP(newIPNetSliceValue(value, p), name, "", usage) +} + +// IPNetSliceVarP is like IPNetSliceVar, but accepts a shorthand letter that can be used after a single dash. +func IPNetSliceVarP(p *[]net.IPNet, name, shorthand string, value []net.IPNet, usage string) { + CommandLine.VarP(newIPNetSliceValue(value, p), name, shorthand, usage) +} + +// IPNetSlice defines a []net.IPNet flag with specified name, default value, and usage string. +// The return value is the address of a []net.IPNet variable that stores the value of that flag. +func (f *FlagSet) IPNetSlice(name string, value []net.IPNet, usage string) *[]net.IPNet { + p := []net.IPNet{} + f.IPNetSliceVarP(&p, name, "", value, usage) + return &p +} + +// IPNetSliceP is like IPNetSlice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPNetSliceP(name, shorthand string, value []net.IPNet, usage string) *[]net.IPNet { + p := []net.IPNet{} + f.IPNetSliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// IPNetSlice defines a []net.IPNet flag with specified name, default value, and usage string. +// The return value is the address of a []net.IP variable that stores the value of the flag. +func IPNetSlice(name string, value []net.IPNet, usage string) *[]net.IPNet { + return CommandLine.IPNetSliceP(name, "", value, usage) +} + +// IPNetSliceP is like IPNetSlice, but accepts a shorthand letter that can be used after a single dash. +func IPNetSliceP(name, shorthand string, value []net.IPNet, usage string) *[]net.IPNet { + return CommandLine.IPNetSliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/string_array.go b/vendor/github.com/spf13/pflag/string_array.go index 4894af8180..d1ff0a96ba 100644 --- a/vendor/github.com/spf13/pflag/string_array.go +++ b/vendor/github.com/spf13/pflag/string_array.go @@ -31,11 +31,7 @@ func (s *stringArrayValue) Append(val string) error { func (s *stringArrayValue) Replace(val []string) error { out := make([]string, len(val)) for i, d := range val { - var err error out[i] = d - if err != nil { - return err - } } *s.value = out return nil diff --git a/vendor/knative.dev/networking/pkg/client/clientset/versioned/fake/clientset_generated.go b/vendor/knative.dev/networking/pkg/client/clientset/versioned/fake/clientset_generated.go index eb9da6f0a8..d1653c7f19 100644 --- a/vendor/knative.dev/networking/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/vendor/knative.dev/networking/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -31,8 +31,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { diff --git a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/certificate.go b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/certificate.go index 1bf71aabbf..6467589efa 100644 --- a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/certificate.go +++ b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/certificate.go @@ -20,12 +20,11 @@ package v1alpha1 import ( "context" - "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" v1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" scheme "knative.dev/networking/pkg/client/clientset/versioned/scheme" ) @@ -40,6 +39,7 @@ type CertificatesGetter interface { type CertificateInterface interface { Create(ctx context.Context, certificate *v1alpha1.Certificate, opts v1.CreateOptions) (*v1alpha1.Certificate, error) Update(ctx context.Context, certificate *v1alpha1.Certificate, opts v1.UpdateOptions) (*v1alpha1.Certificate, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, certificate *v1alpha1.Certificate, opts v1.UpdateOptions) (*v1alpha1.Certificate, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type CertificateInterface interface { // certificates implements CertificateInterface type certificates struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.Certificate, *v1alpha1.CertificateList] } // newCertificates returns a Certificates func newCertificates(c *NetworkingV1alpha1Client, namespace string) *certificates { return &certificates{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.Certificate, *v1alpha1.CertificateList]( + "certificates", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Certificate { return &v1alpha1.Certificate{} }, + func() *v1alpha1.CertificateList { return &v1alpha1.CertificateList{} }), } } - -// Get takes name of the certificate, and returns the corresponding certificate object, and an error if there is any. -func (c *certificates) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Certificate, err error) { - result = &v1alpha1.Certificate{} - err = c.client.Get(). - Namespace(c.ns). - Resource("certificates"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Certificates that match those selectors. -func (c *certificates) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CertificateList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.CertificateList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("certificates"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested certificates. -func (c *certificates) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("certificates"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a certificate and creates it. Returns the server's representation of the certificate, and an error, if there is any. -func (c *certificates) Create(ctx context.Context, certificate *v1alpha1.Certificate, opts v1.CreateOptions) (result *v1alpha1.Certificate, err error) { - result = &v1alpha1.Certificate{} - err = c.client.Post(). - Namespace(c.ns). - Resource("certificates"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(certificate). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a certificate and updates it. Returns the server's representation of the certificate, and an error, if there is any. -func (c *certificates) Update(ctx context.Context, certificate *v1alpha1.Certificate, opts v1.UpdateOptions) (result *v1alpha1.Certificate, err error) { - result = &v1alpha1.Certificate{} - err = c.client.Put(). - Namespace(c.ns). - Resource("certificates"). - Name(certificate.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(certificate). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *certificates) UpdateStatus(ctx context.Context, certificate *v1alpha1.Certificate, opts v1.UpdateOptions) (result *v1alpha1.Certificate, err error) { - result = &v1alpha1.Certificate{} - err = c.client.Put(). - Namespace(c.ns). - Resource("certificates"). - Name(certificate.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(certificate). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the certificate and deletes it. Returns an error if one occurs. -func (c *certificates) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("certificates"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *certificates) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("certificates"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched certificate. -func (c *certificates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Certificate, err error) { - result = &v1alpha1.Certificate{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("certificates"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/clusterdomainclaim.go b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/clusterdomainclaim.go index 75b69d9dfc..a054634b24 100644 --- a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/clusterdomainclaim.go +++ b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/clusterdomainclaim.go @@ -20,12 +20,11 @@ package v1alpha1 import ( "context" - "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" v1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" scheme "knative.dev/networking/pkg/client/clientset/versioned/scheme" ) @@ -51,118 +50,18 @@ type ClusterDomainClaimInterface interface { // clusterDomainClaims implements ClusterDomainClaimInterface type clusterDomainClaims struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.ClusterDomainClaim, *v1alpha1.ClusterDomainClaimList] } // newClusterDomainClaims returns a ClusterDomainClaims func newClusterDomainClaims(c *NetworkingV1alpha1Client) *clusterDomainClaims { return &clusterDomainClaims{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.ClusterDomainClaim, *v1alpha1.ClusterDomainClaimList]( + "clusterdomainclaims", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.ClusterDomainClaim { return &v1alpha1.ClusterDomainClaim{} }, + func() *v1alpha1.ClusterDomainClaimList { return &v1alpha1.ClusterDomainClaimList{} }), } } - -// Get takes name of the clusterDomainClaim, and returns the corresponding clusterDomainClaim object, and an error if there is any. -func (c *clusterDomainClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterDomainClaim, err error) { - result = &v1alpha1.ClusterDomainClaim{} - err = c.client.Get(). - Resource("clusterdomainclaims"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterDomainClaims that match those selectors. -func (c *clusterDomainClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterDomainClaimList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ClusterDomainClaimList{} - err = c.client.Get(). - Resource("clusterdomainclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterDomainClaims. -func (c *clusterDomainClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("clusterdomainclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterDomainClaim and creates it. Returns the server's representation of the clusterDomainClaim, and an error, if there is any. -func (c *clusterDomainClaims) Create(ctx context.Context, clusterDomainClaim *v1alpha1.ClusterDomainClaim, opts v1.CreateOptions) (result *v1alpha1.ClusterDomainClaim, err error) { - result = &v1alpha1.ClusterDomainClaim{} - err = c.client.Post(). - Resource("clusterdomainclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterDomainClaim). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterDomainClaim and updates it. Returns the server's representation of the clusterDomainClaim, and an error, if there is any. -func (c *clusterDomainClaims) Update(ctx context.Context, clusterDomainClaim *v1alpha1.ClusterDomainClaim, opts v1.UpdateOptions) (result *v1alpha1.ClusterDomainClaim, err error) { - result = &v1alpha1.ClusterDomainClaim{} - err = c.client.Put(). - Resource("clusterdomainclaims"). - Name(clusterDomainClaim.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterDomainClaim). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterDomainClaim and deletes it. Returns an error if one occurs. -func (c *clusterDomainClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("clusterdomainclaims"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterDomainClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("clusterdomainclaims"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterDomainClaim. -func (c *clusterDomainClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterDomainClaim, err error) { - result = &v1alpha1.ClusterDomainClaim{} - err = c.client.Patch(pt). - Resource("clusterdomainclaims"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_certificate.go b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_certificate.go index 36cad6518a..0001ec0014 100644 --- a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_certificate.go +++ b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_certificate.go @@ -41,22 +41,24 @@ var certificatesKind = v1alpha1.SchemeGroupVersion.WithKind("Certificate") // Get takes name of the certificate, and returns the corresponding certificate object, and an error if there is any. func (c *FakeCertificates) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Certificate, err error) { + emptyResult := &v1alpha1.Certificate{} obj, err := c.Fake. - Invokes(testing.NewGetAction(certificatesResource, c.ns, name), &v1alpha1.Certificate{}) + Invokes(testing.NewGetActionWithOptions(certificatesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Certificate), err } // List takes label and field selectors, and returns the list of Certificates that match those selectors. func (c *FakeCertificates) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CertificateList, err error) { + emptyResult := &v1alpha1.CertificateList{} obj, err := c.Fake. - Invokes(testing.NewListAction(certificatesResource, certificatesKind, c.ns, opts), &v1alpha1.CertificateList{}) + Invokes(testing.NewListActionWithOptions(certificatesResource, certificatesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeCertificates) List(ctx context.Context, opts v1.ListOptions) (resul // Watch returns a watch.Interface that watches the requested certificates. func (c *FakeCertificates) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(certificatesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(certificatesResource, c.ns, opts)) } // Create takes the representation of a certificate and creates it. Returns the server's representation of the certificate, and an error, if there is any. func (c *FakeCertificates) Create(ctx context.Context, certificate *v1alpha1.Certificate, opts v1.CreateOptions) (result *v1alpha1.Certificate, err error) { + emptyResult := &v1alpha1.Certificate{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(certificatesResource, c.ns, certificate), &v1alpha1.Certificate{}) + Invokes(testing.NewCreateActionWithOptions(certificatesResource, c.ns, certificate, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Certificate), err } // Update takes the representation of a certificate and updates it. Returns the server's representation of the certificate, and an error, if there is any. func (c *FakeCertificates) Update(ctx context.Context, certificate *v1alpha1.Certificate, opts v1.UpdateOptions) (result *v1alpha1.Certificate, err error) { + emptyResult := &v1alpha1.Certificate{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(certificatesResource, c.ns, certificate), &v1alpha1.Certificate{}) + Invokes(testing.NewUpdateActionWithOptions(certificatesResource, c.ns, certificate, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Certificate), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCertificates) UpdateStatus(ctx context.Context, certificate *v1alpha1.Certificate, opts v1.UpdateOptions) (*v1alpha1.Certificate, error) { +func (c *FakeCertificates) UpdateStatus(ctx context.Context, certificate *v1alpha1.Certificate, opts v1.UpdateOptions) (result *v1alpha1.Certificate, err error) { + emptyResult := &v1alpha1.Certificate{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(certificatesResource, "status", c.ns, certificate), &v1alpha1.Certificate{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(certificatesResource, "status", c.ns, certificate, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Certificate), err } @@ -123,7 +128,7 @@ func (c *FakeCertificates) Delete(ctx context.Context, name string, opts v1.Dele // DeleteCollection deletes a collection of objects. func (c *FakeCertificates) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(certificatesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(certificatesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.CertificateList{}) return err @@ -131,11 +136,12 @@ func (c *FakeCertificates) DeleteCollection(ctx context.Context, opts v1.DeleteO // Patch applies the patch and returns the patched certificate. func (c *FakeCertificates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Certificate, err error) { + emptyResult := &v1alpha1.Certificate{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(certificatesResource, c.ns, name, pt, data, subresources...), &v1alpha1.Certificate{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(certificatesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Certificate), err } diff --git a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_clusterdomainclaim.go b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_clusterdomainclaim.go index 24d8193160..706809b144 100644 --- a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_clusterdomainclaim.go +++ b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_clusterdomainclaim.go @@ -40,20 +40,22 @@ var clusterdomainclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("ClusterDomai // Get takes name of the clusterDomainClaim, and returns the corresponding clusterDomainClaim object, and an error if there is any. func (c *FakeClusterDomainClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterDomainClaim, err error) { + emptyResult := &v1alpha1.ClusterDomainClaim{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clusterdomainclaimsResource, name), &v1alpha1.ClusterDomainClaim{}) + Invokes(testing.NewRootGetActionWithOptions(clusterdomainclaimsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterDomainClaim), err } // List takes label and field selectors, and returns the list of ClusterDomainClaims that match those selectors. func (c *FakeClusterDomainClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterDomainClaimList, err error) { + emptyResult := &v1alpha1.ClusterDomainClaimList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clusterdomainclaimsResource, clusterdomainclaimsKind, opts), &v1alpha1.ClusterDomainClaimList{}) + Invokes(testing.NewRootListActionWithOptions(clusterdomainclaimsResource, clusterdomainclaimsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -72,25 +74,27 @@ func (c *FakeClusterDomainClaims) List(ctx context.Context, opts v1.ListOptions) // Watch returns a watch.Interface that watches the requested clusterDomainClaims. func (c *FakeClusterDomainClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clusterdomainclaimsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clusterdomainclaimsResource, opts)) } // Create takes the representation of a clusterDomainClaim and creates it. Returns the server's representation of the clusterDomainClaim, and an error, if there is any. func (c *FakeClusterDomainClaims) Create(ctx context.Context, clusterDomainClaim *v1alpha1.ClusterDomainClaim, opts v1.CreateOptions) (result *v1alpha1.ClusterDomainClaim, err error) { + emptyResult := &v1alpha1.ClusterDomainClaim{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clusterdomainclaimsResource, clusterDomainClaim), &v1alpha1.ClusterDomainClaim{}) + Invokes(testing.NewRootCreateActionWithOptions(clusterdomainclaimsResource, clusterDomainClaim, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterDomainClaim), err } // Update takes the representation of a clusterDomainClaim and updates it. Returns the server's representation of the clusterDomainClaim, and an error, if there is any. func (c *FakeClusterDomainClaims) Update(ctx context.Context, clusterDomainClaim *v1alpha1.ClusterDomainClaim, opts v1.UpdateOptions) (result *v1alpha1.ClusterDomainClaim, err error) { + emptyResult := &v1alpha1.ClusterDomainClaim{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clusterdomainclaimsResource, clusterDomainClaim), &v1alpha1.ClusterDomainClaim{}) + Invokes(testing.NewRootUpdateActionWithOptions(clusterdomainclaimsResource, clusterDomainClaim, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterDomainClaim), err } @@ -104,7 +108,7 @@ func (c *FakeClusterDomainClaims) Delete(ctx context.Context, name string, opts // DeleteCollection deletes a collection of objects. func (c *FakeClusterDomainClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clusterdomainclaimsResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clusterdomainclaimsResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ClusterDomainClaimList{}) return err @@ -112,10 +116,11 @@ func (c *FakeClusterDomainClaims) DeleteCollection(ctx context.Context, opts v1. // Patch applies the patch and returns the patched clusterDomainClaim. func (c *FakeClusterDomainClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterDomainClaim, err error) { + emptyResult := &v1alpha1.ClusterDomainClaim{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clusterdomainclaimsResource, name, pt, data, subresources...), &v1alpha1.ClusterDomainClaim{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clusterdomainclaimsResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterDomainClaim), err } diff --git a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_ingress.go b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_ingress.go index 06849c630d..78951c1ad8 100644 --- a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_ingress.go +++ b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_ingress.go @@ -41,22 +41,24 @@ var ingressesKind = v1alpha1.SchemeGroupVersion.WithKind("Ingress") // Get takes name of the ingress, and returns the corresponding ingress object, and an error if there is any. func (c *FakeIngresses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Ingress, err error) { + emptyResult := &v1alpha1.Ingress{} obj, err := c.Fake. - Invokes(testing.NewGetAction(ingressesResource, c.ns, name), &v1alpha1.Ingress{}) + Invokes(testing.NewGetActionWithOptions(ingressesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Ingress), err } // List takes label and field selectors, and returns the list of Ingresses that match those selectors. func (c *FakeIngresses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IngressList, err error) { + emptyResult := &v1alpha1.IngressList{} obj, err := c.Fake. - Invokes(testing.NewListAction(ingressesResource, ingressesKind, c.ns, opts), &v1alpha1.IngressList{}) + Invokes(testing.NewListActionWithOptions(ingressesResource, ingressesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeIngresses) List(ctx context.Context, opts v1.ListOptions) (result * // Watch returns a watch.Interface that watches the requested ingresses. func (c *FakeIngresses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(ingressesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(ingressesResource, c.ns, opts)) } // Create takes the representation of a ingress and creates it. Returns the server's representation of the ingress, and an error, if there is any. func (c *FakeIngresses) Create(ctx context.Context, ingress *v1alpha1.Ingress, opts v1.CreateOptions) (result *v1alpha1.Ingress, err error) { + emptyResult := &v1alpha1.Ingress{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(ingressesResource, c.ns, ingress), &v1alpha1.Ingress{}) + Invokes(testing.NewCreateActionWithOptions(ingressesResource, c.ns, ingress, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Ingress), err } // Update takes the representation of a ingress and updates it. Returns the server's representation of the ingress, and an error, if there is any. func (c *FakeIngresses) Update(ctx context.Context, ingress *v1alpha1.Ingress, opts v1.UpdateOptions) (result *v1alpha1.Ingress, err error) { + emptyResult := &v1alpha1.Ingress{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ingressesResource, c.ns, ingress), &v1alpha1.Ingress{}) + Invokes(testing.NewUpdateActionWithOptions(ingressesResource, c.ns, ingress, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Ingress), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeIngresses) UpdateStatus(ctx context.Context, ingress *v1alpha1.Ingress, opts v1.UpdateOptions) (*v1alpha1.Ingress, error) { +func (c *FakeIngresses) UpdateStatus(ctx context.Context, ingress *v1alpha1.Ingress, opts v1.UpdateOptions) (result *v1alpha1.Ingress, err error) { + emptyResult := &v1alpha1.Ingress{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(ingressesResource, "status", c.ns, ingress), &v1alpha1.Ingress{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(ingressesResource, "status", c.ns, ingress, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Ingress), err } @@ -123,7 +128,7 @@ func (c *FakeIngresses) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeIngresses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ingressesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(ingressesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.IngressList{}) return err @@ -131,11 +136,12 @@ func (c *FakeIngresses) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched ingress. func (c *FakeIngresses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Ingress, err error) { + emptyResult := &v1alpha1.Ingress{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ingressesResource, c.ns, name, pt, data, subresources...), &v1alpha1.Ingress{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(ingressesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Ingress), err } diff --git a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_serverlessservice.go b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_serverlessservice.go index 08ebfc9019..957eafc08d 100644 --- a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_serverlessservice.go +++ b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/fake/fake_serverlessservice.go @@ -41,22 +41,24 @@ var serverlessservicesKind = v1alpha1.SchemeGroupVersion.WithKind("ServerlessSer // Get takes name of the serverlessService, and returns the corresponding serverlessService object, and an error if there is any. func (c *FakeServerlessServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ServerlessService, err error) { + emptyResult := &v1alpha1.ServerlessService{} obj, err := c.Fake. - Invokes(testing.NewGetAction(serverlessservicesResource, c.ns, name), &v1alpha1.ServerlessService{}) + Invokes(testing.NewGetActionWithOptions(serverlessservicesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ServerlessService), err } // List takes label and field selectors, and returns the list of ServerlessServices that match those selectors. func (c *FakeServerlessServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ServerlessServiceList, err error) { + emptyResult := &v1alpha1.ServerlessServiceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(serverlessservicesResource, serverlessservicesKind, c.ns, opts), &v1alpha1.ServerlessServiceList{}) + Invokes(testing.NewListActionWithOptions(serverlessservicesResource, serverlessservicesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeServerlessServices) List(ctx context.Context, opts v1.ListOptions) // Watch returns a watch.Interface that watches the requested serverlessServices. func (c *FakeServerlessServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(serverlessservicesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(serverlessservicesResource, c.ns, opts)) } // Create takes the representation of a serverlessService and creates it. Returns the server's representation of the serverlessService, and an error, if there is any. func (c *FakeServerlessServices) Create(ctx context.Context, serverlessService *v1alpha1.ServerlessService, opts v1.CreateOptions) (result *v1alpha1.ServerlessService, err error) { + emptyResult := &v1alpha1.ServerlessService{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(serverlessservicesResource, c.ns, serverlessService), &v1alpha1.ServerlessService{}) + Invokes(testing.NewCreateActionWithOptions(serverlessservicesResource, c.ns, serverlessService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ServerlessService), err } // Update takes the representation of a serverlessService and updates it. Returns the server's representation of the serverlessService, and an error, if there is any. func (c *FakeServerlessServices) Update(ctx context.Context, serverlessService *v1alpha1.ServerlessService, opts v1.UpdateOptions) (result *v1alpha1.ServerlessService, err error) { + emptyResult := &v1alpha1.ServerlessService{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(serverlessservicesResource, c.ns, serverlessService), &v1alpha1.ServerlessService{}) + Invokes(testing.NewUpdateActionWithOptions(serverlessservicesResource, c.ns, serverlessService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ServerlessService), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeServerlessServices) UpdateStatus(ctx context.Context, serverlessService *v1alpha1.ServerlessService, opts v1.UpdateOptions) (*v1alpha1.ServerlessService, error) { +func (c *FakeServerlessServices) UpdateStatus(ctx context.Context, serverlessService *v1alpha1.ServerlessService, opts v1.UpdateOptions) (result *v1alpha1.ServerlessService, err error) { + emptyResult := &v1alpha1.ServerlessService{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(serverlessservicesResource, "status", c.ns, serverlessService), &v1alpha1.ServerlessService{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(serverlessservicesResource, "status", c.ns, serverlessService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ServerlessService), err } @@ -123,7 +128,7 @@ func (c *FakeServerlessServices) Delete(ctx context.Context, name string, opts v // DeleteCollection deletes a collection of objects. func (c *FakeServerlessServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(serverlessservicesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(serverlessservicesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ServerlessServiceList{}) return err @@ -131,11 +136,12 @@ func (c *FakeServerlessServices) DeleteCollection(ctx context.Context, opts v1.D // Patch applies the patch and returns the patched serverlessService. func (c *FakeServerlessServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ServerlessService, err error) { + emptyResult := &v1alpha1.ServerlessService{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(serverlessservicesResource, c.ns, name, pt, data, subresources...), &v1alpha1.ServerlessService{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(serverlessservicesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ServerlessService), err } diff --git a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/ingress.go b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/ingress.go index 0f731ddf4d..69d9a0fb50 100644 --- a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/ingress.go +++ b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/ingress.go @@ -20,12 +20,11 @@ package v1alpha1 import ( "context" - "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" v1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" scheme "knative.dev/networking/pkg/client/clientset/versioned/scheme" ) @@ -40,6 +39,7 @@ type IngressesGetter interface { type IngressInterface interface { Create(ctx context.Context, ingress *v1alpha1.Ingress, opts v1.CreateOptions) (*v1alpha1.Ingress, error) Update(ctx context.Context, ingress *v1alpha1.Ingress, opts v1.UpdateOptions) (*v1alpha1.Ingress, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, ingress *v1alpha1.Ingress, opts v1.UpdateOptions) (*v1alpha1.Ingress, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type IngressInterface interface { // ingresses implements IngressInterface type ingresses struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.Ingress, *v1alpha1.IngressList] } // newIngresses returns a Ingresses func newIngresses(c *NetworkingV1alpha1Client, namespace string) *ingresses { return &ingresses{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.Ingress, *v1alpha1.IngressList]( + "ingresses", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Ingress { return &v1alpha1.Ingress{} }, + func() *v1alpha1.IngressList { return &v1alpha1.IngressList{} }), } } - -// Get takes name of the ingress, and returns the corresponding ingress object, and an error if there is any. -func (c *ingresses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Ingress, err error) { - result = &v1alpha1.Ingress{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ingresses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Ingresses that match those selectors. -func (c *ingresses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IngressList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.IngressList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ingresses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ingresses. -func (c *ingresses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("ingresses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ingress and creates it. Returns the server's representation of the ingress, and an error, if there is any. -func (c *ingresses) Create(ctx context.Context, ingress *v1alpha1.Ingress, opts v1.CreateOptions) (result *v1alpha1.Ingress, err error) { - result = &v1alpha1.Ingress{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ingresses"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ingress). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ingress and updates it. Returns the server's representation of the ingress, and an error, if there is any. -func (c *ingresses) Update(ctx context.Context, ingress *v1alpha1.Ingress, opts v1.UpdateOptions) (result *v1alpha1.Ingress, err error) { - result = &v1alpha1.Ingress{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ingresses"). - Name(ingress.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ingress). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ingresses) UpdateStatus(ctx context.Context, ingress *v1alpha1.Ingress, opts v1.UpdateOptions) (result *v1alpha1.Ingress, err error) { - result = &v1alpha1.Ingress{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ingresses"). - Name(ingress.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ingress). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ingress and deletes it. Returns an error if one occurs. -func (c *ingresses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ingresses"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ingresses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ingresses"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ingress. -func (c *ingresses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Ingress, err error) { - result = &v1alpha1.Ingress{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ingresses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/serverlessservice.go b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/serverlessservice.go index 973cea6278..2ad81c0f11 100644 --- a/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/serverlessservice.go +++ b/vendor/knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1/serverlessservice.go @@ -20,12 +20,11 @@ package v1alpha1 import ( "context" - "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" v1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" scheme "knative.dev/networking/pkg/client/clientset/versioned/scheme" ) @@ -40,6 +39,7 @@ type ServerlessServicesGetter interface { type ServerlessServiceInterface interface { Create(ctx context.Context, serverlessService *v1alpha1.ServerlessService, opts v1.CreateOptions) (*v1alpha1.ServerlessService, error) Update(ctx context.Context, serverlessService *v1alpha1.ServerlessService, opts v1.UpdateOptions) (*v1alpha1.ServerlessService, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, serverlessService *v1alpha1.ServerlessService, opts v1.UpdateOptions) (*v1alpha1.ServerlessService, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type ServerlessServiceInterface interface { // serverlessServices implements ServerlessServiceInterface type serverlessServices struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.ServerlessService, *v1alpha1.ServerlessServiceList] } // newServerlessServices returns a ServerlessServices func newServerlessServices(c *NetworkingV1alpha1Client, namespace string) *serverlessServices { return &serverlessServices{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.ServerlessService, *v1alpha1.ServerlessServiceList]( + "serverlessservices", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ServerlessService { return &v1alpha1.ServerlessService{} }, + func() *v1alpha1.ServerlessServiceList { return &v1alpha1.ServerlessServiceList{} }), } } - -// Get takes name of the serverlessService, and returns the corresponding serverlessService object, and an error if there is any. -func (c *serverlessServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ServerlessService, err error) { - result = &v1alpha1.ServerlessService{} - err = c.client.Get(). - Namespace(c.ns). - Resource("serverlessservices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ServerlessServices that match those selectors. -func (c *serverlessServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ServerlessServiceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ServerlessServiceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("serverlessservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested serverlessServices. -func (c *serverlessServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("serverlessservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a serverlessService and creates it. Returns the server's representation of the serverlessService, and an error, if there is any. -func (c *serverlessServices) Create(ctx context.Context, serverlessService *v1alpha1.ServerlessService, opts v1.CreateOptions) (result *v1alpha1.ServerlessService, err error) { - result = &v1alpha1.ServerlessService{} - err = c.client.Post(). - Namespace(c.ns). - Resource("serverlessservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serverlessService). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a serverlessService and updates it. Returns the server's representation of the serverlessService, and an error, if there is any. -func (c *serverlessServices) Update(ctx context.Context, serverlessService *v1alpha1.ServerlessService, opts v1.UpdateOptions) (result *v1alpha1.ServerlessService, err error) { - result = &v1alpha1.ServerlessService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("serverlessservices"). - Name(serverlessService.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serverlessService). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *serverlessServices) UpdateStatus(ctx context.Context, serverlessService *v1alpha1.ServerlessService, opts v1.UpdateOptions) (result *v1alpha1.ServerlessService, err error) { - result = &v1alpha1.ServerlessService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("serverlessservices"). - Name(serverlessService.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serverlessService). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the serverlessService and deletes it. Returns an error if one occurs. -func (c *serverlessServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("serverlessservices"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *serverlessServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("serverlessservices"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched serverlessService. -func (c *serverlessServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ServerlessService, err error) { - result = &v1alpha1.ServerlessService{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("serverlessservices"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/knative.dev/networking/pkg/client/informers/externalversions/factory.go b/vendor/knative.dev/networking/pkg/client/informers/externalversions/factory.go index 72496e9837..1bd26b5f7c 100644 --- a/vendor/knative.dev/networking/pkg/client/informers/externalversions/factory.go +++ b/vendor/knative.dev/networking/pkg/client/informers/externalversions/factory.go @@ -228,6 +228,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new diff --git a/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/certificate.go b/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/certificate.go index dbbb847126..18f35c786d 100644 --- a/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/certificate.go +++ b/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/certificate.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" ) @@ -38,25 +38,17 @@ type CertificateLister interface { // certificateLister implements the CertificateLister interface. type certificateLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.Certificate] } // NewCertificateLister returns a new CertificateLister. func NewCertificateLister(indexer cache.Indexer) CertificateLister { - return &certificateLister{indexer: indexer} -} - -// List lists all Certificates in the indexer. -func (s *certificateLister) List(selector labels.Selector) (ret []*v1alpha1.Certificate, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Certificate)) - }) - return ret, err + return &certificateLister{listers.New[*v1alpha1.Certificate](indexer, v1alpha1.Resource("certificate"))} } // Certificates returns an object that can list and get Certificates. func (s *certificateLister) Certificates(namespace string) CertificateNamespaceLister { - return certificateNamespaceLister{indexer: s.indexer, namespace: namespace} + return certificateNamespaceLister{listers.NewNamespaced[*v1alpha1.Certificate](s.ResourceIndexer, namespace)} } // CertificateNamespaceLister helps list and get Certificates. @@ -74,26 +66,5 @@ type CertificateNamespaceLister interface { // certificateNamespaceLister implements the CertificateNamespaceLister // interface. type certificateNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Certificates in the indexer for a given namespace. -func (s certificateNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Certificate, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Certificate)) - }) - return ret, err -} - -// Get retrieves the Certificate from the indexer for a given namespace and name. -func (s certificateNamespaceLister) Get(name string) (*v1alpha1.Certificate, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("certificate"), name) - } - return obj.(*v1alpha1.Certificate), nil + listers.ResourceIndexer[*v1alpha1.Certificate] } diff --git a/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/clusterdomainclaim.go b/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/clusterdomainclaim.go index 7fb7f06f9d..eec6e40d6e 100644 --- a/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/clusterdomainclaim.go +++ b/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/clusterdomainclaim.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" ) @@ -39,30 +39,10 @@ type ClusterDomainClaimLister interface { // clusterDomainClaimLister implements the ClusterDomainClaimLister interface. type clusterDomainClaimLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ClusterDomainClaim] } // NewClusterDomainClaimLister returns a new ClusterDomainClaimLister. func NewClusterDomainClaimLister(indexer cache.Indexer) ClusterDomainClaimLister { - return &clusterDomainClaimLister{indexer: indexer} -} - -// List lists all ClusterDomainClaims in the indexer. -func (s *clusterDomainClaimLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterDomainClaim, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ClusterDomainClaim)) - }) - return ret, err -} - -// Get retrieves the ClusterDomainClaim from the index for a given name. -func (s *clusterDomainClaimLister) Get(name string) (*v1alpha1.ClusterDomainClaim, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("clusterdomainclaim"), name) - } - return obj.(*v1alpha1.ClusterDomainClaim), nil + return &clusterDomainClaimLister{listers.New[*v1alpha1.ClusterDomainClaim](indexer, v1alpha1.Resource("clusterdomainclaim"))} } diff --git a/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/ingress.go b/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/ingress.go index 273b22db74..60668cf0a0 100644 --- a/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/ingress.go +++ b/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/ingress.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" ) @@ -38,25 +38,17 @@ type IngressLister interface { // ingressLister implements the IngressLister interface. type ingressLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.Ingress] } // NewIngressLister returns a new IngressLister. func NewIngressLister(indexer cache.Indexer) IngressLister { - return &ingressLister{indexer: indexer} -} - -// List lists all Ingresses in the indexer. -func (s *ingressLister) List(selector labels.Selector) (ret []*v1alpha1.Ingress, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Ingress)) - }) - return ret, err + return &ingressLister{listers.New[*v1alpha1.Ingress](indexer, v1alpha1.Resource("ingress"))} } // Ingresses returns an object that can list and get Ingresses. func (s *ingressLister) Ingresses(namespace string) IngressNamespaceLister { - return ingressNamespaceLister{indexer: s.indexer, namespace: namespace} + return ingressNamespaceLister{listers.NewNamespaced[*v1alpha1.Ingress](s.ResourceIndexer, namespace)} } // IngressNamespaceLister helps list and get Ingresses. @@ -74,26 +66,5 @@ type IngressNamespaceLister interface { // ingressNamespaceLister implements the IngressNamespaceLister // interface. type ingressNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Ingresses in the indexer for a given namespace. -func (s ingressNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Ingress, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Ingress)) - }) - return ret, err -} - -// Get retrieves the Ingress from the indexer for a given namespace and name. -func (s ingressNamespaceLister) Get(name string) (*v1alpha1.Ingress, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("ingress"), name) - } - return obj.(*v1alpha1.Ingress), nil + listers.ResourceIndexer[*v1alpha1.Ingress] } diff --git a/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/serverlessservice.go b/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/serverlessservice.go index 01bd84f72b..4e7ecc6244 100644 --- a/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/serverlessservice.go +++ b/vendor/knative.dev/networking/pkg/client/listers/networking/v1alpha1/serverlessservice.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1" ) @@ -38,25 +38,17 @@ type ServerlessServiceLister interface { // serverlessServiceLister implements the ServerlessServiceLister interface. type serverlessServiceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ServerlessService] } // NewServerlessServiceLister returns a new ServerlessServiceLister. func NewServerlessServiceLister(indexer cache.Indexer) ServerlessServiceLister { - return &serverlessServiceLister{indexer: indexer} -} - -// List lists all ServerlessServices in the indexer. -func (s *serverlessServiceLister) List(selector labels.Selector) (ret []*v1alpha1.ServerlessService, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ServerlessService)) - }) - return ret, err + return &serverlessServiceLister{listers.New[*v1alpha1.ServerlessService](indexer, v1alpha1.Resource("serverlessservice"))} } // ServerlessServices returns an object that can list and get ServerlessServices. func (s *serverlessServiceLister) ServerlessServices(namespace string) ServerlessServiceNamespaceLister { - return serverlessServiceNamespaceLister{indexer: s.indexer, namespace: namespace} + return serverlessServiceNamespaceLister{listers.NewNamespaced[*v1alpha1.ServerlessService](s.ResourceIndexer, namespace)} } // ServerlessServiceNamespaceLister helps list and get ServerlessServices. @@ -74,26 +66,5 @@ type ServerlessServiceNamespaceLister interface { // serverlessServiceNamespaceLister implements the ServerlessServiceNamespaceLister // interface. type serverlessServiceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ServerlessServices in the indexer for a given namespace. -func (s serverlessServiceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ServerlessService, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ServerlessService)) - }) - return ret, err -} - -// Get retrieves the ServerlessService from the indexer for a given namespace and name. -func (s serverlessServiceNamespaceLister) Get(name string) (*v1alpha1.ServerlessService, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("serverlessservice"), name) - } - return obj.(*v1alpha1.ServerlessService), nil + listers.ResourceIndexer[*v1alpha1.ServerlessService] } diff --git a/vendor/modules.txt b/vendor/modules.txt index 9c4f904499..556bdb2130 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -31,7 +31,7 @@ github.com/davecgh/go-spew/spew ## explicit; go 1.13 github.com/emicklei/go-restful/v3 github.com/emicklei/go-restful/v3/log -# github.com/evanphx/json-patch/v5 v5.9.0 +# github.com/evanphx/json-patch/v5 v5.9.11 ## explicit; go 1.18 github.com/evanphx/json-patch/v5 github.com/evanphx/json-patch/v5/internal/json @@ -169,7 +169,7 @@ github.com/prometheus/statsd_exporter/pkg/mapper/fsm # github.com/rs/dnscache v0.0.0-20230804202142-fc85eb664529 ## explicit; go 1.12 github.com/rs/dnscache -# github.com/spf13/pflag v1.0.5 +# github.com/spf13/pflag v1.0.6 ## explicit; go 1.12 github.com/spf13/pflag # github.com/x448/float16 v0.8.4 @@ -1024,7 +1024,7 @@ k8s.io/utils/trace # knative.dev/hack v0.0.0-20250128013659-5f7f0f50e9de ## explicit; go 1.21 knative.dev/hack -# knative.dev/networking v0.0.0-20250128014447-43761241da75 +# knative.dev/networking v0.0.0-20250204225923-e6fc9bbf3fb0 ## explicit; go 1.22.7 knative.dev/networking/config knative.dev/networking/pkg @@ -1074,7 +1074,7 @@ knative.dev/networking/test/test_images/runtime/handlers knative.dev/networking/test/test_images/timeout knative.dev/networking/test/test_images/wsserver knative.dev/networking/test/types -# knative.dev/pkg v0.0.0-20250128013458-efddeac3ec35 +# knative.dev/pkg v0.0.0-20250203163623-f62a97fc6ad4 ## explicit; go 1.22.7 knative.dev/pkg/apis knative.dev/pkg/apis/duck