From 61e9128d1696c7f4a567efed84d77ae37bc0b734 Mon Sep 17 00:00:00 2001 From: Knative Automation Date: Tue, 17 Sep 2024 13:17:00 +0000 Subject: [PATCH] upgrade to latest dependencies bumping golang.org/x/tools 3057be8...7398f36: > 7398f36 all: fix some symbols error in comment > f111c72 go/callgraph/rta: skip test on js platform > 9f9b7e3 gopls/internal/settings: add missing deep cloning in Options.Clone > ce7eed4 doc/generate: minor cleanup > 075ae7d go/callgraph/vta: add basic tests for range-over-func > 2c7aaab go/ssa: skip failing test > 1b5663f go/callgraph/vta: perform minor cleanups > 0a49883 gopls/go.mod: update the go directive to 1.23.1 > ad366a8 go.mod: update golang.org/x dependencies > 4fb36d1 go/callgraph/rta: add rta analysis test case for multiple go packages > dc4d64c gopls: fix non-constant format strings > c758e54 cmd/callgraph: make vta use internal version of CHA > 94b564c go.mod: for consistency with other repos, use 1.22.0 in go.mod > 70f5626 all: with 1.23 out, update Go directive to Go 1.22 > 5a3171b internal/typesinternal: correct spec anchors in comments > c538e2c go/callgraph/static: avoid ssautil.AllFunctions > 2db563b internal/gcimporter: copy over ureader changes > 09886e0 go/callgraph/vta: allow nil initial call graph > e5ae0a9 internal/pkgbits: cleanup pre-Go 1.17 workaround > 264b4b5 go/callgraph/vta: add return parameter nodes for functions > 063360f gopls: update x/telemetry dependency > 28f3bc0 internal/pkgbits: copy over changes for V2 > fd2067f go/callgraph/vta: use struct{} instead of bool in sets > ce02ccd gopls/internal/test/marker: simplify completion markers > 4ead70c gopls: report semantic tokens of top-level type constructor modifiers > 826d8d9 gopls/internal/cache: add a note about GOMEMLIMIT and ballasts > aaf49f1 gopls/internal/cache: add a 100MB ballast to reduce GC CPU > 12307aa gopls/internal/util/lru: make lru.Cache generic > 594cdab gopls: increment the telemetryprompt acceptance counter for each session > adb7301 internal/versions: disable a test case incompatible with CL 607955 > 0734f62 internal/gcimporter: support type parameterized aliases in indexed format > b5f24ec internal/aliases: add type parameters argument to NewAliases > f5c7449 gopls/internal: implement Packages command > e5e8aa8 gopls/internal: implement Modules command > 9ef0547 internal/gcimporter: move indexed format docs > c7adb63 go/analysis/passes/fieldalignment: fix doc > 66adacf internal/pkgbits: improve ureader panic message > e104dc8 gopls/internal/settings: rename goTest code action to source.test > dfcdf50 go/analysis/passes/copylock: add support for ForStmt > 136c165 gopls/internal/cache: remove spurious assertions > 7cc3be7 internal/imports: use a clean GOMODCACHE for the scan root directory > d47b4fb internal/testfiles: adjust test so all modules are after 1.21 > c1241b9 internal/stdlib: update stdlib index for Go 1.23.0 > e6bef92 gopls/internal/golang: downgrade assertion in methodsets index > 7f262d6 all: disable tests incompatible with CL 603895 > a76f882 gopls: enhance read/write access distinction in document highlighting for symbols > 4dc9194 go/callgraph/vta: fix test under GODEBUG=gotypesalias=1 > 28ba991 go/analysis/passes/printf: add missing Unalias call bumping knative.dev/eventing c91a9d8...e79f3b6: > e79f3b6 Make auth package indepent from eventpolicy informer (# 8195) > ae6ed99 Fix JobSink to support AuthZ on GET too (# 8196) > 608e76c Add broker transformation test to upgrade tests (# 8190) bumping google.golang.org/grpc 00d3ec8...d0bf90a: > d0bf90a Change version to 1.66.2 (# 7620) > c84da66 Cherry pick # 7595 to v1.66.x release branch (# 7621) > 12487c8 Cherry pick # 7571 and # 7579 to v1.66.x release branch (# 7616) > 7185cf4 Change to version 1.66.2-dev (# 7615) > cb81df6 Change to patch release 1.66.1 (# 7603) > ecb3e1a Change version to 1.66.1-dev (# 7519) bumping knative.dev/reconciler-test bb4bca0...6372b7a: > 6372b7a upgrade to latest dependencies (# 756) bumping golang.org/x/mod bc151c4...46a3137: > 46a3137 zip: set GIT_DIR in test when using bare repositories > 3afcd4e go.mod: set go version to 1.22.0 > b1d336c go.mod: update required go version to go1.22 bumping knative.dev/caching 1bbe214...d1191d7: > d1191d7 upgrade to latest dependencies (# 891) bumping knative.dev/pkg 3002873...aaab500: > aaab500 Bump golang.org/x/tools from 0.24.0 to 0.25.0 (# 3091) > de0796c Bump google.golang.org/grpc from 1.66.0 to 1.66.2 (# 3092) bumping knative.dev/serving 74ea38a...cc9b060: > cc9b060 Update net-istio nightly (# 15511) > cde060b upgrade to latest dependencies (# 15506) > 985fc84 Update net-kourier nightly (# 15509) > edb073c Update net-contour nightly (# 15507) > 63b0f86 Update net-istio nightly (# 15508) bumping knative.dev/networking 433920a...ed319d7: > ed319d7 upgrade to latest dependencies (# 1004) Signed-off-by: Knative Automation --- go.mod | 18 +- go.sum | 36 +- .../x/tools/go/packages/external.go | 2 +- .../x/tools/internal/aliases/aliases.go | 10 +- .../x/tools/internal/aliases/aliases_go121.go | 4 +- .../x/tools/internal/aliases/aliases_go122.go | 5 +- .../x/tools/internal/gcimporter/iexport.go | 249 +++- .../x/tools/internal/gcimporter/iimport.go | 18 +- .../tools/internal/gcimporter/ureader_yes.go | 28 +- .../x/tools/internal/imports/mod.go | 9 +- .../x/tools/internal/pkgbits/decoder.go | 34 +- .../x/tools/internal/pkgbits/encoder.go | 43 +- .../x/tools/internal/pkgbits/frames_go1.go | 21 - .../x/tools/internal/pkgbits/frames_go17.go | 28 - .../x/tools/internal/pkgbits/support.go | 2 +- .../x/tools/internal/pkgbits/sync.go | 23 + .../internal/pkgbits/syncmarker_string.go | 7 +- .../x/tools/internal/pkgbits/version.go | 85 ++ .../x/tools/internal/stdlib/manifest.go | 2 +- .../tools/internal/typesinternal/errorcode.go | 8 +- .../grpc/experimental/stats/metricregistry.go | 11 +- .../grpc/internal/internal.go | 7 +- .../grpc/mem/buffer_slice.go | 12 +- vendor/google.golang.org/grpc/server.go | 1 + vendor/google.golang.org/grpc/version.go | 2 +- .../auth/{token_verifier.go => verifier.go} | 35 +- .../externalversions/eventing/interface.go | 78 -- .../externalversions/eventing/v1/broker.go | 90 -- .../externalversions/eventing/v1/interface.go | 52 - .../externalversions/eventing/v1/trigger.go | 90 -- .../eventing/v1alpha1/eventpolicy.go | 90 -- .../eventing/v1alpha1/interface.go | 45 - .../eventing/v1beta1/eventtype.go | 90 -- .../eventing/v1beta1/interface.go | 45 - .../eventing/v1beta2/eventtype.go | 90 -- .../eventing/v1beta2/interface.go | 45 - .../eventing/v1beta3/eventtype.go | 90 -- .../eventing/v1beta3/interface.go | 45 - .../informers/externalversions/factory.go | 285 ----- .../externalversions/flows/interface.go | 46 - .../externalversions/flows/v1/interface.go | 52 - .../externalversions/flows/v1/parallel.go | 90 -- .../externalversions/flows/v1/sequence.go | 90 -- .../informers/externalversions/generic.go | 121 -- .../internalinterfaces/factory_interfaces.go | 40 - .../externalversions/messaging/interface.go | 46 - .../externalversions/messaging/v1/channel.go | 90 -- .../messaging/v1/inmemorychannel.go | 90 -- .../messaging/v1/interface.go | 59 - .../messaging/v1/subscription.go | 90 -- .../externalversions/sinks/interface.go | 46 - .../sinks/v1alpha1/interface.go | 45 - .../sinks/v1alpha1/jobsink.go | 90 -- .../externalversions/sources/interface.go | 54 - .../sources/v1/apiserversource.go | 90 -- .../sources/v1/containersource.go | 90 -- .../externalversions/sources/v1/interface.go | 66 - .../externalversions/sources/v1/pingsource.go | 90 -- .../sources/v1/sinkbinding.go | 90 -- .../sources/v1beta2/interface.go | 45 - .../sources/v1beta2/pingsource.go | 90 -- .../v1alpha1/eventpolicy/eventpolicy.go | 52 - .../injection/informers/factory/factory.go | 56 - .../pkg/client/listers/eventing/v1/broker.go | 99 -- .../eventing/v1/expansion_generated.go | 35 - .../pkg/client/listers/eventing/v1/trigger.go | 99 -- .../listers/eventing/v1beta1/eventtype.go | 99 -- .../eventing/v1beta1/expansion_generated.go | 27 - .../listers/eventing/v1beta3/eventtype.go | 99 -- .../eventing/v1beta3/expansion_generated.go | 27 - .../listers/flows/v1/expansion_generated.go | 35 - .../pkg/client/listers/flows/v1/parallel.go | 99 -- .../pkg/client/listers/flows/v1/sequence.go | 99 -- .../client/listers/messaging/v1/channel.go | 99 -- .../messaging/v1/expansion_generated.go | 43 - .../listers/messaging/v1/inmemorychannel.go | 99 -- .../listers/messaging/v1/subscription.go | 99 -- .../sinks/v1alpha1/expansion_generated.go | 27 - .../client/listers/sinks/v1alpha1/jobsink.go | 99 -- .../listers/sources/v1/apiserversource.go | 99 -- .../listers/sources/v1/containersource.go | 99 -- .../listers/sources/v1/expansion_generated.go | 51 - .../client/listers/sources/v1/pingsource.go | 99 -- .../client/listers/sources/v1/sinkbinding.go | 99 -- .../sources/v1beta2/expansion_generated.go | 27 - .../listers/sources/v1beta2/pingsource.go | 99 -- .../rekt/features/broker/control_plane.go | 713 +++++++++++ .../rekt/features/broker/crossnamespace.go | 41 + .../test/rekt/features/broker/data_plane.go | 409 +++++++ .../test/rekt/features/broker/delivery.go | 43 + .../features/broker/eventing_tls_feature.go | 105 ++ .../test/rekt/features/broker/feature.go | 1084 +++++++++++++++++ .../test/rekt/features/broker/oidc_feature.go | 230 ++++ .../test/rekt/features/broker/readyness.go | 62 + .../rekt/features/broker/source_to_sink.go | 145 +++ .../test/rekt/features/broker/topology.go | 250 ++++ .../test/rekt/features/trigger/client.go | 66 + .../rekt/features/trigger/control_plane.go | 86 ++ .../rekt/features/trigger/crossnamespace.go | 81 ++ .../test/rekt/features/trigger/feature.go | 273 +++++ .../trigger/trigger_sink_resolution.go | 184 +++ .../test/rekt/resources/broker/broker.go | 289 +++++ .../test/rekt/resources/broker/broker.yaml | 77 ++ .../rekt/resources/pingsource/pingsource.go | 129 ++ .../rekt/resources/pingsource/pingsource.yaml | 56 + .../test/rekt/resources/trigger/trigger.go | 252 ++++ .../test/rekt/resources/trigger/trigger.yaml | 102 ++ .../eventing/test/upgrade/upgrade.go | 51 +- vendor/modules.txt | 54 +- 109 files changed, 5244 insertions(+), 4848 deletions(-) delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/frames_go1.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/frames_go17.go create mode 100644 vendor/golang.org/x/tools/internal/pkgbits/version.go rename vendor/knative.dev/eventing/pkg/auth/{token_verifier.go => verifier.go} (84%) delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/broker.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/trigger.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1/eventpolicy.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta1/eventtype.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta1/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta2/eventtype.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta2/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta3/eventtype.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta3/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/factory.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/parallel.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/sequence.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/generic.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/channel.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/inmemorychannel.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/subscription.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/v1alpha1/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/v1alpha1/jobsink.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/apiserversource.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/containersource.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/pingsource.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/sinkbinding.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1beta2/interface.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1beta2/pingsource.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy/eventpolicy.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/injection/informers/factory/factory.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/broker.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/expansion_generated.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/trigger.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta1/eventtype.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta1/expansion_generated.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta3/eventtype.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta3/expansion_generated.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/flows/v1/expansion_generated.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/flows/v1/parallel.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/flows/v1/sequence.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/channel.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/expansion_generated.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/inmemorychannel.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/subscription.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/sinks/v1alpha1/expansion_generated.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/sinks/v1alpha1/jobsink.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/sources/v1/apiserversource.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/sources/v1/containersource.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/sources/v1/expansion_generated.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/sources/v1/pingsource.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/sources/v1/sinkbinding.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/sources/v1beta2/expansion_generated.go delete mode 100644 vendor/knative.dev/eventing/pkg/client/listers/sources/v1beta2/pingsource.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/broker/control_plane.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/broker/crossnamespace.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/broker/data_plane.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/broker/delivery.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/broker/eventing_tls_feature.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/broker/feature.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/broker/oidc_feature.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/broker/readyness.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/broker/source_to_sink.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/broker/topology.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/trigger/client.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/trigger/control_plane.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/trigger/crossnamespace.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go create mode 100644 vendor/knative.dev/eventing/test/rekt/features/trigger/trigger_sink_resolution.go create mode 100644 vendor/knative.dev/eventing/test/rekt/resources/broker/broker.go create mode 100644 vendor/knative.dev/eventing/test/rekt/resources/broker/broker.yaml create mode 100644 vendor/knative.dev/eventing/test/rekt/resources/pingsource/pingsource.go create mode 100644 vendor/knative.dev/eventing/test/rekt/resources/pingsource/pingsource.yaml create mode 100644 vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go create mode 100644 vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml diff --git a/go.mod b/go.mod index 889dda4d49..797a11db70 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/manifestival/manifestival v0.7.2 go.uber.org/zap v1.27.0 gocloud.dev v0.22.0 - golang.org/x/mod v0.20.0 + golang.org/x/mod v0.21.0 golang.org/x/oauth2 v0.22.0 google.golang.org/api v0.183.0 istio.io/api v0.0.0-20231206023236-e7cadb36da57 @@ -20,12 +20,12 @@ require ( k8s.io/apimachinery v0.30.3 k8s.io/client-go v0.30.3 k8s.io/code-generator v0.30.3 - knative.dev/caching v0.0.0-20240909014459-1bbe214d75e7 - knative.dev/eventing v0.42.1-0.20240911141024-c91a9d8a471d + knative.dev/caching v0.0.0-20240917105744-d1191d7426a6 + knative.dev/eventing v0.42.1-0.20240917082247-e79f3b65893a knative.dev/hack v0.0.0-20240909014011-fc6a8452af6d - knative.dev/pkg v0.0.0-20240912132815-3002873b449c - knative.dev/reconciler-test v0.0.0-20240910170818-bb4bca018fb3 - knative.dev/serving v0.42.1-0.20240912104927-74ea38ab1b9c + knative.dev/pkg v0.0.0-20240917091217-aaab500c26c4 + knative.dev/reconciler-test v0.0.0-20240911144508-6372b7a0c4b1 + knative.dev/serving v0.42.1-0.20240917122220-cc9b0605d421 sigs.k8s.io/yaml v1.4.0 ) @@ -136,13 +136,13 @@ require ( golang.org/x/term v0.24.0 // indirect golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.24.0 // indirect + golang.org/x/tools v0.25.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/genproto v0.0.0-20240528184218-531527333157 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240808171019-573a1156607a // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect - google.golang.org/grpc v1.66.0 // indirect + google.golang.org/grpc v1.66.2 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect @@ -154,7 +154,7 @@ require ( k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect - knative.dev/networking v0.0.0-20240909015032-433920a35ef4 // indirect + knative.dev/networking v0.0.0-20240912132036-ed319d7a8e69 // indirect sigs.k8s.io/controller-runtime v0.7.2 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect diff --git a/go.sum b/go.sum index f92d7b8620..eb1edfc40e 100644 --- a/go.sum +++ b/go.sum @@ -902,8 +902,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1160,8 +1160,8 @@ golang.org/x/tools v0.0.0-20201203202102-a1a1cbeaa516/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1273,8 +1273,8 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= -google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1393,20 +1393,20 @@ k8s.io/utils v0.0.0-20200912215256-4140de9c8800/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -knative.dev/caching v0.0.0-20240909014459-1bbe214d75e7 h1:3eUgPW++INYPIU9w+/sRv33f3lmM8h1x74YfSUfzyWA= -knative.dev/caching v0.0.0-20240909014459-1bbe214d75e7/go.mod h1:AZc7UE6RQY614Zwae9xl6mdhGMf9DRSOwSaRKSV0H+Q= -knative.dev/eventing v0.42.1-0.20240911141024-c91a9d8a471d h1:/NvPwUqGfJ0VeLrPqjEb4zdEPz32qIooJnEqhaggF/U= -knative.dev/eventing v0.42.1-0.20240911141024-c91a9d8a471d/go.mod h1:gWM0Y5rhv2cLt/Se3q6z6zPNxsHb5oCS/5svsLeM06w= +knative.dev/caching v0.0.0-20240917105744-d1191d7426a6 h1:6hXj6mEoRDg01RKBMVextJlCQwdj2TbvpCNjYFASWyA= +knative.dev/caching v0.0.0-20240917105744-d1191d7426a6/go.mod h1:yO7HrEQ02tvQgsNwMWmh196DNEoBzhhXTklWfM3HFJk= +knative.dev/eventing v0.42.1-0.20240917082247-e79f3b65893a h1:+sUGejZz6GcTxfN05zH/Yad84aOgfBcmuPM6QxHNwNc= +knative.dev/eventing v0.42.1-0.20240917082247-e79f3b65893a/go.mod h1:gWM0Y5rhv2cLt/Se3q6z6zPNxsHb5oCS/5svsLeM06w= knative.dev/hack v0.0.0-20240909014011-fc6a8452af6d h1:mgROhGJG3+g0SBkaG4Y2HxrIOLN3ZZcN4+IFZla+Zqs= knative.dev/hack v0.0.0-20240909014011-fc6a8452af6d/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY= -knative.dev/networking v0.0.0-20240909015032-433920a35ef4 h1:ojjqMuTsY0DRQNdTAhkFl10cdchTzWkxwYjJS3oQ9dE= -knative.dev/networking v0.0.0-20240909015032-433920a35ef4/go.mod h1:i7nMwzWWbsorxAL9e88yTl/PugUDvtL6KtG5H/L0sg8= -knative.dev/pkg v0.0.0-20240912132815-3002873b449c h1:zKQ6HpKn6m20GgQ/NThGDFPwP9VSxv1j20aZDlRl3J8= -knative.dev/pkg v0.0.0-20240912132815-3002873b449c/go.mod h1:RHUKdAip7yEmlA6dc66hGANdLId04PMd2XJpFhP0EvI= -knative.dev/reconciler-test v0.0.0-20240910170818-bb4bca018fb3 h1:hyDKpYyIJDbflYApoGJ0OsThMHowP+Iuc2f1sUkc0bo= -knative.dev/reconciler-test v0.0.0-20240910170818-bb4bca018fb3/go.mod h1:u3B+FWMfmAnwoOfyzThIdv4C/6makY38pIKWoj7E1BM= -knative.dev/serving v0.42.1-0.20240912104927-74ea38ab1b9c h1:YoK2+riGMYAlFnI/onjzxQSzYfPE4lK4FzGO8J6P5DY= -knative.dev/serving v0.42.1-0.20240912104927-74ea38ab1b9c/go.mod h1:SaMptub7hykNnTquuVhU6Pkj8urFqJoV855o8mRN8BI= +knative.dev/networking v0.0.0-20240912132036-ed319d7a8e69 h1:/wALVX1aQuKyd5CESQ1wbZthg3PoVtKZ/7yXAQ/m94I= +knative.dev/networking v0.0.0-20240912132036-ed319d7a8e69/go.mod h1:uNMyf1MvJ6M0q5eKK/t+/fPB8tMn10nGKHO57X7HXA8= +knative.dev/pkg v0.0.0-20240917091217-aaab500c26c4 h1:1yMPCa3CnWH8darWwC3YxBJC19ZvE/XNA4RtNnxKPDM= +knative.dev/pkg v0.0.0-20240917091217-aaab500c26c4/go.mod h1:ZK0e9aChRwXJCpT8cypwvn/bJYTo6ygmyjiaz0E32EY= +knative.dev/reconciler-test v0.0.0-20240911144508-6372b7a0c4b1 h1:xjbWUo5ex3JGGJKLc+ycx0tG3uKfSTdt0o/4K+uCW1M= +knative.dev/reconciler-test v0.0.0-20240911144508-6372b7a0c4b1/go.mod h1:iePXOW89tyXNWqr/EeIH5jjH+kdTaMwG5zpvNjkzRtM= +knative.dev/serving v0.42.1-0.20240917122220-cc9b0605d421 h1:3KgJOfsxHL5UNBBC6d50UG0G+nV5DszZtnxS6PQu3VQ= +knative.dev/serving v0.42.1-0.20240917122220-cc9b0605d421/go.mod h1:cYasUYUq2wZBI87HqFai0JUGv0/ePqNGovIJooBYBsU= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= diff --git a/vendor/golang.org/x/tools/go/packages/external.go b/vendor/golang.org/x/tools/go/packages/external.go index c2b4b711b5..8f7afcb5df 100644 --- a/vendor/golang.org/x/tools/go/packages/external.go +++ b/vendor/golang.org/x/tools/go/packages/external.go @@ -82,7 +82,7 @@ type DriverResponse struct { type driver func(cfg *Config, patterns ...string) (*DriverResponse, error) // findExternalDriver returns the file path of a tool that supplies -// the build system package structure, or "" if not found." +// the build system package structure, or "" if not found. // If GOPACKAGESDRIVER is set in the environment findExternalTool returns its // value, otherwise it searches for a binary named gopackagesdriver on the PATH. func findExternalDriver(cfg *Config) driver { diff --git a/vendor/golang.org/x/tools/internal/aliases/aliases.go b/vendor/golang.org/x/tools/internal/aliases/aliases.go index c24c2eee45..f7798e3354 100644 --- a/vendor/golang.org/x/tools/internal/aliases/aliases.go +++ b/vendor/golang.org/x/tools/internal/aliases/aliases.go @@ -22,11 +22,17 @@ import ( // GODEBUG=gotypesalias=... by invoking the type checker. The Enabled // function is expensive and should be called once per task (e.g. // package import), not once per call to NewAlias. -func NewAlias(enabled bool, pos token.Pos, pkg *types.Package, name string, rhs types.Type) *types.TypeName { +// +// Precondition: enabled || len(tparams)==0. +// If materialized aliases are disabled, there must not be any type parameters. +func NewAlias(enabled bool, pos token.Pos, pkg *types.Package, name string, rhs types.Type, tparams []*types.TypeParam) *types.TypeName { if enabled { tname := types.NewTypeName(pos, pkg, name, nil) - newAlias(tname, rhs) + newAlias(tname, rhs, tparams) return tname } + if len(tparams) > 0 { + panic("cannot create an alias with type parameters when gotypesalias is not enabled") + } return types.NewTypeName(pos, pkg, name, rhs) } diff --git a/vendor/golang.org/x/tools/internal/aliases/aliases_go121.go b/vendor/golang.org/x/tools/internal/aliases/aliases_go121.go index 6652f7db0f..a775fcc4be 100644 --- a/vendor/golang.org/x/tools/internal/aliases/aliases_go121.go +++ b/vendor/golang.org/x/tools/internal/aliases/aliases_go121.go @@ -27,7 +27,9 @@ func Origin(alias *Alias) *Alias { panic("unreachabl // Unalias returns the type t for go <=1.21. func Unalias(t types.Type) types.Type { return t } -func newAlias(name *types.TypeName, rhs types.Type) *Alias { panic("unreachable") } +func newAlias(name *types.TypeName, rhs types.Type, tparams []*types.TypeParam) *Alias { + panic("unreachable") +} // Enabled reports whether [NewAlias] should create [types.Alias] types. // diff --git a/vendor/golang.org/x/tools/internal/aliases/aliases_go122.go b/vendor/golang.org/x/tools/internal/aliases/aliases_go122.go index 3ef1afeb40..31c159e42e 100644 --- a/vendor/golang.org/x/tools/internal/aliases/aliases_go122.go +++ b/vendor/golang.org/x/tools/internal/aliases/aliases_go122.go @@ -70,10 +70,9 @@ func Unalias(t types.Type) types.Type { return types.Unalias(t) } // newAlias is an internal alias around types.NewAlias. // Direct usage is discouraged as the moment. // Try to use NewAlias instead. -func newAlias(tname *types.TypeName, rhs types.Type) *Alias { +func newAlias(tname *types.TypeName, rhs types.Type, tparams []*types.TypeParam) *Alias { a := types.NewAlias(tname, rhs) - // TODO(go.dev/issue/65455): Remove kludgy workaround to set a.actual as a side-effect. - Unalias(a) + SetTypeParams(a, tparams) return a } diff --git a/vendor/golang.org/x/tools/internal/gcimporter/iexport.go b/vendor/golang.org/x/tools/internal/gcimporter/iexport.go index deeb67f315..5f283281a2 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/iexport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/iexport.go @@ -2,9 +2,227 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Indexed binary package export. -// This file was derived from $GOROOT/src/cmd/compile/internal/gc/iexport.go; -// see that file for specification of the format. +// Indexed package export. +// +// The indexed export data format is an evolution of the previous +// binary export data format. Its chief contribution is introducing an +// index table, which allows efficient random access of individual +// declarations and inline function bodies. In turn, this allows +// avoiding unnecessary work for compilation units that import large +// packages. +// +// +// The top-level data format is structured as: +// +// Header struct { +// Tag byte // 'i' +// Version uvarint +// StringSize uvarint +// DataSize uvarint +// } +// +// Strings [StringSize]byte +// Data [DataSize]byte +// +// MainIndex []struct{ +// PkgPath stringOff +// PkgName stringOff +// PkgHeight uvarint +// +// Decls []struct{ +// Name stringOff +// Offset declOff +// } +// } +// +// Fingerprint [8]byte +// +// uvarint means a uint64 written out using uvarint encoding. +// +// []T means a uvarint followed by that many T objects. In other +// words: +// +// Len uvarint +// Elems [Len]T +// +// stringOff means a uvarint that indicates an offset within the +// Strings section. At that offset is another uvarint, followed by +// that many bytes, which form the string value. +// +// declOff means a uvarint that indicates an offset within the Data +// section where the associated declaration can be found. +// +// +// There are five kinds of declarations, distinguished by their first +// byte: +// +// type Var struct { +// Tag byte // 'V' +// Pos Pos +// Type typeOff +// } +// +// type Func struct { +// Tag byte // 'F' or 'G' +// Pos Pos +// TypeParams []typeOff // only present if Tag == 'G' +// Signature Signature +// } +// +// type Const struct { +// Tag byte // 'C' +// Pos Pos +// Value Value +// } +// +// type Type struct { +// Tag byte // 'T' or 'U' +// Pos Pos +// TypeParams []typeOff // only present if Tag == 'U' +// Underlying typeOff +// +// Methods []struct{ // omitted if Underlying is an interface type +// Pos Pos +// Name stringOff +// Recv Param +// Signature Signature +// } +// } +// +// type Alias struct { +// Tag byte // 'A' or 'B' +// Pos Pos +// TypeParams []typeOff // only present if Tag == 'B' +// Type typeOff +// } +// +// // "Automatic" declaration of each typeparam +// type TypeParam struct { +// Tag byte // 'P' +// Pos Pos +// Implicit bool +// Constraint typeOff +// } +// +// typeOff means a uvarint that either indicates a predeclared type, +// or an offset into the Data section. If the uvarint is less than +// predeclReserved, then it indicates the index into the predeclared +// types list (see predeclared in bexport.go for order). Otherwise, +// subtracting predeclReserved yields the offset of a type descriptor. +// +// Value means a type, kind, and type-specific value. See +// (*exportWriter).value for details. +// +// +// There are twelve kinds of type descriptors, distinguished by an itag: +// +// type DefinedType struct { +// Tag itag // definedType +// Name stringOff +// PkgPath stringOff +// } +// +// type PointerType struct { +// Tag itag // pointerType +// Elem typeOff +// } +// +// type SliceType struct { +// Tag itag // sliceType +// Elem typeOff +// } +// +// type ArrayType struct { +// Tag itag // arrayType +// Len uint64 +// Elem typeOff +// } +// +// type ChanType struct { +// Tag itag // chanType +// Dir uint64 // 1 RecvOnly; 2 SendOnly; 3 SendRecv +// Elem typeOff +// } +// +// type MapType struct { +// Tag itag // mapType +// Key typeOff +// Elem typeOff +// } +// +// type FuncType struct { +// Tag itag // signatureType +// PkgPath stringOff +// Signature Signature +// } +// +// type StructType struct { +// Tag itag // structType +// PkgPath stringOff +// Fields []struct { +// Pos Pos +// Name stringOff +// Type typeOff +// Embedded bool +// Note stringOff +// } +// } +// +// type InterfaceType struct { +// Tag itag // interfaceType +// PkgPath stringOff +// Embeddeds []struct { +// Pos Pos +// Type typeOff +// } +// Methods []struct { +// Pos Pos +// Name stringOff +// Signature Signature +// } +// } +// +// // Reference to a type param declaration +// type TypeParamType struct { +// Tag itag // typeParamType +// Name stringOff +// PkgPath stringOff +// } +// +// // Instantiation of a generic type (like List[T2] or List[int]) +// type InstanceType struct { +// Tag itag // instanceType +// Pos pos +// TypeArgs []typeOff +// BaseType typeOff +// } +// +// type UnionType struct { +// Tag itag // interfaceType +// Terms []struct { +// tilde bool +// Type typeOff +// } +// } +// +// +// +// type Signature struct { +// Params []Param +// Results []Param +// Variadic bool // omitted if Results is empty +// } +// +// type Param struct { +// Pos Pos +// Name stringOff +// Type typOff +// } +// +// +// Pos encodes a file:line:column triple, incorporating a simple delta +// encoding scheme within a data object. See exportWriter.pos for +// details. package gcimporter @@ -523,9 +741,22 @@ func (p *iexporter) doDecl(obj types.Object) { } if obj.IsAlias() { - w.tag(aliasTag) + alias, materialized := t.(*aliases.Alias) // may fail when aliases are not enabled + + var tparams *types.TypeParamList + if materialized { + tparams = aliases.TypeParams(alias) + } + if tparams.Len() == 0 { + w.tag(aliasTag) + } else { + w.tag(genericAliasTag) + } w.pos(obj.Pos()) - if alias, ok := t.(*aliases.Alias); ok { + if tparams.Len() > 0 { + w.tparamList(obj.Name(), tparams, obj.Pkg()) + } + if materialized { // Preserve materialized aliases, // even of non-exported types. t = aliases.Rhs(alias) @@ -745,7 +976,13 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { } switch t := t.(type) { case *aliases.Alias: - // TODO(adonovan): support parameterized aliases, following *types.Named. + if targs := aliases.TypeArgs(t); targs.Len() > 0 { + w.startType(instanceType) + w.pos(t.Obj().Pos()) + w.typeList(targs, pkg) + w.typ(aliases.Origin(t), pkg) + return + } w.startType(aliasType) w.qualifiedType(t.Obj()) diff --git a/vendor/golang.org/x/tools/internal/gcimporter/iimport.go b/vendor/golang.org/x/tools/internal/gcimporter/iimport.go index 136aa03653..ed2d562959 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/iimport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/iimport.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Indexed package import. -// See cmd/compile/internal/gc/iexport.go for the export data format. +// See iexport.go for the export data format. // This file is a copy of $GOROOT/src/go/internal/gcimporter/iimport.go. @@ -562,14 +562,14 @@ func (r *importReader) obj(name string) { pos := r.pos() switch tag { - case aliasTag: + case aliasTag, genericAliasTag: + var tparams []*types.TypeParam + if tag == genericAliasTag { + tparams = r.tparamList() + } typ := r.typ() - // TODO(adonovan): support generic aliases: - // if tag == genericAliasTag { - // tparams := r.tparamList() - // alias.SetTypeParams(tparams) - // } - r.declare(aliases.NewAlias(r.p.aliases, pos, r.currPkg, name, typ)) + obj := aliases.NewAlias(r.p.aliases, pos, r.currPkg, name, typ, tparams) + r.declare(obj) case constTag: typ, val := r.value() @@ -862,7 +862,7 @@ func (r *importReader) string() string { return r.p.stringAt(r.uint64()) } func (r *importReader) doType(base *types.Named) (res types.Type) { k := r.kind() if debug { - r.p.trace("importing type %d (base: %s)", k, base) + r.p.trace("importing type %d (base: %v)", k, base) r.p.indent++ defer func() { r.p.indent-- diff --git a/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go b/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go index 2c07706887..f0742f5404 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go @@ -52,8 +52,7 @@ func (pr *pkgReader) later(fn func()) { // See cmd/compile/internal/noder.derivedInfo. type derivedInfo struct { - idx pkgbits.Index - needed bool + idx pkgbits.Index } // See cmd/compile/internal/noder.typeInfo. @@ -110,13 +109,17 @@ func readUnifiedPackage(fset *token.FileSet, ctxt *types.Context, imports map[st r := pr.newReader(pkgbits.RelocMeta, pkgbits.PublicRootIdx, pkgbits.SyncPublic) pkg := r.pkg() - r.Bool() // has init + if r.Version().Has(pkgbits.HasInit) { + r.Bool() + } for i, n := 0, r.Len(); i < n; i++ { // As if r.obj(), but avoiding the Scope.Lookup call, // to avoid eager loading of imports. r.Sync(pkgbits.SyncObject) - assert(!r.Bool()) + if r.Version().Has(pkgbits.DerivedFuncInstance) { + assert(!r.Bool()) + } r.p.objIdx(r.Reloc(pkgbits.RelocObj)) assert(r.Len() == 0) } @@ -165,7 +168,7 @@ type readerDict struct { // tparams is a slice of the constructed TypeParams for the element. tparams []*types.TypeParam - // devived is a slice of types derived from tparams, which may be + // derived is a slice of types derived from tparams, which may be // instantiated while reading the current element. derived []derivedInfo derivedTypes []types.Type // lazily instantiated from derived @@ -471,7 +474,9 @@ func (r *reader) param() *types.Var { func (r *reader) obj() (types.Object, []types.Type) { r.Sync(pkgbits.SyncObject) - assert(!r.Bool()) + if r.Version().Has(pkgbits.DerivedFuncInstance) { + assert(!r.Bool()) + } pkg, name := r.p.objIdx(r.Reloc(pkgbits.RelocObj)) obj := pkgScope(pkg).Lookup(name) @@ -525,8 +530,12 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) { case pkgbits.ObjAlias: pos := r.pos() + var tparams []*types.TypeParam + if r.Version().Has(pkgbits.AliasTypeParamNames) { + tparams = r.typeParamNames() + } typ := r.typ() - declare(aliases.NewAlias(r.p.aliases, pos, objPkg, objName, typ)) + declare(aliases.NewAlias(r.p.aliases, pos, objPkg, objName, typ, tparams)) case pkgbits.ObjConst: pos := r.pos() @@ -632,7 +641,10 @@ func (pr *pkgReader) objDictIdx(idx pkgbits.Index) *readerDict { dict.derived = make([]derivedInfo, r.Len()) dict.derivedTypes = make([]types.Type, len(dict.derived)) for i := range dict.derived { - dict.derived[i] = derivedInfo{r.Reloc(pkgbits.RelocType), r.Bool()} + dict.derived[i] = derivedInfo{idx: r.Reloc(pkgbits.RelocType)} + if r.Version().Has(pkgbits.DerivedInfoNeeded) { + assert(!r.Bool()) + } } pr.retireReader(r) diff --git a/vendor/golang.org/x/tools/internal/imports/mod.go b/vendor/golang.org/x/tools/internal/imports/mod.go index 91221fda32..8555e3f83d 100644 --- a/vendor/golang.org/x/tools/internal/imports/mod.go +++ b/vendor/golang.org/x/tools/internal/imports/mod.go @@ -245,7 +245,10 @@ func newModuleResolver(e *ProcessEnv, moduleCacheCache *DirInfoCache) (*ModuleRe // 2. Use this to separate module cache scanning from other scanning. func gomodcacheForEnv(goenv map[string]string) string { if gmc := goenv["GOMODCACHE"]; gmc != "" { - return gmc + // golang/go#67156: ensure that the module cache is clean, since it is + // assumed as a prefix to directories scanned by gopathwalk, which are + // themselves clean. + return filepath.Clean(gmc) } gopaths := filepath.SplitList(goenv["GOPATH"]) if len(gopaths) == 0 { @@ -740,8 +743,8 @@ func (r *ModuleResolver) loadExports(ctx context.Context, pkg *pkg, includeTest func (r *ModuleResolver) scanDirForPackage(root gopathwalk.Root, dir string) directoryPackageInfo { subdir := "" - if dir != root.Path { - subdir = dir[len(root.Path)+len("/"):] + if prefix := root.Path + string(filepath.Separator); strings.HasPrefix(dir, prefix) { + subdir = dir[len(prefix):] } importPath := filepath.ToSlash(subdir) if strings.HasPrefix(importPath, "vendor/") { diff --git a/vendor/golang.org/x/tools/internal/pkgbits/decoder.go b/vendor/golang.org/x/tools/internal/pkgbits/decoder.go index b92e8e6eb3..f6cb37c5c3 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/decoder.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/decoder.go @@ -21,7 +21,7 @@ import ( // export data. type PkgDecoder struct { // version is the file format version. - version uint32 + version Version // sync indicates whether the file uses sync markers. sync bool @@ -68,8 +68,6 @@ func (pr *PkgDecoder) SyncMarkers() bool { return pr.sync } // NewPkgDecoder returns a PkgDecoder initialized to read the Unified // IR export data from input. pkgPath is the package path for the // compilation unit that produced the export data. -// -// TODO(mdempsky): Remove pkgPath parameter; unneeded since CL 391014. func NewPkgDecoder(pkgPath, input string) PkgDecoder { pr := PkgDecoder{ pkgPath: pkgPath, @@ -80,14 +78,15 @@ func NewPkgDecoder(pkgPath, input string) PkgDecoder { r := strings.NewReader(input) - assert(binary.Read(r, binary.LittleEndian, &pr.version) == nil) + var ver uint32 + assert(binary.Read(r, binary.LittleEndian, &ver) == nil) + pr.version = Version(ver) - switch pr.version { - default: - panic(fmt.Errorf("unsupported version: %v", pr.version)) - case 0: - // no flags - case 1: + if pr.version >= numVersions { + panic(fmt.Errorf("cannot decode %q, export data version %d is greater than maximum supported version %d", pkgPath, pr.version, numVersions-1)) + } + + if pr.version.Has(Flags) { var flags uint32 assert(binary.Read(r, binary.LittleEndian, &flags) == nil) pr.sync = flags&flagSyncMarkers != 0 @@ -102,7 +101,9 @@ func NewPkgDecoder(pkgPath, input string) PkgDecoder { assert(err == nil) pr.elemData = input[pos:] - assert(len(pr.elemData)-8 == int(pr.elemEnds[len(pr.elemEnds)-1])) + + const fingerprintSize = 8 + assert(len(pr.elemData)-fingerprintSize == int(pr.elemEnds[len(pr.elemEnds)-1])) return pr } @@ -136,7 +137,7 @@ func (pr *PkgDecoder) AbsIdx(k RelocKind, idx Index) int { absIdx += int(pr.elemEndsEnds[k-1]) } if absIdx >= int(pr.elemEndsEnds[k]) { - errorf("%v:%v is out of bounds; %v", k, idx, pr.elemEndsEnds) + panicf("%v:%v is out of bounds; %v", k, idx, pr.elemEndsEnds) } return absIdx } @@ -193,9 +194,7 @@ func (pr *PkgDecoder) NewDecoderRaw(k RelocKind, idx Index) Decoder { Idx: idx, } - // TODO(mdempsky) r.data.Reset(...) after #44505 is resolved. - r.Data = *strings.NewReader(pr.DataIdx(k, idx)) - + r.Data.Reset(pr.DataIdx(k, idx)) r.Sync(SyncRelocs) r.Relocs = make([]RelocEnt, r.Len()) for i := range r.Relocs { @@ -244,7 +243,7 @@ type Decoder struct { func (r *Decoder) checkErr(err error) { if err != nil { - errorf("unexpected decoding error: %w", err) + panicf("unexpected decoding error: %w", err) } } @@ -515,3 +514,6 @@ func (pr *PkgDecoder) PeekObj(idx Index) (string, string, CodeObj) { return path, name, tag } + +// Version reports the version of the bitstream. +func (w *Decoder) Version() Version { return w.common.version } diff --git a/vendor/golang.org/x/tools/internal/pkgbits/encoder.go b/vendor/golang.org/x/tools/internal/pkgbits/encoder.go index 6482617a4f..c17a12399d 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/encoder.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/encoder.go @@ -12,18 +12,15 @@ import ( "io" "math/big" "runtime" + "strings" ) -// currentVersion is the current version number. -// -// - v0: initial prototype -// -// - v1: adds the flags uint32 word -const currentVersion uint32 = 1 - // A PkgEncoder provides methods for encoding a package's Unified IR // export data. type PkgEncoder struct { + // version of the bitstream. + version Version + // elems holds the bitstream for previously encoded elements. elems [numRelocs][]string @@ -47,8 +44,9 @@ func (pw *PkgEncoder) SyncMarkers() bool { return pw.syncFrames >= 0 } // export data files, but can help diagnosing desync errors in // higher-level Unified IR reader/writer code. If syncFrames is // negative, then sync markers are omitted entirely. -func NewPkgEncoder(syncFrames int) PkgEncoder { +func NewPkgEncoder(version Version, syncFrames int) PkgEncoder { return PkgEncoder{ + version: version, stringsIdx: make(map[string]Index), syncFrames: syncFrames, } @@ -64,13 +62,15 @@ func (pw *PkgEncoder) DumpTo(out0 io.Writer) (fingerprint [8]byte) { assert(binary.Write(out, binary.LittleEndian, x) == nil) } - writeUint32(currentVersion) + writeUint32(uint32(pw.version)) - var flags uint32 - if pw.SyncMarkers() { - flags |= flagSyncMarkers + if pw.version.Has(Flags) { + var flags uint32 + if pw.SyncMarkers() { + flags |= flagSyncMarkers + } + writeUint32(flags) } - writeUint32(flags) // Write elemEndsEnds. var sum uint32 @@ -159,7 +159,7 @@ type Encoder struct { // Flush finalizes the element's bitstream and returns its Index. func (w *Encoder) Flush() Index { - var sb bytes.Buffer // TODO(mdempsky): strings.Builder after #44505 is resolved + var sb strings.Builder // Backup the data so we write the relocations at the front. var tmp bytes.Buffer @@ -189,7 +189,7 @@ func (w *Encoder) Flush() Index { func (w *Encoder) checkErr(err error) { if err != nil { - errorf("unexpected encoding error: %v", err) + panicf("unexpected encoding error: %v", err) } } @@ -320,8 +320,14 @@ func (w *Encoder) Code(c Code) { // section (if not already present), and then writing a relocation // into the element bitstream. func (w *Encoder) String(s string) { + w.StringRef(w.p.StringIdx(s)) +} + +// StringRef writes a reference to the given index, which must be a +// previously encoded string value. +func (w *Encoder) StringRef(idx Index) { w.Sync(SyncString) - w.Reloc(RelocString, w.p.StringIdx(s)) + w.Reloc(RelocString, idx) } // Strings encodes and writes a variable-length slice of strings into @@ -348,7 +354,7 @@ func (w *Encoder) Value(val constant.Value) { func (w *Encoder) scalar(val constant.Value) { switch v := constant.Val(val).(type) { default: - errorf("unhandled %v (%v)", val, val.Kind()) + panicf("unhandled %v (%v)", val, val.Kind()) case bool: w.Code(ValBool) w.Bool(v) @@ -381,3 +387,6 @@ func (w *Encoder) bigFloat(v *big.Float) { b := v.Append(nil, 'p', -1) w.String(string(b)) // TODO: More efficient encoding. } + +// Version reports the version of the bitstream. +func (w *Encoder) Version() Version { return w.p.version } diff --git a/vendor/golang.org/x/tools/internal/pkgbits/frames_go1.go b/vendor/golang.org/x/tools/internal/pkgbits/frames_go1.go deleted file mode 100644 index 5294f6a63e..0000000000 --- a/vendor/golang.org/x/tools/internal/pkgbits/frames_go1.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.7 -// +build !go1.7 - -// TODO(mdempsky): Remove after #44505 is resolved - -package pkgbits - -import "runtime" - -func walkFrames(pcs []uintptr, visit frameVisitor) { - for _, pc := range pcs { - fn := runtime.FuncForPC(pc) - file, line := fn.FileLine(pc) - - visit(file, line, fn.Name(), pc-fn.Entry()) - } -} diff --git a/vendor/golang.org/x/tools/internal/pkgbits/frames_go17.go b/vendor/golang.org/x/tools/internal/pkgbits/frames_go17.go deleted file mode 100644 index 2324ae7adf..0000000000 --- a/vendor/golang.org/x/tools/internal/pkgbits/frames_go17.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.7 -// +build go1.7 - -package pkgbits - -import "runtime" - -// walkFrames calls visit for each call frame represented by pcs. -// -// pcs should be a slice of PCs, as returned by runtime.Callers. -func walkFrames(pcs []uintptr, visit frameVisitor) { - if len(pcs) == 0 { - return - } - - frames := runtime.CallersFrames(pcs) - for { - frame, more := frames.Next() - visit(frame.File, frame.Line, frame.Function, frame.PC-frame.Entry) - if !more { - return - } - } -} diff --git a/vendor/golang.org/x/tools/internal/pkgbits/support.go b/vendor/golang.org/x/tools/internal/pkgbits/support.go index ad26d3b28c..50534a2955 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/support.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/support.go @@ -12,6 +12,6 @@ func assert(b bool) { } } -func errorf(format string, args ...interface{}) { +func panicf(format string, args ...any) { panic(fmt.Errorf(format, args...)) } diff --git a/vendor/golang.org/x/tools/internal/pkgbits/sync.go b/vendor/golang.org/x/tools/internal/pkgbits/sync.go index 5bd51ef717..1520b73afb 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/sync.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/sync.go @@ -6,6 +6,7 @@ package pkgbits import ( "fmt" + "runtime" "strings" ) @@ -23,6 +24,24 @@ func fmtFrames(pcs ...uintptr) []string { type frameVisitor func(file string, line int, name string, offset uintptr) +// walkFrames calls visit for each call frame represented by pcs. +// +// pcs should be a slice of PCs, as returned by runtime.Callers. +func walkFrames(pcs []uintptr, visit frameVisitor) { + if len(pcs) == 0 { + return + } + + frames := runtime.CallersFrames(pcs) + for { + frame, more := frames.Next() + visit(frame.File, frame.Line, frame.Function, frame.PC-frame.Entry) + if !more { + return + } + } +} + // SyncMarker is an enum type that represents markers that may be // written to export data to ensure the reader and writer stay // synchronized. @@ -110,4 +129,8 @@ const ( SyncStmtsEnd SyncLabel SyncOptLabel + + SyncMultiExpr + SyncRType + SyncConvRTTI ) diff --git a/vendor/golang.org/x/tools/internal/pkgbits/syncmarker_string.go b/vendor/golang.org/x/tools/internal/pkgbits/syncmarker_string.go index 4a5b0ca5f2..582ad56d3e 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/syncmarker_string.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/syncmarker_string.go @@ -74,11 +74,14 @@ func _() { _ = x[SyncStmtsEnd-64] _ = x[SyncLabel-65] _ = x[SyncOptLabel-66] + _ = x[SyncMultiExpr-67] + _ = x[SyncRType-68] + _ = x[SyncConvRTTI-69] } -const _SyncMarker_name = "EOFBoolInt64Uint64StringValueValRelocsRelocUseRelocPublicPosPosBaseObjectObject1PkgPkgDefMethodTypeTypeIdxTypeParamNamesSignatureParamsParamCodeObjSymLocalIdentSelectorPrivateFuncExtVarExtTypeExtPragmaExprListExprsExprExprTypeAssignOpFuncLitCompLitDeclFuncBodyOpenScopeCloseScopeCloseAnotherScopeDeclNamesDeclNameStmtsBlockStmtIfStmtForStmtSwitchStmtRangeStmtCaseClauseCommClauseSelectStmtDeclsLabeledStmtUseObjLocalAddLocalLinknameStmt1StmtsEndLabelOptLabel" +const _SyncMarker_name = "EOFBoolInt64Uint64StringValueValRelocsRelocUseRelocPublicPosPosBaseObjectObject1PkgPkgDefMethodTypeTypeIdxTypeParamNamesSignatureParamsParamCodeObjSymLocalIdentSelectorPrivateFuncExtVarExtTypeExtPragmaExprListExprsExprExprTypeAssignOpFuncLitCompLitDeclFuncBodyOpenScopeCloseScopeCloseAnotherScopeDeclNamesDeclNameStmtsBlockStmtIfStmtForStmtSwitchStmtRangeStmtCaseClauseCommClauseSelectStmtDeclsLabeledStmtUseObjLocalAddLocalLinknameStmt1StmtsEndLabelOptLabelMultiExprRTypeConvRTTI" -var _SyncMarker_index = [...]uint16{0, 3, 7, 12, 18, 24, 29, 32, 38, 43, 51, 57, 60, 67, 73, 80, 83, 89, 95, 99, 106, 120, 129, 135, 140, 147, 150, 160, 168, 175, 182, 188, 195, 201, 209, 214, 218, 226, 232, 234, 241, 248, 252, 260, 269, 279, 296, 305, 313, 318, 327, 333, 340, 350, 359, 369, 379, 389, 394, 405, 416, 424, 432, 437, 445, 450, 458} +var _SyncMarker_index = [...]uint16{0, 3, 7, 12, 18, 24, 29, 32, 38, 43, 51, 57, 60, 67, 73, 80, 83, 89, 95, 99, 106, 120, 129, 135, 140, 147, 150, 160, 168, 175, 182, 188, 195, 201, 209, 214, 218, 226, 232, 234, 241, 248, 252, 260, 269, 279, 296, 305, 313, 318, 327, 333, 340, 350, 359, 369, 379, 389, 394, 405, 416, 424, 432, 437, 445, 450, 458, 467, 472, 480} func (i SyncMarker) String() string { i -= 1 diff --git a/vendor/golang.org/x/tools/internal/pkgbits/version.go b/vendor/golang.org/x/tools/internal/pkgbits/version.go new file mode 100644 index 0000000000..53af9df22b --- /dev/null +++ b/vendor/golang.org/x/tools/internal/pkgbits/version.go @@ -0,0 +1,85 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pkgbits + +// Version indicates a version of a unified IR bitstream. +// Each Version indicates the addition, removal, or change of +// new data in the bitstream. +// +// These are serialized to disk and the interpretation remains fixed. +type Version uint32 + +const ( + // V0: initial prototype. + // + // All data that is not assigned a Field is in version V0 + // and has not been deprecated. + V0 Version = iota + + // V1: adds the Flags uint32 word + V1 + + // V2: removes unused legacy fields and supports type parameters for aliases. + // - remove the legacy "has init" bool from the public root + // - remove obj's "derived func instance" bool + // - add a TypeParamNames field to ObjAlias + // - remove derived info "needed" bool + V2 + + numVersions = iota +) + +// Field denotes a unit of data in the serialized unified IR bitstream. +// It is conceptually a like field in a structure. +// +// We only really need Fields when the data may or may not be present +// in a stream based on the Version of the bitstream. +// +// Unlike much of pkgbits, Fields are not serialized and +// can change values as needed. +type Field int + +const ( + // Flags in a uint32 in the header of a bitstream + // that is used to indicate whether optional features are enabled. + Flags Field = iota + + // Deprecated: HasInit was a bool indicating whether a package + // has any init functions. + HasInit + + // Deprecated: DerivedFuncInstance was a bool indicating + // whether an object was a function instance. + DerivedFuncInstance + + // ObjAlias has a list of TypeParamNames. + AliasTypeParamNames + + // Deprecated: DerivedInfoNeeded was a bool indicating + // whether a type was a derived type. + DerivedInfoNeeded + + numFields = iota +) + +// introduced is the version a field was added. +var introduced = [numFields]Version{ + Flags: V1, + AliasTypeParamNames: V2, +} + +// removed is the version a field was removed in or 0 for fields +// that have not yet been deprecated. +// (So removed[f]-1 is the last version it is included in.) +var removed = [numFields]Version{ + HasInit: V2, + DerivedFuncInstance: V2, + DerivedInfoNeeded: V2, +} + +// Has reports whether field f is present in a bitstream at version v. +func (v Version) Has(f Field) bool { + return introduced[f] <= v && (v < removed[f] || removed[f] == V0) +} diff --git a/vendor/golang.org/x/tools/internal/stdlib/manifest.go b/vendor/golang.org/x/tools/internal/stdlib/manifest.go index a928acf29f..cdaac9ab34 100644 --- a/vendor/golang.org/x/tools/internal/stdlib/manifest.go +++ b/vendor/golang.org/x/tools/internal/stdlib/manifest.go @@ -951,7 +951,7 @@ var PackageSymbols = map[string][]Symbol{ {"ParseSessionState", Func, 21}, {"QUICClient", Func, 21}, {"QUICConfig", Type, 21}, - {"QUICConfig.EnableStoreSessionEvent", Field, 23}, + {"QUICConfig.EnableSessionEvents", Field, 23}, {"QUICConfig.TLSConfig", Field, 21}, {"QUICConn", Type, 21}, {"QUICEncryptionLevel", Type, 21}, diff --git a/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go b/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go index 834e05381c..131caab284 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go @@ -838,7 +838,7 @@ const ( // InvalidCap occurs when an argument to the cap built-in function is not of // supported type. // - // See https://golang.org/ref/spec#Lengthand_capacity for information on + // See https://golang.org/ref/spec#Length_and_capacity for information on // which underlying types are supported as arguments to cap and len. // // Example: @@ -859,7 +859,7 @@ const ( // InvalidCopy occurs when the arguments are not of slice type or do not // have compatible type. // - // See https://golang.org/ref/spec#Appendingand_copying_slices for more + // See https://golang.org/ref/spec#Appending_and_copying_slices for more // information on the type requirements for the copy built-in. // // Example: @@ -897,7 +897,7 @@ const ( // InvalidLen occurs when an argument to the len built-in function is not of // supported type. // - // See https://golang.org/ref/spec#Lengthand_capacity for information on + // See https://golang.org/ref/spec#Length_and_capacity for information on // which underlying types are supported as arguments to cap and len. // // Example: @@ -914,7 +914,7 @@ const ( // InvalidMake occurs when make is called with an unsupported type argument. // - // See https://golang.org/ref/spec#Makingslices_maps_and_channels for + // See https://golang.org/ref/spec#Making_slices_maps_and_channels for // information on the types that may be created using make. // // Example: diff --git a/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go b/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go index 930140f57e..1d827dd5d9 100644 --- a/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go +++ b/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go @@ -20,7 +20,6 @@ package stats import ( "maps" - "testing" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" @@ -250,9 +249,9 @@ func RegisterInt64Gauge(descriptor MetricDescriptor) *Int64GaugeHandle { } // snapshotMetricsRegistryForTesting snapshots the global data of the metrics -// registry. Registers a cleanup function on the provided testing.T that sets -// the metrics registry to its original state. Only called in testing functions. -func snapshotMetricsRegistryForTesting(t *testing.T) { +// registry. Returns a cleanup function that sets the metrics registry to its +// original state. +func snapshotMetricsRegistryForTesting() func() { oldDefaultMetrics := DefaultMetrics oldRegisteredMetrics := registeredMetrics oldMetricsRegistry := metricsRegistry @@ -262,9 +261,9 @@ func snapshotMetricsRegistryForTesting(t *testing.T) { maps.Copy(registeredMetrics, registeredMetrics) maps.Copy(metricsRegistry, metricsRegistry) - t.Cleanup(func() { + return func() { DefaultMetrics = oldDefaultMetrics registeredMetrics = oldRegisteredMetrics metricsRegistry = oldMetricsRegistry - }) + } } diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index 65f936a623..73fa407b6c 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -217,10 +217,9 @@ var ( SetConnectedAddress any // func(scs *SubConnState, addr resolver.Address) // SnapshotMetricRegistryForTesting snapshots the global data of the metric - // registry. Registers a cleanup function on the provided testing.T that - // sets the metric registry to its original state. Only called in testing - // functions. - SnapshotMetricRegistryForTesting any // func(t *testing.T) + // registry. Returns a cleanup function that sets the metric registry to its + // original state. Only called in testing functions. + SnapshotMetricRegistryForTesting func() func() // SetDefaultBufferPoolForTesting updates the default buffer pool, for // testing purposes. diff --git a/vendor/google.golang.org/grpc/mem/buffer_slice.go b/vendor/google.golang.org/grpc/mem/buffer_slice.go index d7775cea62..228e9c2f20 100644 --- a/vendor/google.golang.org/grpc/mem/buffer_slice.go +++ b/vendor/google.golang.org/grpc/mem/buffer_slice.go @@ -19,7 +19,6 @@ package mem import ( - "compress/flate" "io" ) @@ -92,9 +91,11 @@ func (s BufferSlice) Materialize() []byte { } // MaterializeToBuffer functions like Materialize except that it writes the data -// to a single Buffer pulled from the given BufferPool. As a special case, if the -// input BufferSlice only actually has one Buffer, this function has nothing to -// do and simply returns said Buffer. +// to a single Buffer pulled from the given BufferPool. +// +// As a special case, if the input BufferSlice only actually has one Buffer, this +// function simply increases the refcount before returning said Buffer. Freeing this +// buffer won't release it until the BufferSlice is itself released. func (s BufferSlice) MaterializeToBuffer(pool BufferPool) Buffer { if len(s) == 1 { s[0].Ref() @@ -124,7 +125,8 @@ func (s BufferSlice) Reader() Reader { // Remaining(), which returns the number of unread bytes remaining in the slice. // Buffers will be freed as they are read. type Reader interface { - flate.Reader + io.Reader + io.ByteReader // Close frees the underlying BufferSlice and never returns an error. Subsequent // calls to Read will return (0, io.EOF). Close() error diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index 457d27338f..d1e1415a40 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -1359,6 +1359,7 @@ func (s *Server) processUnaryRPC(ctx context.Context, t transport.ServerTranspor } return err } + defer d.Free() if channelz.IsOn() { t.IncrMsgRecv() } diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index 1ffec6e2ce..7c70005d08 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.66.0" +const Version = "1.66.2" diff --git a/vendor/knative.dev/eventing/pkg/auth/token_verifier.go b/vendor/knative.dev/eventing/pkg/auth/verifier.go similarity index 84% rename from vendor/knative.dev/eventing/pkg/auth/token_verifier.go rename to vendor/knative.dev/eventing/pkg/auth/verifier.go index 0d2c3888b9..3cf9c436bc 100644 --- a/vendor/knative.dev/eventing/pkg/auth/token_verifier.go +++ b/vendor/knative.dev/eventing/pkg/auth/verifier.go @@ -27,7 +27,6 @@ import ( "time" duckv1 "knative.dev/eventing/pkg/apis/duck/v1" - eventpolicyinformer "knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy" "knative.dev/eventing/pkg/client/listers/eventing/v1alpha1" "github.com/cloudevents/sdk-go/v2/binding" @@ -37,6 +36,7 @@ import ( "k8s.io/client-go/rest" eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" "knative.dev/eventing/pkg/apis/feature" + listerseventingv1alpha1 "knative.dev/eventing/pkg/client/listers/eventing/v1alpha1" "knative.dev/pkg/injection" "knative.dev/pkg/logging" ) @@ -45,7 +45,7 @@ const ( kubernetesOIDCDiscoveryBaseURL = "https://kubernetes.default.svc" ) -type OIDCTokenVerifier struct { +type Verifier struct { logger *zap.SugaredLogger restConfig *rest.Config provider *oidc.Provider @@ -61,11 +61,11 @@ type IDToken struct { AccessTokenHash string } -func NewOIDCTokenVerifier(ctx context.Context) *OIDCTokenVerifier { - tokenHandler := &OIDCTokenVerifier{ +func NewVerifier(ctx context.Context, eventPolicyLister listerseventingv1alpha1.EventPolicyLister) *Verifier { + tokenHandler := &Verifier{ logger: logging.FromContext(ctx).With("component", "oidc-token-handler"), restConfig: injection.GetConfig(ctx), - eventPolicyLister: eventpolicyinformer.Get(ctx).Lister(), + eventPolicyLister: eventPolicyLister, } if err := tokenHandler.initOIDCProvider(ctx); err != nil { @@ -75,18 +75,9 @@ func NewOIDCTokenVerifier(ctx context.Context) *OIDCTokenVerifier { return tokenHandler } -// VerifyJWTFromRequest verifies if the incoming request contains a correct JWT token -// -// Deprecated: use OIDCTokenVerifier.Verify() instead to bundle AuthN and AuthZ verification -func (v *OIDCTokenVerifier) VerifyJWTFromRequest(ctx context.Context, r *http.Request, audience *string, response http.ResponseWriter) error { - _, err := v.verifyAuthN(ctx, audience, r, response) - - return err -} - // VerifyRequest verifies AuthN and AuthZ in the request. On verification errors, it sets the // responses HTTP status and returns an error -func (v *OIDCTokenVerifier) VerifyRequest(ctx context.Context, features feature.Flags, requiredOIDCAudience *string, resourceNamespace string, policyRefs []duckv1.AppliedEventPolicyRef, req *http.Request, resp http.ResponseWriter) error { +func (v *Verifier) VerifyRequest(ctx context.Context, features feature.Flags, requiredOIDCAudience *string, resourceNamespace string, policyRefs []duckv1.AppliedEventPolicyRef, req *http.Request, resp http.ResponseWriter) error { if !features.IsOIDCAuthentication() { return nil } @@ -109,7 +100,7 @@ func (v *OIDCTokenVerifier) VerifyRequest(ctx context.Context, features feature. // On verification errors, it sets the responses HTTP status and returns an error. // This method is similar to VerifyRequest() except that VerifyRequestFromSubject() // verifies in the AuthZ part that the request comes from a given subject. -func (v *OIDCTokenVerifier) VerifyRequestFromSubject(ctx context.Context, features feature.Flags, requiredOIDCAudience *string, allowedSubject string, req *http.Request, resp http.ResponseWriter) error { +func (v *Verifier) VerifyRequestFromSubject(ctx context.Context, features feature.Flags, requiredOIDCAudience *string, allowedSubject string, req *http.Request, resp http.ResponseWriter) error { if !features.IsOIDCAuthentication() { return nil } @@ -128,7 +119,7 @@ func (v *OIDCTokenVerifier) VerifyRequestFromSubject(ctx context.Context, featur } // verifyAuthN verifies if the incoming request contains a correct JWT token -func (v *OIDCTokenVerifier) verifyAuthN(ctx context.Context, audience *string, req *http.Request, resp http.ResponseWriter) (*IDToken, error) { +func (v *Verifier) verifyAuthN(ctx context.Context, audience *string, req *http.Request, resp http.ResponseWriter) (*IDToken, error) { token := GetJWTFromHeader(req.Header) if token == "" { resp.WriteHeader(http.StatusUnauthorized) @@ -150,7 +141,7 @@ func (v *OIDCTokenVerifier) verifyAuthN(ctx context.Context, audience *string, r } // verifyAuthZ verifies if the given idToken is allowed by the resources eventPolicyStatus -func (v *OIDCTokenVerifier) verifyAuthZ(ctx context.Context, features feature.Flags, idToken *IDToken, resourceNamespace string, policyRefs []duckv1.AppliedEventPolicyRef, req *http.Request, resp http.ResponseWriter) error { +func (v *Verifier) verifyAuthZ(ctx context.Context, features feature.Flags, idToken *IDToken, resourceNamespace string, policyRefs []duckv1.AppliedEventPolicyRef, req *http.Request, resp http.ResponseWriter) error { if len(policyRefs) > 0 { req, err := copyRequest(req) if err != nil { @@ -204,7 +195,7 @@ func (v *OIDCTokenVerifier) verifyAuthZ(ctx context.Context, features feature.Fl } // verifyJWT verifies the given JWT for the expected audience and returns the parsed ID token. -func (v *OIDCTokenVerifier) verifyJWT(ctx context.Context, jwt, audience string) (*IDToken, error) { +func (v *Verifier) verifyJWT(ctx context.Context, jwt, audience string) (*IDToken, error) { if v.provider == nil { return nil, fmt.Errorf("provider is nil. Is the OIDC provider config correct?") } @@ -228,7 +219,7 @@ func (v *OIDCTokenVerifier) verifyJWT(ctx context.Context, jwt, audience string) }, nil } -func (v *OIDCTokenVerifier) initOIDCProvider(ctx context.Context) error { +func (v *Verifier) initOIDCProvider(ctx context.Context) error { discovery, err := v.getKubernetesOIDCDiscovery() if err != nil { return fmt.Errorf("could not load Kubernetes OIDC discovery information: %w", err) @@ -256,7 +247,7 @@ func (v *OIDCTokenVerifier) initOIDCProvider(ctx context.Context) error { return nil } -func (v *OIDCTokenVerifier) getHTTPClientForKubeAPIServer() (*http.Client, error) { +func (v *Verifier) getHTTPClientForKubeAPIServer() (*http.Client, error) { client, err := rest.HTTPClientFor(v.restConfig) if err != nil { return nil, fmt.Errorf("could not create HTTP client from rest config: %w", err) @@ -265,7 +256,7 @@ func (v *OIDCTokenVerifier) getHTTPClientForKubeAPIServer() (*http.Client, error return client, nil } -func (v *OIDCTokenVerifier) getKubernetesOIDCDiscovery() (*openIDMetadata, error) { +func (v *Verifier) getKubernetesOIDCDiscovery() (*openIDMetadata, error) { client, err := v.getHTTPClientForKubeAPIServer() if err != nil { return nil, fmt.Errorf("could not get HTTP client for API server: %w", err) diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/interface.go deleted file mode 100644 index 760bafcecd..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/interface.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package eventing - -import ( - v1 "knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1" - v1alpha1 "knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1" - v1beta1 "knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta1" - v1beta2 "knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta2" - v1beta3 "knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta3" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1 provides access to shared informers for resources in V1. - V1() v1.Interface - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.Interface - // V1beta1 provides access to shared informers for resources in V1beta1. - V1beta1() v1beta1.Interface - // V1beta2 provides access to shared informers for resources in V1beta2. - V1beta2() v1beta2.Interface - // V1beta3 provides access to shared informers for resources in V1beta3. - V1beta3() v1beta3.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1 returns a new v1.Interface. -func (g *group) V1() v1.Interface { - return v1.New(g.factory, g.namespace, g.tweakListOptions) -} - -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} - -// V1beta1 returns a new v1beta1.Interface. -func (g *group) V1beta1() v1beta1.Interface { - return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) -} - -// V1beta2 returns a new v1beta2.Interface. -func (g *group) V1beta2() v1beta2.Interface { - return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) -} - -// V1beta3 returns a new v1beta3.Interface. -func (g *group) V1beta3() v1beta3.Interface { - return v1beta3.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/broker.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/broker.go deleted file mode 100644 index a57851c82f..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/broker.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/listers/eventing/v1" -) - -// BrokerInformer provides access to a shared informer and lister for -// Brokers. -type BrokerInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.BrokerLister -} - -type brokerInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewBrokerInformer constructs a new informer for Broker type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewBrokerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredBrokerInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredBrokerInformer constructs a new informer for Broker type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredBrokerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1().Brokers(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1().Brokers(namespace).Watch(context.TODO(), options) - }, - }, - &eventingv1.Broker{}, - resyncPeriod, - indexers, - ) -} - -func (f *brokerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredBrokerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *brokerInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&eventingv1.Broker{}, f.defaultInformer) -} - -func (f *brokerInformer) Lister() v1.BrokerLister { - return v1.NewBrokerLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/interface.go deleted file mode 100644 index e5e26d8216..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/interface.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // Brokers returns a BrokerInformer. - Brokers() BrokerInformer - // Triggers returns a TriggerInformer. - Triggers() TriggerInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// Brokers returns a BrokerInformer. -func (v *version) Brokers() BrokerInformer { - return &brokerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Triggers returns a TriggerInformer. -func (v *version) Triggers() TriggerInformer { - return &triggerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/trigger.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/trigger.go deleted file mode 100644 index 1faa3422ae..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1/trigger.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/listers/eventing/v1" -) - -// TriggerInformer provides access to a shared informer and lister for -// Triggers. -type TriggerInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.TriggerLister -} - -type triggerInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewTriggerInformer constructs a new informer for Trigger type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewTriggerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredTriggerInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredTriggerInformer constructs a new informer for Trigger type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredTriggerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1().Triggers(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1().Triggers(namespace).Watch(context.TODO(), options) - }, - }, - &eventingv1.Trigger{}, - resyncPeriod, - indexers, - ) -} - -func (f *triggerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredTriggerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *triggerInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&eventingv1.Trigger{}, f.defaultInformer) -} - -func (f *triggerInformer) Lister() v1.TriggerLister { - return v1.NewTriggerLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1/eventpolicy.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1/eventpolicy.go deleted file mode 100644 index df3b47e267..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1/eventpolicy.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - eventingv1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "knative.dev/eventing/pkg/client/listers/eventing/v1alpha1" -) - -// EventPolicyInformer provides access to a shared informer and lister for -// EventPolicies. -type EventPolicyInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.EventPolicyLister -} - -type eventPolicyInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewEventPolicyInformer constructs a new informer for EventPolicy type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewEventPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEventPolicyInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredEventPolicyInformer constructs a new informer for EventPolicy type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredEventPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1alpha1().EventPolicies(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1alpha1().EventPolicies(namespace).Watch(context.TODO(), options) - }, - }, - &eventingv1alpha1.EventPolicy{}, - resyncPeriod, - indexers, - ) -} - -func (f *eventPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEventPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *eventPolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&eventingv1alpha1.EventPolicy{}, f.defaultInformer) -} - -func (f *eventPolicyInformer) Lister() v1alpha1.EventPolicyLister { - return v1alpha1.NewEventPolicyLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1/interface.go deleted file mode 100644 index 89263c2585..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // EventPolicies returns a EventPolicyInformer. - EventPolicies() EventPolicyInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// EventPolicies returns a EventPolicyInformer. -func (v *version) EventPolicies() EventPolicyInformer { - return &eventPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta1/eventtype.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta1/eventtype.go deleted file mode 100644 index 920a7005e5..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta1/eventtype.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - eventingv1beta1 "knative.dev/eventing/pkg/apis/eventing/v1beta1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1beta1 "knative.dev/eventing/pkg/client/listers/eventing/v1beta1" -) - -// EventTypeInformer provides access to a shared informer and lister for -// EventTypes. -type EventTypeInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta1.EventTypeLister -} - -type eventTypeInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewEventTypeInformer constructs a new informer for EventType type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewEventTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEventTypeInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredEventTypeInformer constructs a new informer for EventType type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredEventTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1beta1().EventTypes(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1beta1().EventTypes(namespace).Watch(context.TODO(), options) - }, - }, - &eventingv1beta1.EventType{}, - resyncPeriod, - indexers, - ) -} - -func (f *eventTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEventTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *eventTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&eventingv1beta1.EventType{}, f.defaultInformer) -} - -func (f *eventTypeInformer) Lister() v1beta1.EventTypeLister { - return v1beta1.NewEventTypeLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta1/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta1/interface.go deleted file mode 100644 index a9473f8230..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta1/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // EventTypes returns a EventTypeInformer. - EventTypes() EventTypeInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// EventTypes returns a EventTypeInformer. -func (v *version) EventTypes() EventTypeInformer { - return &eventTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta2/eventtype.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta2/eventtype.go deleted file mode 100644 index 9a4c652552..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta2/eventtype.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta2 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - eventingv1beta2 "knative.dev/eventing/pkg/apis/eventing/v1beta2" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1beta2 "knative.dev/eventing/pkg/client/listers/eventing/v1beta2" -) - -// EventTypeInformer provides access to a shared informer and lister for -// EventTypes. -type EventTypeInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta2.EventTypeLister -} - -type eventTypeInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewEventTypeInformer constructs a new informer for EventType type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewEventTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEventTypeInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredEventTypeInformer constructs a new informer for EventType type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredEventTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1beta2().EventTypes(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1beta2().EventTypes(namespace).Watch(context.TODO(), options) - }, - }, - &eventingv1beta2.EventType{}, - resyncPeriod, - indexers, - ) -} - -func (f *eventTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEventTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *eventTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&eventingv1beta2.EventType{}, f.defaultInformer) -} - -func (f *eventTypeInformer) Lister() v1beta2.EventTypeLister { - return v1beta2.NewEventTypeLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta2/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta2/interface.go deleted file mode 100644 index 98f69b73ee..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta2/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta2 - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // EventTypes returns a EventTypeInformer. - EventTypes() EventTypeInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// EventTypes returns a EventTypeInformer. -func (v *version) EventTypes() EventTypeInformer { - return &eventTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta3/eventtype.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta3/eventtype.go deleted file mode 100644 index 46eb0753f1..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta3/eventtype.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta3 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - eventingv1beta3 "knative.dev/eventing/pkg/apis/eventing/v1beta3" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1beta3 "knative.dev/eventing/pkg/client/listers/eventing/v1beta3" -) - -// EventTypeInformer provides access to a shared informer and lister for -// EventTypes. -type EventTypeInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta3.EventTypeLister -} - -type eventTypeInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewEventTypeInformer constructs a new informer for EventType type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewEventTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEventTypeInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredEventTypeInformer constructs a new informer for EventType type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredEventTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1beta3().EventTypes(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EventingV1beta3().EventTypes(namespace).Watch(context.TODO(), options) - }, - }, - &eventingv1beta3.EventType{}, - resyncPeriod, - indexers, - ) -} - -func (f *eventTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEventTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *eventTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&eventingv1beta3.EventType{}, f.defaultInformer) -} - -func (f *eventTypeInformer) Lister() v1beta3.EventTypeLister { - return v1beta3.NewEventTypeLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta3/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta3/interface.go deleted file mode 100644 index 791ed817ee..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta3/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta3 - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // EventTypes returns a EventTypeInformer. - EventTypes() EventTypeInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// EventTypes returns a EventTypeInformer. -func (v *version) EventTypes() EventTypeInformer { - return &eventTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/factory.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/factory.go deleted file mode 100644 index 634f7f6a39..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/factory.go +++ /dev/null @@ -1,285 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - reflect "reflect" - sync "sync" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - eventing "knative.dev/eventing/pkg/client/informers/externalversions/eventing" - flows "knative.dev/eventing/pkg/client/informers/externalversions/flows" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - messaging "knative.dev/eventing/pkg/client/informers/externalversions/messaging" - sinks "knative.dev/eventing/pkg/client/informers/externalversions/sinks" - sources "knative.dev/eventing/pkg/client/informers/externalversions/sources" -) - -// SharedInformerOption defines the functional option type for SharedInformerFactory. -type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory - -type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - transform cache.TransformFunc - - informers map[reflect.Type]cache.SharedIndexInformer - // startedInformers is used for tracking which informers have been started. - // This allows Start() to be called multiple times safely. - startedInformers map[reflect.Type]bool - // wg tracks how many goroutines were started. - wg sync.WaitGroup - // shuttingDown is true when Shutdown has been called. It may still be running - // because it needs to wait for goroutines. - shuttingDown bool -} - -// WithCustomResyncConfig sets a custom resync period for the specified informer types. -func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - for k, v := range resyncConfig { - factory.customResync[reflect.TypeOf(k)] = v - } - return factory - } -} - -// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. -func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.tweakListOptions = tweakListOptions - return factory - } -} - -// WithNamespace limits the SharedInformerFactory to the specified namespace. -func WithNamespace(namespace string) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.namespace = namespace - return factory - } -} - -// WithTransform sets a transform on all informers. -func WithTransform(transform cache.TransformFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.transform = transform - return factory - } -} - -// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. -func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { - return NewSharedInformerFactoryWithOptions(client, defaultResync) -} - -// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. -// Listers obtained via this SharedInformerFactory will be subject to the same filters -// as specified here. -// Deprecated: Please use NewSharedInformerFactoryWithOptions instead -func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { - return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) -} - -// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. -func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { - factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - } - - // Apply all options - for _, opt := range options { - factory = opt(factory) - } - - return factory -} - -func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { - f.lock.Lock() - defer f.lock.Unlock() - - if f.shuttingDown { - return - } - - for informerType, informer := range f.informers { - if !f.startedInformers[informerType] { - f.wg.Add(1) - // We need a new variable in each loop iteration, - // otherwise the goroutine would use the loop variable - // and that keeps changing. - informer := informer - go func() { - defer f.wg.Done() - informer.Run(stopCh) - }() - f.startedInformers[informerType] = true - } - } -} - -func (f *sharedInformerFactory) Shutdown() { - f.lock.Lock() - f.shuttingDown = true - f.lock.Unlock() - - // Will return immediately if there is nothing to wait for. - f.wg.Wait() -} - -func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { - informers := func() map[reflect.Type]cache.SharedIndexInformer { - f.lock.Lock() - defer f.lock.Unlock() - - informers := map[reflect.Type]cache.SharedIndexInformer{} - for informerType, informer := range f.informers { - if f.startedInformers[informerType] { - informers[informerType] = informer - } - } - return informers - }() - - res := map[reflect.Type]bool{} - for informType, informer := range informers { - res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) - } - return res -} - -// InformerFor returns the SharedIndexInformer for obj using an internal -// client. -func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { - f.lock.Lock() - defer f.lock.Unlock() - - informerType := reflect.TypeOf(obj) - informer, exists := f.informers[informerType] - if exists { - return informer - } - - resyncPeriod, exists := f.customResync[informerType] - if !exists { - resyncPeriod = f.defaultResync - } - - informer = newFunc(f.client, resyncPeriod) - informer.SetTransform(f.transform) - f.informers[informerType] = informer - - return informer -} - -// SharedInformerFactory provides shared informers for resources in all known -// API group versions. -// -// It is typically used like this: -// -// ctx, cancel := context.Background() -// defer cancel() -// factory := NewSharedInformerFactory(client, resyncPeriod) -// defer factory.WaitForStop() // Returns immediately if nothing was started. -// genericInformer := factory.ForResource(resource) -// typedInformer := factory.SomeAPIGroup().V1().SomeType() -// factory.Start(ctx.Done()) // Start processing these informers. -// synced := factory.WaitForCacheSync(ctx.Done()) -// for v, ok := range synced { -// if !ok { -// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) -// return -// } -// } -// -// // Creating informers can also be created after Start, but then -// // Start must be called again: -// anotherGenericInformer := factory.ForResource(resource) -// factory.Start(ctx.Done()) -type SharedInformerFactory interface { - internalinterfaces.SharedInformerFactory - - // Start initializes all requested informers. They are handled in goroutines - // which run until the stop channel gets closed. - Start(stopCh <-chan struct{}) - - // Shutdown marks a factory as shutting down. At that point no new - // informers can be started anymore and Start will return without - // doing anything. - // - // In addition, Shutdown blocks until all goroutines have terminated. For that - // to happen, the close channel(s) that they were started with must be closed, - // either before Shutdown gets called or while it is waiting. - // - // Shutdown may be called multiple times, even concurrently. All such calls will - // block until all goroutines have terminated. - Shutdown() - - // WaitForCacheSync blocks until all started informers' caches were synced - // or the stop channel gets closed. - WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - - // ForResource gives generic access to a shared informer of the matching type. - ForResource(resource schema.GroupVersionResource) (GenericInformer, error) - - // InformerFor returns the SharedIndexInformer for obj using an internal - // client. - InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer - - Eventing() eventing.Interface - Flows() flows.Interface - Messaging() messaging.Interface - Sinks() sinks.Interface - Sources() sources.Interface -} - -func (f *sharedInformerFactory) Eventing() eventing.Interface { - return eventing.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Flows() flows.Interface { - return flows.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Messaging() messaging.Interface { - return messaging.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Sinks() sinks.Interface { - return sinks.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Sources() sources.Interface { - return sources.New(f, f.namespace, f.tweakListOptions) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/interface.go deleted file mode 100644 index 99a7163ed6..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/interface.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package flows - -import ( - v1 "knative.dev/eventing/pkg/client/informers/externalversions/flows/v1" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1 provides access to shared informers for resources in V1. - V1() v1.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1 returns a new v1.Interface. -func (g *group) V1() v1.Interface { - return v1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/interface.go deleted file mode 100644 index 520cd36c6b..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/interface.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // Parallels returns a ParallelInformer. - Parallels() ParallelInformer - // Sequences returns a SequenceInformer. - Sequences() SequenceInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// Parallels returns a ParallelInformer. -func (v *version) Parallels() ParallelInformer { - return ¶llelInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Sequences returns a SequenceInformer. -func (v *version) Sequences() SequenceInformer { - return &sequenceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/parallel.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/parallel.go deleted file mode 100644 index 8865633974..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/parallel.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/listers/flows/v1" -) - -// ParallelInformer provides access to a shared informer and lister for -// Parallels. -type ParallelInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.ParallelLister -} - -type parallelInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewParallelInformer constructs a new informer for Parallel type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewParallelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredParallelInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredParallelInformer constructs a new informer for Parallel type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredParallelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.FlowsV1().Parallels(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.FlowsV1().Parallels(namespace).Watch(context.TODO(), options) - }, - }, - &flowsv1.Parallel{}, - resyncPeriod, - indexers, - ) -} - -func (f *parallelInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredParallelInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *parallelInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&flowsv1.Parallel{}, f.defaultInformer) -} - -func (f *parallelInformer) Lister() v1.ParallelLister { - return v1.NewParallelLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/sequence.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/sequence.go deleted file mode 100644 index 1275dda3b9..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/sequence.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/listers/flows/v1" -) - -// SequenceInformer provides access to a shared informer and lister for -// Sequences. -type SequenceInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.SequenceLister -} - -type sequenceInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewSequenceInformer constructs a new informer for Sequence type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewSequenceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredSequenceInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredSequenceInformer constructs a new informer for Sequence type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredSequenceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.FlowsV1().Sequences(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.FlowsV1().Sequences(namespace).Watch(context.TODO(), options) - }, - }, - &flowsv1.Sequence{}, - resyncPeriod, - indexers, - ) -} - -func (f *sequenceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredSequenceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *sequenceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&flowsv1.Sequence{}, f.defaultInformer) -} - -func (f *sequenceInformer) Lister() v1.SequenceLister { - return v1.NewSequenceLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/generic.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/generic.go deleted file mode 100644 index 41c490e06c..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/generic.go +++ /dev/null @@ -1,121 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - "fmt" - - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/eventing/v1" - v1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1" - v1beta1 "knative.dev/eventing/pkg/apis/eventing/v1beta1" - v1beta2 "knative.dev/eventing/pkg/apis/eventing/v1beta2" - v1beta3 "knative.dev/eventing/pkg/apis/eventing/v1beta3" - flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" - messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" - sinksv1alpha1 "knative.dev/eventing/pkg/apis/sinks/v1alpha1" - sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1" - sourcesv1beta2 "knative.dev/eventing/pkg/apis/sources/v1beta2" -) - -// GenericInformer is type of SharedIndexInformer which will locate and delegate to other -// sharedInformers based on type -type GenericInformer interface { - Informer() cache.SharedIndexInformer - Lister() cache.GenericLister -} - -type genericInformer struct { - informer cache.SharedIndexInformer - resource schema.GroupResource -} - -// Informer returns the SharedIndexInformer. -func (f *genericInformer) Informer() cache.SharedIndexInformer { - return f.informer -} - -// Lister returns the GenericLister. -func (f *genericInformer) Lister() cache.GenericLister { - return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) -} - -// ForResource gives generic access to a shared informer of the matching type -// TODO extend this to unknown resources with a client pool -func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { - switch resource { - // Group=eventing.knative.dev, Version=v1 - case v1.SchemeGroupVersion.WithResource("brokers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Eventing().V1().Brokers().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("triggers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Eventing().V1().Triggers().Informer()}, nil - - // Group=eventing.knative.dev, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("eventpolicies"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Eventing().V1alpha1().EventPolicies().Informer()}, nil - - // Group=eventing.knative.dev, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithResource("eventtypes"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Eventing().V1beta1().EventTypes().Informer()}, nil - - // Group=eventing.knative.dev, Version=v1beta2 - case v1beta2.SchemeGroupVersion.WithResource("eventtypes"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Eventing().V1beta2().EventTypes().Informer()}, nil - - // Group=eventing.knative.dev, Version=v1beta3 - case v1beta3.SchemeGroupVersion.WithResource("eventtypes"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Eventing().V1beta3().EventTypes().Informer()}, nil - - // Group=flows.knative.dev, Version=v1 - case flowsv1.SchemeGroupVersion.WithResource("parallels"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Flows().V1().Parallels().Informer()}, nil - case flowsv1.SchemeGroupVersion.WithResource("sequences"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Flows().V1().Sequences().Informer()}, nil - - // Group=messaging.knative.dev, Version=v1 - case messagingv1.SchemeGroupVersion.WithResource("channels"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Messaging().V1().Channels().Informer()}, nil - case messagingv1.SchemeGroupVersion.WithResource("inmemorychannels"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Messaging().V1().InMemoryChannels().Informer()}, nil - case messagingv1.SchemeGroupVersion.WithResource("subscriptions"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Messaging().V1().Subscriptions().Informer()}, nil - - // Group=sinks.knative.dev, Version=v1alpha1 - case sinksv1alpha1.SchemeGroupVersion.WithResource("jobsinks"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Sinks().V1alpha1().JobSinks().Informer()}, nil - - // Group=sources.knative.dev, Version=v1 - case sourcesv1.SchemeGroupVersion.WithResource("apiserversources"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1().ApiServerSources().Informer()}, nil - case sourcesv1.SchemeGroupVersion.WithResource("containersources"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1().ContainerSources().Informer()}, nil - case sourcesv1.SchemeGroupVersion.WithResource("pingsources"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1().PingSources().Informer()}, nil - case sourcesv1.SchemeGroupVersion.WithResource("sinkbindings"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1().SinkBindings().Informer()}, nil - - // Group=sources.knative.dev, Version=v1beta2 - case sourcesv1beta2.SchemeGroupVersion.WithResource("pingsources"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1beta2().PingSources().Informer()}, nil - - } - - return nil, fmt.Errorf("no informer found for %v", resource) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go deleted file mode 100644 index e38af63064..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package internalinterfaces - -import ( - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - cache "k8s.io/client-go/tools/cache" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" -) - -// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. -type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer - -// SharedInformerFactory a small interface to allow for adding an informer without an import cycle -type SharedInformerFactory interface { - Start(stopCh <-chan struct{}) - InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer -} - -// TweakListOptionsFunc is a function that transforms a v1.ListOptions. -type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/interface.go deleted file mode 100644 index 8a38f95bf9..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/interface.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package messaging - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1 provides access to shared informers for resources in V1. - V1() v1.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1 returns a new v1.Interface. -func (g *group) V1() v1.Interface { - return v1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/channel.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/channel.go deleted file mode 100644 index 78daf28489..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/channel.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/listers/messaging/v1" -) - -// ChannelInformer provides access to a shared informer and lister for -// Channels. -type ChannelInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.ChannelLister -} - -type channelInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewChannelInformer constructs a new informer for Channel type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewChannelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredChannelInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredChannelInformer constructs a new informer for Channel type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredChannelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MessagingV1().Channels(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MessagingV1().Channels(namespace).Watch(context.TODO(), options) - }, - }, - &messagingv1.Channel{}, - resyncPeriod, - indexers, - ) -} - -func (f *channelInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredChannelInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *channelInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&messagingv1.Channel{}, f.defaultInformer) -} - -func (f *channelInformer) Lister() v1.ChannelLister { - return v1.NewChannelLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/inmemorychannel.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/inmemorychannel.go deleted file mode 100644 index 2d19c29ef4..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/inmemorychannel.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/listers/messaging/v1" -) - -// InMemoryChannelInformer provides access to a shared informer and lister for -// InMemoryChannels. -type InMemoryChannelInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.InMemoryChannelLister -} - -type inMemoryChannelInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewInMemoryChannelInformer constructs a new informer for InMemoryChannel type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewInMemoryChannelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredInMemoryChannelInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredInMemoryChannelInformer constructs a new informer for InMemoryChannel type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredInMemoryChannelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MessagingV1().InMemoryChannels(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MessagingV1().InMemoryChannels(namespace).Watch(context.TODO(), options) - }, - }, - &messagingv1.InMemoryChannel{}, - resyncPeriod, - indexers, - ) -} - -func (f *inMemoryChannelInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredInMemoryChannelInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *inMemoryChannelInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&messagingv1.InMemoryChannel{}, f.defaultInformer) -} - -func (f *inMemoryChannelInformer) Lister() v1.InMemoryChannelLister { - return v1.NewInMemoryChannelLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/interface.go deleted file mode 100644 index 2165d9cc67..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/interface.go +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // Channels returns a ChannelInformer. - Channels() ChannelInformer - // InMemoryChannels returns a InMemoryChannelInformer. - InMemoryChannels() InMemoryChannelInformer - // Subscriptions returns a SubscriptionInformer. - Subscriptions() SubscriptionInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// Channels returns a ChannelInformer. -func (v *version) Channels() ChannelInformer { - return &channelInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// InMemoryChannels returns a InMemoryChannelInformer. -func (v *version) InMemoryChannels() InMemoryChannelInformer { - return &inMemoryChannelInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Subscriptions returns a SubscriptionInformer. -func (v *version) Subscriptions() SubscriptionInformer { - return &subscriptionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/subscription.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/subscription.go deleted file mode 100644 index bedff16633..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/subscription.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/listers/messaging/v1" -) - -// SubscriptionInformer provides access to a shared informer and lister for -// Subscriptions. -type SubscriptionInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.SubscriptionLister -} - -type subscriptionInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewSubscriptionInformer constructs a new informer for Subscription type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewSubscriptionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredSubscriptionInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredSubscriptionInformer constructs a new informer for Subscription type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredSubscriptionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MessagingV1().Subscriptions(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MessagingV1().Subscriptions(namespace).Watch(context.TODO(), options) - }, - }, - &messagingv1.Subscription{}, - resyncPeriod, - indexers, - ) -} - -func (f *subscriptionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredSubscriptionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *subscriptionInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&messagingv1.Subscription{}, f.defaultInformer) -} - -func (f *subscriptionInformer) Lister() v1.SubscriptionLister { - return v1.NewSubscriptionLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/interface.go deleted file mode 100644 index f09f6846bf..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/interface.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package sinks - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "knative.dev/eventing/pkg/client/informers/externalversions/sinks/v1alpha1" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/v1alpha1/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/v1alpha1/interface.go deleted file mode 100644 index 68ed173ac5..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/v1alpha1/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // JobSinks returns a JobSinkInformer. - JobSinks() JobSinkInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// JobSinks returns a JobSinkInformer. -func (v *version) JobSinks() JobSinkInformer { - return &jobSinkInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/v1alpha1/jobsink.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/v1alpha1/jobsink.go deleted file mode 100644 index 5278c858b5..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sinks/v1alpha1/jobsink.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - sinksv1alpha1 "knative.dev/eventing/pkg/apis/sinks/v1alpha1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "knative.dev/eventing/pkg/client/listers/sinks/v1alpha1" -) - -// JobSinkInformer provides access to a shared informer and lister for -// JobSinks. -type JobSinkInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.JobSinkLister -} - -type jobSinkInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewJobSinkInformer constructs a new informer for JobSink type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewJobSinkInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredJobSinkInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredJobSinkInformer constructs a new informer for JobSink type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredJobSinkInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SinksV1alpha1().JobSinks(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SinksV1alpha1().JobSinks(namespace).Watch(context.TODO(), options) - }, - }, - &sinksv1alpha1.JobSink{}, - resyncPeriod, - indexers, - ) -} - -func (f *jobSinkInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredJobSinkInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *jobSinkInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&sinksv1alpha1.JobSink{}, f.defaultInformer) -} - -func (f *jobSinkInformer) Lister() v1alpha1.JobSinkLister { - return v1alpha1.NewJobSinkLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/interface.go deleted file mode 100644 index c8b6385943..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/interface.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package sources - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/informers/externalversions/sources/v1" - v1beta2 "knative.dev/eventing/pkg/client/informers/externalversions/sources/v1beta2" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1 provides access to shared informers for resources in V1. - V1() v1.Interface - // V1beta2 provides access to shared informers for resources in V1beta2. - V1beta2() v1beta2.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1 returns a new v1.Interface. -func (g *group) V1() v1.Interface { - return v1.New(g.factory, g.namespace, g.tweakListOptions) -} - -// V1beta2 returns a new v1beta2.Interface. -func (g *group) V1beta2() v1beta2.Interface { - return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/apiserversource.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/apiserversource.go deleted file mode 100644 index 501c2cdf6a..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/apiserversource.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/listers/sources/v1" -) - -// ApiServerSourceInformer provides access to a shared informer and lister for -// ApiServerSources. -type ApiServerSourceInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.ApiServerSourceLister -} - -type apiServerSourceInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewApiServerSourceInformer constructs a new informer for ApiServerSource type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewApiServerSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredApiServerSourceInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredApiServerSourceInformer constructs a new informer for ApiServerSource type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredApiServerSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SourcesV1().ApiServerSources(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SourcesV1().ApiServerSources(namespace).Watch(context.TODO(), options) - }, - }, - &sourcesv1.ApiServerSource{}, - resyncPeriod, - indexers, - ) -} - -func (f *apiServerSourceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredApiServerSourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *apiServerSourceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&sourcesv1.ApiServerSource{}, f.defaultInformer) -} - -func (f *apiServerSourceInformer) Lister() v1.ApiServerSourceLister { - return v1.NewApiServerSourceLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/containersource.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/containersource.go deleted file mode 100644 index 67de322d68..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/containersource.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/listers/sources/v1" -) - -// ContainerSourceInformer provides access to a shared informer and lister for -// ContainerSources. -type ContainerSourceInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.ContainerSourceLister -} - -type containerSourceInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewContainerSourceInformer constructs a new informer for ContainerSource type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewContainerSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredContainerSourceInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredContainerSourceInformer constructs a new informer for ContainerSource type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredContainerSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SourcesV1().ContainerSources(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SourcesV1().ContainerSources(namespace).Watch(context.TODO(), options) - }, - }, - &sourcesv1.ContainerSource{}, - resyncPeriod, - indexers, - ) -} - -func (f *containerSourceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredContainerSourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *containerSourceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&sourcesv1.ContainerSource{}, f.defaultInformer) -} - -func (f *containerSourceInformer) Lister() v1.ContainerSourceLister { - return v1.NewContainerSourceLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/interface.go deleted file mode 100644 index f5fd4ee595..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/interface.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // ApiServerSources returns a ApiServerSourceInformer. - ApiServerSources() ApiServerSourceInformer - // ContainerSources returns a ContainerSourceInformer. - ContainerSources() ContainerSourceInformer - // PingSources returns a PingSourceInformer. - PingSources() PingSourceInformer - // SinkBindings returns a SinkBindingInformer. - SinkBindings() SinkBindingInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// ApiServerSources returns a ApiServerSourceInformer. -func (v *version) ApiServerSources() ApiServerSourceInformer { - return &apiServerSourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// ContainerSources returns a ContainerSourceInformer. -func (v *version) ContainerSources() ContainerSourceInformer { - return &containerSourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// PingSources returns a PingSourceInformer. -func (v *version) PingSources() PingSourceInformer { - return &pingSourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// SinkBindings returns a SinkBindingInformer. -func (v *version) SinkBindings() SinkBindingInformer { - return &sinkBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/pingsource.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/pingsource.go deleted file mode 100644 index f4a274ad10..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/pingsource.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/listers/sources/v1" -) - -// PingSourceInformer provides access to a shared informer and lister for -// PingSources. -type PingSourceInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.PingSourceLister -} - -type pingSourceInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewPingSourceInformer constructs a new informer for PingSource type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewPingSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPingSourceInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredPingSourceInformer constructs a new informer for PingSource type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredPingSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SourcesV1().PingSources(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SourcesV1().PingSources(namespace).Watch(context.TODO(), options) - }, - }, - &sourcesv1.PingSource{}, - resyncPeriod, - indexers, - ) -} - -func (f *pingSourceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPingSourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *pingSourceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&sourcesv1.PingSource{}, f.defaultInformer) -} - -func (f *pingSourceInformer) Lister() v1.PingSourceLister { - return v1.NewPingSourceLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/sinkbinding.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/sinkbinding.go deleted file mode 100644 index 0358052625..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1/sinkbinding.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1 "knative.dev/eventing/pkg/client/listers/sources/v1" -) - -// SinkBindingInformer provides access to a shared informer and lister for -// SinkBindings. -type SinkBindingInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.SinkBindingLister -} - -type sinkBindingInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewSinkBindingInformer constructs a new informer for SinkBinding type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewSinkBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredSinkBindingInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredSinkBindingInformer constructs a new informer for SinkBinding type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredSinkBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SourcesV1().SinkBindings(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SourcesV1().SinkBindings(namespace).Watch(context.TODO(), options) - }, - }, - &sourcesv1.SinkBinding{}, - resyncPeriod, - indexers, - ) -} - -func (f *sinkBindingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredSinkBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *sinkBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&sourcesv1.SinkBinding{}, f.defaultInformer) -} - -func (f *sinkBindingInformer) Lister() v1.SinkBindingLister { - return v1.NewSinkBindingLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1beta2/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1beta2/interface.go deleted file mode 100644 index 14c34076ee..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1beta2/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta2 - -import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // PingSources returns a PingSourceInformer. - PingSources() PingSourceInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// PingSources returns a PingSourceInformer. -func (v *version) PingSources() PingSourceInformer { - return &pingSourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1beta2/pingsource.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1beta2/pingsource.go deleted file mode 100644 index 41a2647840..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/sources/v1beta2/pingsource.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta2 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - sourcesv1beta2 "knative.dev/eventing/pkg/apis/sources/v1beta2" - versioned "knative.dev/eventing/pkg/client/clientset/versioned" - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1beta2 "knative.dev/eventing/pkg/client/listers/sources/v1beta2" -) - -// PingSourceInformer provides access to a shared informer and lister for -// PingSources. -type PingSourceInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta2.PingSourceLister -} - -type pingSourceInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewPingSourceInformer constructs a new informer for PingSource type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewPingSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPingSourceInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredPingSourceInformer constructs a new informer for PingSource type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredPingSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SourcesV1beta2().PingSources(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SourcesV1beta2().PingSources(namespace).Watch(context.TODO(), options) - }, - }, - &sourcesv1beta2.PingSource{}, - resyncPeriod, - indexers, - ) -} - -func (f *pingSourceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPingSourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *pingSourceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&sourcesv1beta2.PingSource{}, f.defaultInformer) -} - -func (f *pingSourceInformer) Lister() v1beta2.PingSourceLister { - return v1beta2.NewPingSourceLister(f.Informer().GetIndexer()) -} diff --git a/vendor/knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy/eventpolicy.go b/vendor/knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy/eventpolicy.go deleted file mode 100644 index c6da95f0a0..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy/eventpolicy.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by injection-gen. DO NOT EDIT. - -package eventpolicy - -import ( - context "context" - - v1alpha1 "knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1" - factory "knative.dev/eventing/pkg/client/injection/informers/factory" - controller "knative.dev/pkg/controller" - injection "knative.dev/pkg/injection" - logging "knative.dev/pkg/logging" -) - -func init() { - injection.Default.RegisterInformer(withInformer) -} - -// Key is used for associating the Informer inside the context.Context. -type Key struct{} - -func withInformer(ctx context.Context) (context.Context, controller.Informer) { - f := factory.Get(ctx) - inf := f.Eventing().V1alpha1().EventPolicies() - return context.WithValue(ctx, Key{}, inf), inf.Informer() -} - -// Get extracts the typed informer from the context. -func Get(ctx context.Context) v1alpha1.EventPolicyInformer { - untyped := ctx.Value(Key{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1.EventPolicyInformer from context.") - } - return untyped.(v1alpha1.EventPolicyInformer) -} diff --git a/vendor/knative.dev/eventing/pkg/client/injection/informers/factory/factory.go b/vendor/knative.dev/eventing/pkg/client/injection/informers/factory/factory.go deleted file mode 100644 index 66413ebaca..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/injection/informers/factory/factory.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by injection-gen. DO NOT EDIT. - -package factory - -import ( - context "context" - - externalversions "knative.dev/eventing/pkg/client/informers/externalversions" - client "knative.dev/eventing/pkg/client/injection/client" - controller "knative.dev/pkg/controller" - injection "knative.dev/pkg/injection" - logging "knative.dev/pkg/logging" -) - -func init() { - injection.Default.RegisterInformerFactory(withInformerFactory) -} - -// Key is used as the key for associating information with a context.Context. -type Key struct{} - -func withInformerFactory(ctx context.Context) context.Context { - c := client.Get(ctx) - opts := make([]externalversions.SharedInformerOption, 0, 1) - if injection.HasNamespaceScope(ctx) { - opts = append(opts, externalversions.WithNamespace(injection.GetNamespaceScope(ctx))) - } - return context.WithValue(ctx, Key{}, - externalversions.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), opts...)) -} - -// Get extracts the InformerFactory from the context. -func Get(ctx context.Context) externalversions.SharedInformerFactory { - untyped := ctx.Value(Key{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch knative.dev/eventing/pkg/client/informers/externalversions.SharedInformerFactory from context.") - } - return untyped.(externalversions.SharedInformerFactory) -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/broker.go b/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/broker.go deleted file mode 100644 index a34e9a01f5..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/broker.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/eventing/v1" -) - -// BrokerLister helps list Brokers. -// All objects returned here must be treated as read-only. -type BrokerLister interface { - // List lists all Brokers in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Broker, err error) - // Brokers returns an object that can list and get Brokers. - Brokers(namespace string) BrokerNamespaceLister - BrokerListerExpansion -} - -// brokerLister implements the BrokerLister interface. -type brokerLister struct { - indexer cache.Indexer -} - -// NewBrokerLister returns a new BrokerLister. -func NewBrokerLister(indexer cache.Indexer) BrokerLister { - return &brokerLister{indexer: indexer} -} - -// List lists all Brokers in the indexer. -func (s *brokerLister) List(selector labels.Selector) (ret []*v1.Broker, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Broker)) - }) - return ret, err -} - -// Brokers returns an object that can list and get Brokers. -func (s *brokerLister) Brokers(namespace string) BrokerNamespaceLister { - return brokerNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// BrokerNamespaceLister helps list and get Brokers. -// All objects returned here must be treated as read-only. -type BrokerNamespaceLister interface { - // List lists all Brokers in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Broker, err error) - // Get retrieves the Broker from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.Broker, error) - BrokerNamespaceListerExpansion -} - -// brokerNamespaceLister implements the BrokerNamespaceLister -// interface. -type brokerNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Brokers in the indexer for a given namespace. -func (s brokerNamespaceLister) List(selector labels.Selector) (ret []*v1.Broker, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Broker)) - }) - return ret, err -} - -// Get retrieves the Broker from the indexer for a given namespace and name. -func (s brokerNamespaceLister) Get(name string) (*v1.Broker, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("broker"), name) - } - return obj.(*v1.Broker), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/expansion_generated.go b/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/expansion_generated.go deleted file mode 100644 index 2499093544..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/expansion_generated.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -// BrokerListerExpansion allows custom methods to be added to -// BrokerLister. -type BrokerListerExpansion interface{} - -// BrokerNamespaceListerExpansion allows custom methods to be added to -// BrokerNamespaceLister. -type BrokerNamespaceListerExpansion interface{} - -// TriggerListerExpansion allows custom methods to be added to -// TriggerLister. -type TriggerListerExpansion interface{} - -// TriggerNamespaceListerExpansion allows custom methods to be added to -// TriggerNamespaceLister. -type TriggerNamespaceListerExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/trigger.go b/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/trigger.go deleted file mode 100644 index 28aef21d29..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1/trigger.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/eventing/v1" -) - -// TriggerLister helps list Triggers. -// All objects returned here must be treated as read-only. -type TriggerLister interface { - // List lists all Triggers in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Trigger, err error) - // Triggers returns an object that can list and get Triggers. - Triggers(namespace string) TriggerNamespaceLister - TriggerListerExpansion -} - -// triggerLister implements the TriggerLister interface. -type triggerLister struct { - indexer cache.Indexer -} - -// NewTriggerLister returns a new TriggerLister. -func NewTriggerLister(indexer cache.Indexer) TriggerLister { - return &triggerLister{indexer: indexer} -} - -// List lists all Triggers in the indexer. -func (s *triggerLister) List(selector labels.Selector) (ret []*v1.Trigger, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Trigger)) - }) - return ret, err -} - -// Triggers returns an object that can list and get Triggers. -func (s *triggerLister) Triggers(namespace string) TriggerNamespaceLister { - return triggerNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// TriggerNamespaceLister helps list and get Triggers. -// All objects returned here must be treated as read-only. -type TriggerNamespaceLister interface { - // List lists all Triggers in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Trigger, err error) - // Get retrieves the Trigger from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.Trigger, error) - TriggerNamespaceListerExpansion -} - -// triggerNamespaceLister implements the TriggerNamespaceLister -// interface. -type triggerNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Triggers in the indexer for a given namespace. -func (s triggerNamespaceLister) List(selector labels.Selector) (ret []*v1.Trigger, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Trigger)) - }) - return ret, err -} - -// Get retrieves the Trigger from the indexer for a given namespace and name. -func (s triggerNamespaceLister) Get(name string) (*v1.Trigger, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("trigger"), name) - } - return obj.(*v1.Trigger), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta1/eventtype.go b/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta1/eventtype.go deleted file mode 100644 index 3dbf79b88f..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta1/eventtype.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1beta1 "knative.dev/eventing/pkg/apis/eventing/v1beta1" -) - -// EventTypeLister helps list EventTypes. -// All objects returned here must be treated as read-only. -type EventTypeLister interface { - // List lists all EventTypes in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.EventType, err error) - // EventTypes returns an object that can list and get EventTypes. - EventTypes(namespace string) EventTypeNamespaceLister - EventTypeListerExpansion -} - -// eventTypeLister implements the EventTypeLister interface. -type eventTypeLister struct { - indexer cache.Indexer -} - -// NewEventTypeLister returns a new EventTypeLister. -func NewEventTypeLister(indexer cache.Indexer) EventTypeLister { - return &eventTypeLister{indexer: indexer} -} - -// List lists all EventTypes in the indexer. -func (s *eventTypeLister) List(selector labels.Selector) (ret []*v1beta1.EventType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.EventType)) - }) - return ret, err -} - -// EventTypes returns an object that can list and get EventTypes. -func (s *eventTypeLister) EventTypes(namespace string) EventTypeNamespaceLister { - return eventTypeNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// EventTypeNamespaceLister helps list and get EventTypes. -// All objects returned here must be treated as read-only. -type EventTypeNamespaceLister interface { - // List lists all EventTypes in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.EventType, err error) - // Get retrieves the EventType from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.EventType, error) - EventTypeNamespaceListerExpansion -} - -// eventTypeNamespaceLister implements the EventTypeNamespaceLister -// interface. -type eventTypeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all EventTypes in the indexer for a given namespace. -func (s eventTypeNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.EventType, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.EventType)) - }) - return ret, err -} - -// Get retrieves the EventType from the indexer for a given namespace and name. -func (s eventTypeNamespaceLister) Get(name string) (*v1beta1.EventType, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("eventtype"), name) - } - return obj.(*v1beta1.EventType), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta1/expansion_generated.go b/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta1/expansion_generated.go deleted file mode 100644 index 8048b1f4c6..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta1/expansion_generated.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -// EventTypeListerExpansion allows custom methods to be added to -// EventTypeLister. -type EventTypeListerExpansion interface{} - -// EventTypeNamespaceListerExpansion allows custom methods to be added to -// EventTypeNamespaceLister. -type EventTypeNamespaceListerExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta3/eventtype.go b/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta3/eventtype.go deleted file mode 100644 index 76d1efb301..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta3/eventtype.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta3 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1beta3 "knative.dev/eventing/pkg/apis/eventing/v1beta3" -) - -// EventTypeLister helps list EventTypes. -// All objects returned here must be treated as read-only. -type EventTypeLister interface { - // List lists all EventTypes in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta3.EventType, err error) - // EventTypes returns an object that can list and get EventTypes. - EventTypes(namespace string) EventTypeNamespaceLister - EventTypeListerExpansion -} - -// eventTypeLister implements the EventTypeLister interface. -type eventTypeLister struct { - indexer cache.Indexer -} - -// NewEventTypeLister returns a new EventTypeLister. -func NewEventTypeLister(indexer cache.Indexer) EventTypeLister { - return &eventTypeLister{indexer: indexer} -} - -// List lists all EventTypes in the indexer. -func (s *eventTypeLister) List(selector labels.Selector) (ret []*v1beta3.EventType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta3.EventType)) - }) - return ret, err -} - -// EventTypes returns an object that can list and get EventTypes. -func (s *eventTypeLister) EventTypes(namespace string) EventTypeNamespaceLister { - return eventTypeNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// EventTypeNamespaceLister helps list and get EventTypes. -// All objects returned here must be treated as read-only. -type EventTypeNamespaceLister interface { - // List lists all EventTypes in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta3.EventType, err error) - // Get retrieves the EventType from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1beta3.EventType, error) - EventTypeNamespaceListerExpansion -} - -// eventTypeNamespaceLister implements the EventTypeNamespaceLister -// interface. -type eventTypeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all EventTypes in the indexer for a given namespace. -func (s eventTypeNamespaceLister) List(selector labels.Selector) (ret []*v1beta3.EventType, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta3.EventType)) - }) - return ret, err -} - -// Get retrieves the EventType from the indexer for a given namespace and name. -func (s eventTypeNamespaceLister) Get(name string) (*v1beta3.EventType, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta3.Resource("eventtype"), name) - } - return obj.(*v1beta3.EventType), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta3/expansion_generated.go b/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta3/expansion_generated.go deleted file mode 100644 index 465a79ef97..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/eventing/v1beta3/expansion_generated.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta3 - -// EventTypeListerExpansion allows custom methods to be added to -// EventTypeLister. -type EventTypeListerExpansion interface{} - -// EventTypeNamespaceListerExpansion allows custom methods to be added to -// EventTypeNamespaceLister. -type EventTypeNamespaceListerExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/expansion_generated.go b/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/expansion_generated.go deleted file mode 100644 index 3bbe4519a1..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/expansion_generated.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -// ParallelListerExpansion allows custom methods to be added to -// ParallelLister. -type ParallelListerExpansion interface{} - -// ParallelNamespaceListerExpansion allows custom methods to be added to -// ParallelNamespaceLister. -type ParallelNamespaceListerExpansion interface{} - -// SequenceListerExpansion allows custom methods to be added to -// SequenceLister. -type SequenceListerExpansion interface{} - -// SequenceNamespaceListerExpansion allows custom methods to be added to -// SequenceNamespaceLister. -type SequenceNamespaceListerExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/parallel.go b/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/parallel.go deleted file mode 100644 index 8ef7f1af94..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/parallel.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/flows/v1" -) - -// ParallelLister helps list Parallels. -// All objects returned here must be treated as read-only. -type ParallelLister interface { - // List lists all Parallels in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Parallel, err error) - // Parallels returns an object that can list and get Parallels. - Parallels(namespace string) ParallelNamespaceLister - ParallelListerExpansion -} - -// parallelLister implements the ParallelLister interface. -type parallelLister struct { - indexer cache.Indexer -} - -// NewParallelLister returns a new ParallelLister. -func NewParallelLister(indexer cache.Indexer) ParallelLister { - return ¶llelLister{indexer: indexer} -} - -// List lists all Parallels in the indexer. -func (s *parallelLister) List(selector labels.Selector) (ret []*v1.Parallel, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Parallel)) - }) - return ret, err -} - -// Parallels returns an object that can list and get Parallels. -func (s *parallelLister) Parallels(namespace string) ParallelNamespaceLister { - return parallelNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ParallelNamespaceLister helps list and get Parallels. -// All objects returned here must be treated as read-only. -type ParallelNamespaceLister interface { - // List lists all Parallels in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Parallel, err error) - // Get retrieves the Parallel from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.Parallel, error) - ParallelNamespaceListerExpansion -} - -// parallelNamespaceLister implements the ParallelNamespaceLister -// interface. -type parallelNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Parallels in the indexer for a given namespace. -func (s parallelNamespaceLister) List(selector labels.Selector) (ret []*v1.Parallel, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Parallel)) - }) - return ret, err -} - -// Get retrieves the Parallel from the indexer for a given namespace and name. -func (s parallelNamespaceLister) Get(name string) (*v1.Parallel, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("parallel"), name) - } - return obj.(*v1.Parallel), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/sequence.go b/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/sequence.go deleted file mode 100644 index 9645a7f135..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/sequence.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/flows/v1" -) - -// SequenceLister helps list Sequences. -// All objects returned here must be treated as read-only. -type SequenceLister interface { - // List lists all Sequences in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Sequence, err error) - // Sequences returns an object that can list and get Sequences. - Sequences(namespace string) SequenceNamespaceLister - SequenceListerExpansion -} - -// sequenceLister implements the SequenceLister interface. -type sequenceLister struct { - indexer cache.Indexer -} - -// NewSequenceLister returns a new SequenceLister. -func NewSequenceLister(indexer cache.Indexer) SequenceLister { - return &sequenceLister{indexer: indexer} -} - -// List lists all Sequences in the indexer. -func (s *sequenceLister) List(selector labels.Selector) (ret []*v1.Sequence, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Sequence)) - }) - return ret, err -} - -// Sequences returns an object that can list and get Sequences. -func (s *sequenceLister) Sequences(namespace string) SequenceNamespaceLister { - return sequenceNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// SequenceNamespaceLister helps list and get Sequences. -// All objects returned here must be treated as read-only. -type SequenceNamespaceLister interface { - // List lists all Sequences in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Sequence, err error) - // Get retrieves the Sequence from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.Sequence, error) - SequenceNamespaceListerExpansion -} - -// sequenceNamespaceLister implements the SequenceNamespaceLister -// interface. -type sequenceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Sequences in the indexer for a given namespace. -func (s sequenceNamespaceLister) List(selector labels.Selector) (ret []*v1.Sequence, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Sequence)) - }) - return ret, err -} - -// Get retrieves the Sequence from the indexer for a given namespace and name. -func (s sequenceNamespaceLister) Get(name string) (*v1.Sequence, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("sequence"), name) - } - return obj.(*v1.Sequence), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/channel.go b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/channel.go deleted file mode 100644 index 541b1bb754..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/channel.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/messaging/v1" -) - -// ChannelLister helps list Channels. -// All objects returned here must be treated as read-only. -type ChannelLister interface { - // List lists all Channels in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Channel, err error) - // Channels returns an object that can list and get Channels. - Channels(namespace string) ChannelNamespaceLister - ChannelListerExpansion -} - -// channelLister implements the ChannelLister interface. -type channelLister struct { - indexer cache.Indexer -} - -// NewChannelLister returns a new ChannelLister. -func NewChannelLister(indexer cache.Indexer) ChannelLister { - return &channelLister{indexer: indexer} -} - -// List lists all Channels in the indexer. -func (s *channelLister) List(selector labels.Selector) (ret []*v1.Channel, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Channel)) - }) - return ret, err -} - -// Channels returns an object that can list and get Channels. -func (s *channelLister) Channels(namespace string) ChannelNamespaceLister { - return channelNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ChannelNamespaceLister helps list and get Channels. -// All objects returned here must be treated as read-only. -type ChannelNamespaceLister interface { - // List lists all Channels in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Channel, err error) - // Get retrieves the Channel from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.Channel, error) - ChannelNamespaceListerExpansion -} - -// channelNamespaceLister implements the ChannelNamespaceLister -// interface. -type channelNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Channels in the indexer for a given namespace. -func (s channelNamespaceLister) List(selector labels.Selector) (ret []*v1.Channel, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Channel)) - }) - return ret, err -} - -// Get retrieves the Channel from the indexer for a given namespace and name. -func (s channelNamespaceLister) Get(name string) (*v1.Channel, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("channel"), name) - } - return obj.(*v1.Channel), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/expansion_generated.go b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/expansion_generated.go deleted file mode 100644 index 26d579bdef..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/expansion_generated.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -// ChannelListerExpansion allows custom methods to be added to -// ChannelLister. -type ChannelListerExpansion interface{} - -// ChannelNamespaceListerExpansion allows custom methods to be added to -// ChannelNamespaceLister. -type ChannelNamespaceListerExpansion interface{} - -// InMemoryChannelListerExpansion allows custom methods to be added to -// InMemoryChannelLister. -type InMemoryChannelListerExpansion interface{} - -// InMemoryChannelNamespaceListerExpansion allows custom methods to be added to -// InMemoryChannelNamespaceLister. -type InMemoryChannelNamespaceListerExpansion interface{} - -// SubscriptionListerExpansion allows custom methods to be added to -// SubscriptionLister. -type SubscriptionListerExpansion interface{} - -// SubscriptionNamespaceListerExpansion allows custom methods to be added to -// SubscriptionNamespaceLister. -type SubscriptionNamespaceListerExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/inmemorychannel.go b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/inmemorychannel.go deleted file mode 100644 index e6b86840c5..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/inmemorychannel.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/messaging/v1" -) - -// InMemoryChannelLister helps list InMemoryChannels. -// All objects returned here must be treated as read-only. -type InMemoryChannelLister interface { - // List lists all InMemoryChannels in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.InMemoryChannel, err error) - // InMemoryChannels returns an object that can list and get InMemoryChannels. - InMemoryChannels(namespace string) InMemoryChannelNamespaceLister - InMemoryChannelListerExpansion -} - -// inMemoryChannelLister implements the InMemoryChannelLister interface. -type inMemoryChannelLister struct { - indexer cache.Indexer -} - -// NewInMemoryChannelLister returns a new InMemoryChannelLister. -func NewInMemoryChannelLister(indexer cache.Indexer) InMemoryChannelLister { - return &inMemoryChannelLister{indexer: indexer} -} - -// List lists all InMemoryChannels in the indexer. -func (s *inMemoryChannelLister) List(selector labels.Selector) (ret []*v1.InMemoryChannel, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.InMemoryChannel)) - }) - return ret, err -} - -// InMemoryChannels returns an object that can list and get InMemoryChannels. -func (s *inMemoryChannelLister) InMemoryChannels(namespace string) InMemoryChannelNamespaceLister { - return inMemoryChannelNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// InMemoryChannelNamespaceLister helps list and get InMemoryChannels. -// All objects returned here must be treated as read-only. -type InMemoryChannelNamespaceLister interface { - // List lists all InMemoryChannels in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.InMemoryChannel, err error) - // Get retrieves the InMemoryChannel from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.InMemoryChannel, error) - InMemoryChannelNamespaceListerExpansion -} - -// inMemoryChannelNamespaceLister implements the InMemoryChannelNamespaceLister -// interface. -type inMemoryChannelNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all InMemoryChannels in the indexer for a given namespace. -func (s inMemoryChannelNamespaceLister) List(selector labels.Selector) (ret []*v1.InMemoryChannel, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.InMemoryChannel)) - }) - return ret, err -} - -// Get retrieves the InMemoryChannel from the indexer for a given namespace and name. -func (s inMemoryChannelNamespaceLister) Get(name string) (*v1.InMemoryChannel, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("inmemorychannel"), name) - } - return obj.(*v1.InMemoryChannel), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/subscription.go b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/subscription.go deleted file mode 100644 index d50d620dbe..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/subscription.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/messaging/v1" -) - -// SubscriptionLister helps list Subscriptions. -// All objects returned here must be treated as read-only. -type SubscriptionLister interface { - // List lists all Subscriptions in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Subscription, err error) - // Subscriptions returns an object that can list and get Subscriptions. - Subscriptions(namespace string) SubscriptionNamespaceLister - SubscriptionListerExpansion -} - -// subscriptionLister implements the SubscriptionLister interface. -type subscriptionLister struct { - indexer cache.Indexer -} - -// NewSubscriptionLister returns a new SubscriptionLister. -func NewSubscriptionLister(indexer cache.Indexer) SubscriptionLister { - return &subscriptionLister{indexer: indexer} -} - -// List lists all Subscriptions in the indexer. -func (s *subscriptionLister) List(selector labels.Selector) (ret []*v1.Subscription, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Subscription)) - }) - return ret, err -} - -// Subscriptions returns an object that can list and get Subscriptions. -func (s *subscriptionLister) Subscriptions(namespace string) SubscriptionNamespaceLister { - return subscriptionNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// SubscriptionNamespaceLister helps list and get Subscriptions. -// All objects returned here must be treated as read-only. -type SubscriptionNamespaceLister interface { - // List lists all Subscriptions in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Subscription, err error) - // Get retrieves the Subscription from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.Subscription, error) - SubscriptionNamespaceListerExpansion -} - -// subscriptionNamespaceLister implements the SubscriptionNamespaceLister -// interface. -type subscriptionNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Subscriptions in the indexer for a given namespace. -func (s subscriptionNamespaceLister) List(selector labels.Selector) (ret []*v1.Subscription, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Subscription)) - }) - return ret, err -} - -// Get retrieves the Subscription from the indexer for a given namespace and name. -func (s subscriptionNamespaceLister) Get(name string) (*v1.Subscription, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("subscription"), name) - } - return obj.(*v1.Subscription), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/sinks/v1alpha1/expansion_generated.go b/vendor/knative.dev/eventing/pkg/client/listers/sinks/v1alpha1/expansion_generated.go deleted file mode 100644 index 48dbd03263..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/sinks/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -// JobSinkListerExpansion allows custom methods to be added to -// JobSinkLister. -type JobSinkListerExpansion interface{} - -// JobSinkNamespaceListerExpansion allows custom methods to be added to -// JobSinkNamespaceLister. -type JobSinkNamespaceListerExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/sinks/v1alpha1/jobsink.go b/vendor/knative.dev/eventing/pkg/client/listers/sinks/v1alpha1/jobsink.go deleted file mode 100644 index 4dcd9c82cd..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/sinks/v1alpha1/jobsink.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1alpha1 "knative.dev/eventing/pkg/apis/sinks/v1alpha1" -) - -// JobSinkLister helps list JobSinks. -// All objects returned here must be treated as read-only. -type JobSinkLister interface { - // List lists all JobSinks in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.JobSink, err error) - // JobSinks returns an object that can list and get JobSinks. - JobSinks(namespace string) JobSinkNamespaceLister - JobSinkListerExpansion -} - -// jobSinkLister implements the JobSinkLister interface. -type jobSinkLister struct { - indexer cache.Indexer -} - -// NewJobSinkLister returns a new JobSinkLister. -func NewJobSinkLister(indexer cache.Indexer) JobSinkLister { - return &jobSinkLister{indexer: indexer} -} - -// List lists all JobSinks in the indexer. -func (s *jobSinkLister) List(selector labels.Selector) (ret []*v1alpha1.JobSink, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.JobSink)) - }) - return ret, err -} - -// JobSinks returns an object that can list and get JobSinks. -func (s *jobSinkLister) JobSinks(namespace string) JobSinkNamespaceLister { - return jobSinkNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// JobSinkNamespaceLister helps list and get JobSinks. -// All objects returned here must be treated as read-only. -type JobSinkNamespaceLister interface { - // List lists all JobSinks in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.JobSink, err error) - // Get retrieves the JobSink from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.JobSink, error) - JobSinkNamespaceListerExpansion -} - -// jobSinkNamespaceLister implements the JobSinkNamespaceLister -// interface. -type jobSinkNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all JobSinks in the indexer for a given namespace. -func (s jobSinkNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.JobSink, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.JobSink)) - }) - return ret, err -} - -// Get retrieves the JobSink from the indexer for a given namespace and name. -func (s jobSinkNamespaceLister) Get(name string) (*v1alpha1.JobSink, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("jobsink"), name) - } - return obj.(*v1alpha1.JobSink), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/apiserversource.go b/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/apiserversource.go deleted file mode 100644 index 4c8fb52f12..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/apiserversource.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/sources/v1" -) - -// ApiServerSourceLister helps list ApiServerSources. -// All objects returned here must be treated as read-only. -type ApiServerSourceLister interface { - // List lists all ApiServerSources in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ApiServerSource, err error) - // ApiServerSources returns an object that can list and get ApiServerSources. - ApiServerSources(namespace string) ApiServerSourceNamespaceLister - ApiServerSourceListerExpansion -} - -// apiServerSourceLister implements the ApiServerSourceLister interface. -type apiServerSourceLister struct { - indexer cache.Indexer -} - -// NewApiServerSourceLister returns a new ApiServerSourceLister. -func NewApiServerSourceLister(indexer cache.Indexer) ApiServerSourceLister { - return &apiServerSourceLister{indexer: indexer} -} - -// List lists all ApiServerSources in the indexer. -func (s *apiServerSourceLister) List(selector labels.Selector) (ret []*v1.ApiServerSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ApiServerSource)) - }) - return ret, err -} - -// ApiServerSources returns an object that can list and get ApiServerSources. -func (s *apiServerSourceLister) ApiServerSources(namespace string) ApiServerSourceNamespaceLister { - return apiServerSourceNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ApiServerSourceNamespaceLister helps list and get ApiServerSources. -// All objects returned here must be treated as read-only. -type ApiServerSourceNamespaceLister interface { - // List lists all ApiServerSources in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ApiServerSource, err error) - // Get retrieves the ApiServerSource from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.ApiServerSource, error) - ApiServerSourceNamespaceListerExpansion -} - -// apiServerSourceNamespaceLister implements the ApiServerSourceNamespaceLister -// interface. -type apiServerSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ApiServerSources in the indexer for a given namespace. -func (s apiServerSourceNamespaceLister) List(selector labels.Selector) (ret []*v1.ApiServerSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ApiServerSource)) - }) - return ret, err -} - -// Get retrieves the ApiServerSource from the indexer for a given namespace and name. -func (s apiServerSourceNamespaceLister) Get(name string) (*v1.ApiServerSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("apiserversource"), name) - } - return obj.(*v1.ApiServerSource), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/containersource.go b/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/containersource.go deleted file mode 100644 index 12d1e51cd3..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/containersource.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/sources/v1" -) - -// ContainerSourceLister helps list ContainerSources. -// All objects returned here must be treated as read-only. -type ContainerSourceLister interface { - // List lists all ContainerSources in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ContainerSource, err error) - // ContainerSources returns an object that can list and get ContainerSources. - ContainerSources(namespace string) ContainerSourceNamespaceLister - ContainerSourceListerExpansion -} - -// containerSourceLister implements the ContainerSourceLister interface. -type containerSourceLister struct { - indexer cache.Indexer -} - -// NewContainerSourceLister returns a new ContainerSourceLister. -func NewContainerSourceLister(indexer cache.Indexer) ContainerSourceLister { - return &containerSourceLister{indexer: indexer} -} - -// List lists all ContainerSources in the indexer. -func (s *containerSourceLister) List(selector labels.Selector) (ret []*v1.ContainerSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ContainerSource)) - }) - return ret, err -} - -// ContainerSources returns an object that can list and get ContainerSources. -func (s *containerSourceLister) ContainerSources(namespace string) ContainerSourceNamespaceLister { - return containerSourceNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ContainerSourceNamespaceLister helps list and get ContainerSources. -// All objects returned here must be treated as read-only. -type ContainerSourceNamespaceLister interface { - // List lists all ContainerSources in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ContainerSource, err error) - // Get retrieves the ContainerSource from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.ContainerSource, error) - ContainerSourceNamespaceListerExpansion -} - -// containerSourceNamespaceLister implements the ContainerSourceNamespaceLister -// interface. -type containerSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ContainerSources in the indexer for a given namespace. -func (s containerSourceNamespaceLister) List(selector labels.Selector) (ret []*v1.ContainerSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ContainerSource)) - }) - return ret, err -} - -// Get retrieves the ContainerSource from the indexer for a given namespace and name. -func (s containerSourceNamespaceLister) Get(name string) (*v1.ContainerSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("containersource"), name) - } - return obj.(*v1.ContainerSource), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/expansion_generated.go b/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/expansion_generated.go deleted file mode 100644 index 7bc0e29528..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/expansion_generated.go +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -// ApiServerSourceListerExpansion allows custom methods to be added to -// ApiServerSourceLister. -type ApiServerSourceListerExpansion interface{} - -// ApiServerSourceNamespaceListerExpansion allows custom methods to be added to -// ApiServerSourceNamespaceLister. -type ApiServerSourceNamespaceListerExpansion interface{} - -// ContainerSourceListerExpansion allows custom methods to be added to -// ContainerSourceLister. -type ContainerSourceListerExpansion interface{} - -// ContainerSourceNamespaceListerExpansion allows custom methods to be added to -// ContainerSourceNamespaceLister. -type ContainerSourceNamespaceListerExpansion interface{} - -// PingSourceListerExpansion allows custom methods to be added to -// PingSourceLister. -type PingSourceListerExpansion interface{} - -// PingSourceNamespaceListerExpansion allows custom methods to be added to -// PingSourceNamespaceLister. -type PingSourceNamespaceListerExpansion interface{} - -// SinkBindingListerExpansion allows custom methods to be added to -// SinkBindingLister. -type SinkBindingListerExpansion interface{} - -// SinkBindingNamespaceListerExpansion allows custom methods to be added to -// SinkBindingNamespaceLister. -type SinkBindingNamespaceListerExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/pingsource.go b/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/pingsource.go deleted file mode 100644 index 54918c9d5d..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/pingsource.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/sources/v1" -) - -// PingSourceLister helps list PingSources. -// All objects returned here must be treated as read-only. -type PingSourceLister interface { - // List lists all PingSources in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.PingSource, err error) - // PingSources returns an object that can list and get PingSources. - PingSources(namespace string) PingSourceNamespaceLister - PingSourceListerExpansion -} - -// pingSourceLister implements the PingSourceLister interface. -type pingSourceLister struct { - indexer cache.Indexer -} - -// NewPingSourceLister returns a new PingSourceLister. -func NewPingSourceLister(indexer cache.Indexer) PingSourceLister { - return &pingSourceLister{indexer: indexer} -} - -// List lists all PingSources in the indexer. -func (s *pingSourceLister) List(selector labels.Selector) (ret []*v1.PingSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.PingSource)) - }) - return ret, err -} - -// PingSources returns an object that can list and get PingSources. -func (s *pingSourceLister) PingSources(namespace string) PingSourceNamespaceLister { - return pingSourceNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// PingSourceNamespaceLister helps list and get PingSources. -// All objects returned here must be treated as read-only. -type PingSourceNamespaceLister interface { - // List lists all PingSources in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.PingSource, err error) - // Get retrieves the PingSource from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.PingSource, error) - PingSourceNamespaceListerExpansion -} - -// pingSourceNamespaceLister implements the PingSourceNamespaceLister -// interface. -type pingSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all PingSources in the indexer for a given namespace. -func (s pingSourceNamespaceLister) List(selector labels.Selector) (ret []*v1.PingSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.PingSource)) - }) - return ret, err -} - -// Get retrieves the PingSource from the indexer for a given namespace and name. -func (s pingSourceNamespaceLister) Get(name string) (*v1.PingSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("pingsource"), name) - } - return obj.(*v1.PingSource), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/sinkbinding.go b/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/sinkbinding.go deleted file mode 100644 index e0441b8749..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1/sinkbinding.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1 "knative.dev/eventing/pkg/apis/sources/v1" -) - -// SinkBindingLister helps list SinkBindings. -// All objects returned here must be treated as read-only. -type SinkBindingLister interface { - // List lists all SinkBindings in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.SinkBinding, err error) - // SinkBindings returns an object that can list and get SinkBindings. - SinkBindings(namespace string) SinkBindingNamespaceLister - SinkBindingListerExpansion -} - -// sinkBindingLister implements the SinkBindingLister interface. -type sinkBindingLister struct { - indexer cache.Indexer -} - -// NewSinkBindingLister returns a new SinkBindingLister. -func NewSinkBindingLister(indexer cache.Indexer) SinkBindingLister { - return &sinkBindingLister{indexer: indexer} -} - -// List lists all SinkBindings in the indexer. -func (s *sinkBindingLister) List(selector labels.Selector) (ret []*v1.SinkBinding, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.SinkBinding)) - }) - return ret, err -} - -// SinkBindings returns an object that can list and get SinkBindings. -func (s *sinkBindingLister) SinkBindings(namespace string) SinkBindingNamespaceLister { - return sinkBindingNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// SinkBindingNamespaceLister helps list and get SinkBindings. -// All objects returned here must be treated as read-only. -type SinkBindingNamespaceLister interface { - // List lists all SinkBindings in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.SinkBinding, err error) - // Get retrieves the SinkBinding from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.SinkBinding, error) - SinkBindingNamespaceListerExpansion -} - -// sinkBindingNamespaceLister implements the SinkBindingNamespaceLister -// interface. -type sinkBindingNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all SinkBindings in the indexer for a given namespace. -func (s sinkBindingNamespaceLister) List(selector labels.Selector) (ret []*v1.SinkBinding, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.SinkBinding)) - }) - return ret, err -} - -// Get retrieves the SinkBinding from the indexer for a given namespace and name. -func (s sinkBindingNamespaceLister) Get(name string) (*v1.SinkBinding, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("sinkbinding"), name) - } - return obj.(*v1.SinkBinding), nil -} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1beta2/expansion_generated.go b/vendor/knative.dev/eventing/pkg/client/listers/sources/v1beta2/expansion_generated.go deleted file mode 100644 index 83a507e828..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1beta2/expansion_generated.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta2 - -// PingSourceListerExpansion allows custom methods to be added to -// PingSourceLister. -type PingSourceListerExpansion interface{} - -// PingSourceNamespaceListerExpansion allows custom methods to be added to -// PingSourceNamespaceLister. -type PingSourceNamespaceListerExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1beta2/pingsource.go b/vendor/knative.dev/eventing/pkg/client/listers/sources/v1beta2/pingsource.go deleted file mode 100644 index 14c549b239..0000000000 --- a/vendor/knative.dev/eventing/pkg/client/listers/sources/v1beta2/pingsource.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2021 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta2 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1beta2 "knative.dev/eventing/pkg/apis/sources/v1beta2" -) - -// PingSourceLister helps list PingSources. -// All objects returned here must be treated as read-only. -type PingSourceLister interface { - // List lists all PingSources in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta2.PingSource, err error) - // PingSources returns an object that can list and get PingSources. - PingSources(namespace string) PingSourceNamespaceLister - PingSourceListerExpansion -} - -// pingSourceLister implements the PingSourceLister interface. -type pingSourceLister struct { - indexer cache.Indexer -} - -// NewPingSourceLister returns a new PingSourceLister. -func NewPingSourceLister(indexer cache.Indexer) PingSourceLister { - return &pingSourceLister{indexer: indexer} -} - -// List lists all PingSources in the indexer. -func (s *pingSourceLister) List(selector labels.Selector) (ret []*v1beta2.PingSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.PingSource)) - }) - return ret, err -} - -// PingSources returns an object that can list and get PingSources. -func (s *pingSourceLister) PingSources(namespace string) PingSourceNamespaceLister { - return pingSourceNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// PingSourceNamespaceLister helps list and get PingSources. -// All objects returned here must be treated as read-only. -type PingSourceNamespaceLister interface { - // List lists all PingSources in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta2.PingSource, err error) - // Get retrieves the PingSource from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1beta2.PingSource, error) - PingSourceNamespaceListerExpansion -} - -// pingSourceNamespaceLister implements the PingSourceNamespaceLister -// interface. -type pingSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all PingSources in the indexer for a given namespace. -func (s pingSourceNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.PingSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.PingSource)) - }) - return ret, err -} - -// Get retrieves the PingSource from the indexer for a given namespace and name. -func (s pingSourceNamespaceLister) Get(name string) (*v1beta2.PingSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta2.Resource("pingsource"), name) - } - return obj.(*v1beta2.PingSource), nil -} diff --git a/vendor/knative.dev/eventing/test/rekt/features/broker/control_plane.go b/vendor/knative.dev/eventing/test/rekt/features/broker/control_plane.go new file mode 100644 index 0000000000..608c1c3509 --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/broker/control_plane.go @@ -0,0 +1,713 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package broker + +import ( + "context" + "encoding/json" + "fmt" + "strings" + + conformanceevent "github.com/cloudevents/conformance/pkg/event" + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/ptr" + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/manifest" + "knative.dev/reconciler-test/pkg/resources/service" + "knative.dev/reconciler-test/pkg/state" + + v1 "knative.dev/eventing/pkg/apis/duck/v1" + eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" + eventingclientsetv1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1" + eventingclient "knative.dev/eventing/pkg/client/injection/client" + "knative.dev/eventing/test/rekt/features/knconf" + triggerfeatures "knative.dev/eventing/test/rekt/features/trigger" + "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/eventing/test/rekt/resources/delivery" + triggerresources "knative.dev/eventing/test/rekt/resources/trigger" +) + +func ControlPlaneConformance(brokerName string, brokerOpts ...manifest.CfgFn) *feature.FeatureSet { + fs := &feature.FeatureSet{ + Name: "Knative Broker Specification - Control Plane", + Features: []*feature.Feature{ + ControlPlaneBroker(brokerName, brokerOpts...), + ControlPlaneTrigger_GivenBroker(brokerName), + ControlPlaneTrigger_GivenBrokerTriggerReady(brokerName), + ControlPlaneTrigger_WithBrokerLifecycle(brokerOpts...), + ControlPlaneTrigger_WithValidFilters(brokerName), + ControlPlaneTrigger_WithInvalidFilters(brokerName), + }, + } + + // Add each feature of event routing and Delivery tests as a new feature + addControlPlaneEventRouting(fs, brokerOpts...) + addControlPlaneDelivery(fs, brokerOpts...) + // TODO: This is not a control plane test, or at best it is a blend with data plane. + // Must("Events that pass the attributes filter MUST include context or extension attributes that match all key-value pairs exactly.", todo) + + return fs +} + +func setBrokerName(name string) feature.StepFn { + return func(ctx context.Context, t feature.T) { + state.SetOrFail(ctx, t, BrokerNameKey, name) + } +} + +func ControlPlaneBroker(brokerName string, brokerOpts ...manifest.CfgFn) *feature.Feature { + f := feature.NewFeatureNamed("Broker") + bName := feature.MakeRandomK8sName("broker") + sink := feature.MakeRandomK8sName("sink") + + f.Setup("Set Broker Name", setBrokerName(bName)) + + f.Setup("install a service", service.Install(sink, + service.WithSelectors(map[string]string{"app": "rekt"}))) + brokerOpts = append(brokerOpts, broker.WithEnvConfig()...) + brokerOpts = append(brokerOpts, delivery.WithDeadLetterSink(service.AsKReference(sink), "")) + f.Setup("update broker", broker.Install(bName, brokerOpts...)) + f.Setup("broker goes ready", broker.IsReady(bName)) + + f.Stable("Conformance"). + Should("Broker objects SHOULD include a Ready condition in their status", + knconf.KResourceHasReadyInConditions(broker.GVR(), brokerName)). + Should("The Broker SHOULD indicate Ready=True when its ingress is available to receive events.", + readyBrokerHasIngressAvailable). + Should("While a Broker is Ready, it SHOULD be a valid Addressable and its `status.address.url` field SHOULD indicate the address of its ingress.", + readyBrokerIsAddressable). + Must("The class of a Broker object MUST be immutable.", + brokerClassIsImmutable). + Should("Set the Broker status.deadLetterSinkURI if there is a valid spec.delivery.deadLetterSink defined", + BrokerStatusDLSURISet). + Must("Broker config MUST be immutable.", + brokerConfigIsImmutable) + return f +} + +func ControlPlaneTrigger_GivenBroker(brokerName string) *feature.Feature { + f := feature.NewFeatureNamed("Trigger, Given Broker") + f.Setup("Set Broker Name", setBrokerName(brokerName)) + + subscriberName := feature.MakeRandomK8sName("sub") + f.Setup("Install Subscriber", service.Install(subscriberName, + service.WithSelectors(map[string]string{"bad": "svc"}))) + + triggerName := feature.MakeRandomK8sName("trigger") + f.Setup("Create a Trigger", triggerresources.Install(triggerName, triggerresources.WithBrokerName(brokerName), + triggerresources.WithSubscriber(service.AsKReference(subscriberName), ""), + )) + + f.Setup("Set Trigger Name", triggerfeatures.SetTriggerName(triggerName)) + + f.Stable("Conformance"). + Should("Triggers SHOULD include a Ready condition in their status.", + triggerHasReadyInConditions). + Should("The Trigger SHOULD indicate Ready=True when events can be delivered to its subscriber.", + readyTriggerCanDeliver). + Must("Triggers MUST be assigned to exactly one Broker.", + triggerHasOneBroker). + Must("The assigned Broker of a Trigger SHOULD be immutable.", + triggerSpecBrokerIsImmutable) + + return f +} + +func ControlPlaneTrigger_GivenBrokerTriggerReady(brokerName string) *feature.Feature { + f := feature.NewFeatureNamed("Trigger, Given Broker") + f.Setup("Set Broker Name", setBrokerName(brokerName)) + + subscriberName := feature.MakeRandomK8sName("sub") + f.Setup("Install Subscriber", service.Install(subscriberName, + service.WithSelectors(map[string]string{"bad": "svc"}))) + + triggerName := feature.MakeRandomK8sName("trigger") + f.Setup("Create a Trigger", triggerresources.Install(triggerName, triggerresources.WithBrokerName(brokerName), + triggerresources.WithSubscriber(service.AsKReference(subscriberName), ""), + )) + + f.Setup("Set Trigger Name", triggerfeatures.SetTriggerName(triggerName)) + + f.Requirement("The Trigger is Ready", triggerresources.IsReady(triggerName)) + + f.Stable("Conformance"). + Should("While a Trigger is Ready, it SHOULD indicate its subscriber's URI via the `status.subscriberUri` field.", + readyTriggerHasSubscriberURI) + + return f +} + +func ControlPlaneTrigger_WithBrokerLifecycle(brokerOpts ...manifest.CfgFn) *feature.Feature { + f := feature.NewFeatureNamed("Trigger, With Broker Lifecycle") + + subscriberName := feature.MakeRandomK8sName("sub") + f.Setup("Install Subscriber", service.Install(subscriberName, + service.WithSelectors(map[string]string{"bad": "svc"}))) + + brokerName := feature.MakeRandomK8sName("broker") + + triggerName := feature.MakeRandomK8sName("trigger") + f.Setup("Create a Trigger", triggerresources.Install(triggerName, triggerresources.WithBrokerName(brokerName), + triggerresources.WithSubscriber(service.AsKReference(subscriberName), ""), + )) + + f.Setup("Set Trigger Name", triggerfeatures.SetTriggerName(triggerName)) + + brokerOpts = append(brokerOpts, broker.WithEnvConfig()...) + + f.Stable("Conformance"). + May("A Trigger MAY be created before its assigned Broker exists.", + triggerHasOneBroker). + Should("A Trigger SHOULD progress to Ready when its assigned Broker exists and is Ready.", + func(ctx context.Context, t feature.T) { + broker.Install(brokerName, brokerOpts...)(ctx, t) // Default broker from Env. + broker.IsReady(brokerName)(ctx, t) + triggerresources.IsReady(triggerName)(ctx, t) + }) + return f +} + +func ControlPlaneTrigger_WithValidFilters(brokerName string) *feature.Feature { + f := feature.NewFeatureNamed("Trigger, With Filters") + f.Setup("Set Broker Name", setBrokerName(brokerName)) + + subscriberName := feature.MakeRandomK8sName("sub") + f.Setup("Install Subscriber", service.Install(subscriberName, + service.WithSelectors(map[string]string{"bad": "svc"}))) + + // CloudEvents attribute names MUST consist of lower-case letters ('a' to 'z') or digits ('0' to '9') from the ASCII character set. Attribute names SHOULD be descriptive and terse and SHOULD NOT exceed 20 characters in length. + filters := map[string]string{ + "source": "a source", + "id": "an id", + "specversion": "the spec version", + "type": "the type", + "subject": "a subject", + "time": "a time", + "datacontenttype": "a datacontenttype", + "dataschema": "a dataschema", + "aaa": "bbb", + "c1d2e3": "123", + "abcdefghijklmnopqrst": "max length", + } + + triggerName := feature.MakeRandomK8sName("trigger") + f.Setup("Create a Trigger", triggerresources.Install(triggerName, triggerresources.WithBrokerName(brokerName), + triggerresources.WithSubscriber(service.AsKReference(subscriberName), ""), + triggerresources.WithFilter(filters), + )) + + f.Setup("Set Trigger Name", triggerfeatures.SetTriggerName(triggerName)) + + f.Stable("Conformance"). + Must("The attributes filter specifying a list of key-value pairs MUST be supported by Trigger.", + // Compare the passed filters with what is found on the control plane. + func(ctx context.Context, t feature.T) { + trigger := triggerfeatures.GetTrigger(ctx, t) + got := make(map[string]string) + for k, v := range trigger.Spec.Filter.Attributes { + got[k] = v + } + want := filters + if diff := cmp.Diff(want, got, cmpopts.SortMaps(func(a, b string) bool { + return a < b + })); diff != "" { + t.Error("Filters do not match (-want, +got) =", diff) + } + }) + + return f +} + +func ControlPlaneTrigger_WithInvalidFilters(brokerName string) *feature.Feature { + f := feature.NewFeatureNamed("Trigger, With Filters") + f.Setup("Set Broker Name", setBrokerName(brokerName)) + + subscriberName := feature.MakeRandomK8sName("sub") + f.Setup("Install Subscriber", service.Install(subscriberName, + service.WithSelectors(map[string]string{"bad": "svc"}))) + + // CloudEvents attribute names MUST consist of lower-case letters ('a' to 'z') or digits ('0' to '9') from the ASCII character set. Attribute names SHOULD be descriptive and terse and SHOULD NOT exceed 20 characters in length. + filters := map[string]string{ + "SOURCE": "not lower case letters, all", + "Source": "not lower case letters, first", + "souRce": "not lower case letters, not first", + "s pace s": "no spaces", + "s_pace_s": "no underscores", + "s-pace-s": "no dashes", + "123": "just numbers", + "😊": "unicode not supported", + "!@#$%^&*()-_=_`~+\\": "other non-(a-z,0-9) type chars, top row", + "{}[];':\"<>,./?": "other non-(a-z,0-9) type chars, brackets", + } + + triggerName := feature.MakeRandomK8sName("trigger") + f.Setup("Create a Trigger", triggerresources.Install(triggerName, triggerresources.WithBrokerName(brokerName), + triggerresources.WithSubscriber(service.AsKReference(subscriberName), ""), + )) + + f.Setup("Set Trigger Name", triggerfeatures.SetTriggerName(triggerName)) + + asserter := f.Stable("Conformance - Negatives - The attributes filter specifying a list of key-value pairs MUST be supported by Trigger.") + + for key, value := range filters { + k := key + v := value + asserter.Must("Reject invalid filter - "+k+" - "+v, + // Compare the passed filters with what is found on the control plane. + func(ctx context.Context, t feature.T) { + trigger := triggerfeatures.GetTrigger(ctx, t) + + if trigger.Spec.Filter == nil { + trigger.Spec.Filter = &eventingv1.TriggerFilter{ + Attributes: map[string]string{}, + } + } else if trigger.Spec.Filter.Attributes == nil { + trigger.Spec.Filter.Attributes = map[string]string{} + } + + trigger.Spec.Filter.Attributes[k] = v + + _, err := Client(ctx).Triggers.Update(ctx, trigger, metav1.UpdateOptions{}) + if err != nil { + // We expect an error. + // Success! + } else { + t.Error("expected Trigger to reject the spec.filter update.") + } + }) + } + return f +} + +func addControlPlaneDelivery(fs *feature.FeatureSet, brokerOpts ...manifest.CfgFn) { + for i, tt := range []struct { + name string + brokerDS *v1.DeliverySpec + // Trigger 1 Delivery spec + t1DS *v1.DeliverySpec + // How many events to fail before succeeding + t1FailCount uint + // Trigger 2 Delivery spec + t2DS *v1.DeliverySpec + // How many events to fail before succeeding + t2FailCount uint + }{{ + name: "When `BrokerSpec.Delivery` and `TriggerSpec.Delivery` are both not configured, no delivery spec SHOULD be used.", + }, { + name: "When `BrokerSpec.Delivery` is configured, but not the specific `TriggerSpec.Delivery`, then the `BrokerSpec.Delivery` SHOULD be used. (Retry)", + brokerDS: &v1.DeliverySpec{ + DeadLetterSink: new(duckv1.Destination), + Retry: ptr.Int32(3), + }, + t1FailCount: 3, // Should get event. + t2FailCount: 4, // Should end up in DLQ. + }, { + name: "When `TriggerSpec.Delivery` is configured, then `TriggerSpec.Delivery` SHOULD be used. (Retry)", + brokerDS: &v1.DeliverySpec{ // Disable delivery spec defaulting + Retry: ptr.Int32(0), + }, + t1DS: &v1.DeliverySpec{ + DeadLetterSink: new(duckv1.Destination), + Retry: ptr.Int32(3), + }, + t2DS: &v1.DeliverySpec{ + Retry: ptr.Int32(1), + }, + t1FailCount: 3, // Should get event. + t2FailCount: 2, // Should be dropped. + }, { + name: "When both `BrokerSpec.Delivery` and `TriggerSpec.Delivery` is configured, then `TriggerSpec.Delivery` SHOULD be used. (Retry)", + brokerDS: &v1.DeliverySpec{ + DeadLetterSink: new(duckv1.Destination), + Retry: ptr.Int32(1), + }, + t1DS: &v1.DeliverySpec{ + DeadLetterSink: new(duckv1.Destination), + Retry: ptr.Int32(3), + }, + t1FailCount: 3, // Should get event. + t2FailCount: 2, // Should end up in DLQ. + }, { + name: "When both `BrokerSpec.Delivery` and `TriggerSpec.Delivery` is configured, then `TriggerSpec.Delivery` SHOULD be used. (Retry+DLQ)", + brokerDS: &v1.DeliverySpec{ + DeadLetterSink: new(duckv1.Destination), + Retry: ptr.Int32(1), + }, + t1DS: &v1.DeliverySpec{ + DeadLetterSink: new(duckv1.Destination), + Retry: ptr.Int32(3), + }, + t1FailCount: 4, // Should end up in Trigger DLQ. + t2FailCount: 2, // Should end up in Broker DLQ. + }} { + // TODO: Each of these creates quite a few resources. We need to figure out a way + // to delete the resources for each Feature once the test completes. Today it's + // not easy (if at all possible) to do this, since Environment contains the References + // to created resources, but it's not granular enough. + brokerName := fmt.Sprintf("dlq-test-%d", i) + f := feature.NewFeatureNamed(fmt.Sprintf("Delivery Spec - %s", brokerName)) + cfg := []triggerCfg{{ + delivery: tt.t1DS, + failCount: tt.t1FailCount, + }, { + delivery: tt.t2DS, + failCount: tt.t2FailCount, + }} + prober := createBrokerTriggerTopology(f, brokerName, tt.brokerDS, cfg, brokerOpts...) + + // Send an event into the matrix and hope for the best + prober.SenderFullEvents(1) + f.Requirement("install source", prober.SenderInstall("source")) + + // All events have been sent, time to look at the specs and confirm we got them. + expectedEvents := createExpectedEventPatterns(tt.brokerDS, cfg) + + f.Requirement("wait until done", func(ctx context.Context, t feature.T) { + interval, timeout := environment.PollTimingsFromContext(ctx) + err := wait.PollUntilContextTimeout(ctx, interval, timeout, true, func(ctx context.Context) (bool, error) { + gtg := true + for prefix, want := range expectedEvents { + events := prober.ReceivedOrRejectedBy(ctx, prefix) + if len(events) != len(want.Success) { + gtg = false + } + } + return gtg, nil + }) + if err != nil { + t.Failed() + } + }) + f.Stable("Conformance").Should(tt.name, knconf.AssertEventPatterns(prober, expectedEvents)) + f.Teardown("Delete feature resources", f.DeleteResources) + fs.Features = append(fs.Features, f) + } +} + +func addControlPlaneEventRouting(fs *feature.FeatureSet, brokerOpts ...manifest.CfgFn) { + + fullEvent := cetest.FullEvent() + replyEvent := cetest.FullEvent() + replyEvent.SetType("com.example.ReplyEvent") + + for i, tt := range []struct { + name string + config []triggerCfg + inEvents []conformanceevent.Event + }{{ + name: "One trigger, no filter, gets event", + config: []triggerCfg{{}}, + inEvents: []conformanceevent.Event{knconf.EventToEvent(&fullEvent)}, + }, { + name: "One trigger, with filter, does not get event", + config: []triggerCfg{ + { + filter: &eventingv1.TriggerFilter{ + Attributes: eventingv1.TriggerFilterAttributes{ + "type": "mytype", + }, + }, + }, + }, + inEvents: []conformanceevent.Event{ + { + Attributes: conformanceevent.ContextAttributes{ + Type: "notmytype", + }, + }, + }, + }, { + name: "One trigger, with filter, gets the event", + config: []triggerCfg{ + { + filter: &eventingv1.TriggerFilter{ + Attributes: eventingv1.TriggerFilterAttributes{ + "type": "com.example.FullEvent", + }, + }, + }, + }, + inEvents: []conformanceevent.Event{knconf.EventToEvent(&fullEvent)}, + }, { + // name: "Two triggers, with filter, both get the event", + config: []triggerCfg{ + { + filter: &eventingv1.TriggerFilter{ + Attributes: eventingv1.TriggerFilterAttributes{ + "type": "com.example.FullEvent", + }, + }, + }, { + filter: &eventingv1.TriggerFilter{ + Attributes: eventingv1.TriggerFilterAttributes{ + "type": "com.example.FullEvent", + }, + }, + }, + }, + inEvents: []conformanceevent.Event{knconf.EventToEvent(&fullEvent)}, + }, { + name: "Two triggers, with filter, only matching one gets the event", + config: []triggerCfg{ + { + filter: &eventingv1.TriggerFilter{ + Attributes: eventingv1.TriggerFilterAttributes{ + "type": "notmytype", + }, + }, + }, { + filter: &eventingv1.TriggerFilter{ + Attributes: eventingv1.TriggerFilterAttributes{ + "type": "com.example.FullEvent", + }, + }, + }, + }, + inEvents: []conformanceevent.Event{knconf.EventToEvent(&fullEvent)}, + }, { + name: "Two triggers, with filter, first one matches incoming event, creates reply, which matches the second one", + config: []triggerCfg{ + { + filter: &eventingv1.TriggerFilter{ + Attributes: eventingv1.TriggerFilterAttributes{ + "type": "com.example.FullEvent", + }, + }, + reply: func() *conformanceevent.Event { + reply := knconf.EventToEvent(&replyEvent) + reply.Attributes.DataContentType = "application/json" // EventsHub defaults all data to this. + return &reply + }(), + }, { + filter: &eventingv1.TriggerFilter{ + Attributes: eventingv1.TriggerFilterAttributes{ + "type": "com.example.ReplyEvent", + }, + }, + }, + }, + inEvents: []conformanceevent.Event{knconf.EventToEvent(&fullEvent)}, + }, { + name: "Two triggers, with no filters, both get the event", + config: []triggerCfg{{}, {}}, + inEvents: []conformanceevent.Event{knconf.EventToEvent(&fullEvent)}, + }} { + brokerName := fmt.Sprintf("routing-test-%d", i) + f := feature.NewFeatureNamed(fmt.Sprintf("Event Routing Spec - %s", brokerName)) + f.Setup("Set Broker Name", setBrokerName(brokerName)) + prober := createBrokerTriggerTopology(f, brokerName, nil, tt.config, brokerOpts...) + + // Send an event into the matrix and hope for the best + // TODO: We need to do some work to get the event types into the Prober. + // All the events generated are currently hardcoded into the com.example.FullEvent + // so once prober supports more configuration, wire it up here. + prober.SenderFullEvents(1) + + f.Requirement("install source", prober.SenderInstall("source")) + + // All events have been sent, time to look at the specs and confirm we got them. + expectedEvents := createExpectedEventRoutingMap(tt.config, tt.inEvents) + + f.Requirement("wait until done", func(ctx context.Context, t feature.T) { + interval, timeout := environment.PollTimingsFromContext(ctx) + err := wait.PollUntilContextTimeout(ctx, interval, timeout, true, func(ctx context.Context) (bool, error) { + gtg := true + for prefix, want := range expectedEvents { + events := prober.ReceivedOrRejectedBy(ctx, prefix) + if len(events) != len(want) { + gtg = false + } + } + return gtg, nil + }) + if err != nil { + t.Failed() + } + }) + + f.Stable("Conformance").Should(tt.name, assertExpectedRoutedEvents(prober, expectedEvents)) + f.Teardown("Delete feature resources", f.DeleteResources) + fs.Features = append(fs.Features, f) + } +} + +type EventingClient struct { + Brokers eventingclientsetv1.BrokerInterface + Triggers eventingclientsetv1.TriggerInterface +} + +func Client(ctx context.Context) *EventingClient { + ec := eventingclient.Get(ctx).EventingV1() + env := environment.FromContext(ctx) + + return &EventingClient{ + Brokers: ec.Brokers(env.Namespace()), + Triggers: ec.Triggers(env.Namespace()), + } +} + +const ( + BrokerNameKey = "brokerName" +) + +func getBroker(ctx context.Context, t feature.T) *eventingv1.Broker { + c := Client(ctx) + name := state.GetStringOrFail(ctx, t, BrokerNameKey) + + broker, err := c.Brokers.Get(ctx, name, metav1.GetOptions{}) + if err != nil { + t.Errorf("failed to get Broker, %v", err) + } + return broker +} + +func copyBroker(ctx context.Context, srcBroker *eventingv1.Broker, toName string) (*eventingv1.Broker, error) { + broker := &eventingv1.Broker{ + ObjectMeta: metav1.ObjectMeta{ + Name: toName, + Labels: srcBroker.Labels, + Annotations: srcBroker.Annotations, + }, + Spec: *srcBroker.Spec.DeepCopy(), + } + + return Client(ctx).Brokers.Create(ctx, broker, metav1.CreateOptions{}) +} + +func readyBrokerHasIngressAvailable(ctx context.Context, t feature.T) { + // TODO: I am not sure how to test this from the outside. +} + +func readyBrokerIsAddressable(ctx context.Context, t feature.T) { + broker := getBroker(ctx, t) + + if broker.IsReady() { + if broker.Status.AddressStatus.Address == nil || broker.Status.AddressStatus.Address.URL == nil { + t.Errorf("broker is not addressable") + } + // Success! + } else { + t.Errorf("broker was not ready, reason: %s", broker.Status.GetTopLevelCondition().Reason) + } +} + +func BrokerStatusDLSURISet(ctx context.Context, t feature.T) { + broker := getBroker(ctx, t) + + if broker.IsReady() { + if !broker.Status.DeliveryStatus.IsSet() { + t.Errorf("broker DLS not resolved but resource reported ready") + } + // Success! + } else { + t.Errorf("broker was not ready") + } +} + +func brokerClassIsImmutable(ctx context.Context, t feature.T) { + broker := getBroker(ctx, t) + + if broker.Annotations == nil { + broker.Annotations = map[string]string{} + } + // update annotations + broker.Annotations[eventingv1.BrokerClassAnnotationKey] = "Rekt.brokerClassIsImmutable" + + if _, err := Client(ctx).Brokers.Update(ctx, broker, metav1.UpdateOptions{}); err != nil { + // Success! + t.Log("broker class is immutable") + } else { + t.Errorf("broker class is mutable") + } +} + +func brokerConfigIsImmutable(ctx context.Context, t feature.T) { + broker := getBroker(ctx, t) + + brokerCopyName := feature.MakeRandomK8sName("broker-copy") + brokerCopy, err := copyBroker(ctx, broker, brokerCopyName) + if err != nil { + t.Errorf("could not create broker copy to test immutability: %v", err) + } + + brokerCopy.Spec = eventingv1.BrokerSpec{ + Config: &duckv1.KReference{ + Kind: "kind", + Namespace: "namespace", + Name: "name", + APIVersion: "apiversion", + }, + } + + if _, err := Client(ctx).Brokers.Update(ctx, brokerCopy, metav1.UpdateOptions{}); err == nil { + t.Errorf("broker.spec.config is mutable") + } +} + +func triggerHasReadyInConditions(ctx context.Context, t feature.T) { + name := state.GetStringOrFail(ctx, t, triggerfeatures.TriggerNameKey) + knconf.KResourceHasReadyInConditions(triggerresources.GVR(), name)(ctx, t) +} + +func readyTriggerCanDeliver(ctx context.Context, t feature.T) { + trigger := triggerfeatures.GetTrigger(ctx, t) + _ = trigger + // TODO: I am not sure how to test this from the outside. +} + +func readyTriggerHasSubscriberURI(ctx context.Context, t feature.T) { + trigger := triggerfeatures.GetTrigger(ctx, t) + if trigger.Status.IsReady() { + if trigger.Status.SubscriberURI == nil { + t.Errorf("trigger did not have subscriber uri in status") + } + // Success! + } else { + j, _ := json.Marshal(trigger) + t.Errorf("trigger was not ready, \n%s", string(j)) + } +} + +func triggerHasOneBroker(ctx context.Context, t feature.T) { + trigger := triggerfeatures.GetTrigger(ctx, t) + if trigger.Spec.Broker == "" { + t.Error("broker is empty") + } + if strings.Contains(trigger.Spec.Broker, ",") { + t.Errorf("more than one broker specified: %q", trigger.Spec.Broker) + } +} + +func triggerSpecBrokerIsImmutable(ctx context.Context, t feature.T) { + trigger := triggerfeatures.GetTrigger(ctx, t) + + // Update spec.broker + trigger.Spec.Broker = "Rekt.BrokerImmutable" + + if _, err := Client(ctx).Triggers.Update(ctx, trigger, metav1.UpdateOptions{}); err != nil { + // Success! + t.Log("Trigger spec.broker is immutable") + } else { + t.Errorf("Trigger spec.broker is mutable") + } +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/broker/crossnamespace.go b/vendor/knative.dev/eventing/test/rekt/features/broker/crossnamespace.go new file mode 100644 index 0000000000..738b93b3ae --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/broker/crossnamespace.go @@ -0,0 +1,41 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package broker + +import ( + "fmt" + + "knative.dev/eventing/test/rekt/features/featureflags" + "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/manifest" +) + +func GoesReadyInDifferentNamespace(name, namespace string, cfg ...manifest.CfgFn) *feature.Feature { + f := new(feature.Feature) + f.Prerequisite("Cross Namespace Event Links is enabled", featureflags.CrossEventLinksEnabled()) + + // Add the namespace configuration + namespaceCfg := broker.WithConfigNamespace(namespace) + cfg = append(cfg, namespaceCfg) + + f.Setup(fmt.Sprintf("install broker %q in namespace %q", name, namespace), broker.Install(name, cfg...)) + f.Setup("Broker is ready", broker.IsReady(name)) + f.Setup("Broker is addressable", broker.IsAddressable(name)) + + return f +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/broker/data_plane.go b/vendor/knative.dev/eventing/test/rekt/features/broker/data_plane.go new file mode 100644 index 0000000000..3c3a46dc88 --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/broker/data_plane.go @@ -0,0 +1,409 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package broker + +import ( + "context" + + "github.com/google/uuid" + "knative.dev/eventing/test/rekt/features/knconf" + "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/pkg/apis" + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/state" +) + +func DataPlaneConformance(brokerName string) *feature.FeatureSet { + fs := &feature.FeatureSet{ + Name: "Knative Broker Specification - Data Plane", + Features: []*feature.Feature{ + DataPlaneIngress(brokerName), + DataPlaneObservability(brokerName), + DataPlaneAddressability(brokerName), + }, + } + + addDataPlaneDelivery(brokerName, fs) + + return fs +} + +func DataPlaneIngress(brokerName string) *feature.Feature { + f := feature.NewFeatureNamed("Ingress") + + f.Setup("Set Broker Name", func(ctx context.Context, t feature.T) { + state.SetOrFail(ctx, t, "brokerName", brokerName) + }) + + f.Stable("Conformance"). + Must("The ingress endpoint(s) MUST conform to at least one of the following versions of the specification: 0.3, 1.0", + brokerAcceptsCEVersions). + May("Other versions MAY be rejected.", + brokerRejectsUnknownCEVersion). + ShouldNot("The Broker SHOULD NOT perform an upgrade of the produced event's CloudEvents version.", + brokerEventVersionNotUpgraded). + Should("It SHOULD support Binary Content Mode of the HTTP Protocol Binding for CloudEvents.", + brokerAcceptsBinaryContentMode). + Should("It SHOULD support Structured Content Mode of the HTTP Protocol Binding for CloudEvents.", + brokerAcceptsStructuredContentMode). + Must("Brokers MUST reject all HTTP produce requests with a method other than POST responding with HTTP status code `405 Method Not Supported`.", + brokerRejectsGetRequest). + Must("The Broker MUST respond with a 200-level HTTP status code if a produce request is accepted.", + brokerAcceptResponseSuccess). + Must("If a Broker receives a produce request and is unable to parse a valid CloudEvent, then it MUST reject the request with HTTP status code `400 Bad Request`.", + brokerRejectsMalformedCE) + return f +} + +func DataPlaneAddressability(brokerName string) *feature.Feature { + f := feature.NewFeatureNamed("Broker Addressability") + + f.Setup("Set Broker Name", func(ctx context.Context, t feature.T) { + state.SetOrFail(ctx, t, "brokerName", brokerName) + }) + + f.Requirement("Broker is Ready", broker.IsAddressable(brokerName)) + + f.Stable("Conformance").Should("A Broker SHOULD expose either an HTTP or HTTPS endpoint as ingress. It MAY expose both.", + func(ctx context.Context, t feature.T) { + b := getBroker(ctx, t) + addr := b.Status.AddressStatus.Address.URL + if addr == nil { + addr = new(apis.URL) + } + if addr.Scheme != "http" && addr.Scheme != "https" { + t.Fatalf("expected broker scheme to be HTTP or HTTPS, found: %s", addr.Scheme) + } + }). + May("The HTTP(S) endpoint MAY be on any port, not just the standard 80 and 443.", + icebox). + May("Channels MAY expose other, non-HTTP endpoints in addition to HTTP at their discretion.", + icebox) + return f +} + +func addDataPlaneDelivery(brokerName string, fs *feature.FeatureSet) { + f := feature.NewFeatureNamed("Delivery") + + f.Setup("Set Broker Name", func(ctx context.Context, t feature.T) { + state.SetOrFail(ctx, t, "brokerName", brokerName) + }) + + f.Stable("Conformance"). + Must("Delivered events MUST conform to the CloudEvents specification.", + todo). + Should("All CloudEvent attributes set by the producer, including the data and specversion attributes, SHOULD be received at the subscriber identical to how they were received by the Broker.", + todo). + Should("The Broker SHOULD support delivering events via Binary Content Mode or Structured Content Mode of the HTTP Protocol Binding for CloudEvents.", + todo). + Should("Events accepted by the Broker SHOULD be delivered at least once to all subscribers of all Triggers*.", + todo). + //* + //1. are Ready when the produce request was received, + //1. specify filters that match the event, and + //1. exist when the event is able to be delivered. + May("Events MAY additionally be delivered to Triggers that become Ready after the event was accepted.", + todo). + May("Events MAY be enqueued or delayed between acceptance from a producer and delivery to a subscriber.", + todo). + May("The Broker MAY choose not to deliver an event due to persistent unavailability of a subscriber or limitations such as storage capacity.", + icebox). + Should("The Broker SHOULD attempt to notify the operator in this case.", + icebox). + May("The Broker MAY forward these events to an alternate endpoint or storage mechanism such as a dead letter queue.", + icebox). + May("If no ready Trigger would match an accepted event, the Broker MAY drop that event without notifying the producer.", + todo). + May("If multiple Triggers reference the same subscriber, the subscriber MAY be expected to acknowledge successful delivery of an event multiple times.", + todo). + Should("Events contained in delivery responses SHOULD be published to the Broker ingress and processed as if the event had been produced to the Broker's addressable endpoint.", + todo). + Should("Events contained in delivery responses that are malformed SHOULD be treated as if the event delivery had failed.", + todo). + May("The subscriber MAY receive a confirmation that a reply event was accepted by the Broker.", + todo). + Should("If the reply event was not accepted, the initial event SHOULD be redelivered to the subscriber.", + todo) + + fs.Features = append(fs.Features, f) + +} + +func DataPlaneObservability(brokerName string) *feature.Feature { + f := feature.NewFeatureNamed("Observability") + + f.Setup("Set Broker Name", func(ctx context.Context, t feature.T) { + state.SetOrFail(ctx, t, "brokerName", brokerName) + }) + + f.Stable("Conformance"). + Should("The Broker SHOULD expose a variety of metrics*.", + todo). + // * including, but not limited to: + //- Number of malformed produce requests (400-level responses) + //- Number of accepted produce requests (200-level responses) + //- Number of events delivered + + Should("Metrics SHOULD be enabled by default, with a configuration parameter included to disable them if desired.", + todo). + Should("Upon receiving an event with context attributes defined in the CloudEvents Distributed Tracing extension the Broker SHOULD preserve that trace header on delivery to subscribers and on reply events, unless the reply is sent with a different set of tracing attributes.", + todo). + Should("Forwarded trace headers SHOULD be updated with any intermediate spans emitted by the broker.", + todo). + Should("Spans emitted by the Broker SHOULD follow the OpenTelemetry Semantic Conventions for Messaging System*.", + todo) + // * + //- messaging.system: "knative" + //- messaging.destination: broker:name.namespace or trigger:name.namespace with + //the Broker or Trigger to which the event is being routed + //- messaging.protocol: the name of the underlying transport protocol + //- messaging.message_id: the event ID + + return f +} + +func todo(_ context.Context, t feature.T) { + t.Log("TODO, Implement this.") +} + +func icebox(_ context.Context, t feature.T) { + t.Skip("[IceBox], It is not clear how to make a conformance test for this spec assertion.") +} + +func brokerAcceptsCEVersions(ctx context.Context, t feature.T) { + name := state.GetStringOrFail(ctx, t, "brokerName") + knconf.AcceptsCEVersions(ctx, t, broker.GVR(), name) +} + +func brokerAcceptsBinaryContentMode(ctx context.Context, t feature.T) { + brokerName := state.GetStringOrFail(ctx, t, "brokerName") + + contenttypes := []string{ + "application/vnd.apache.thrift.binary", + "application/xml", + "application/json", + } + for _, contenttype := range contenttypes { + source := feature.MakeRandomK8sName("source") + eventshub.Install(source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputHeader("ce-specversion", "1.0"), + eventshub.InputHeader("ce-type", "sometype"), + eventshub.InputHeader("ce-source", "200.request.sender.test.knative.dev"), + eventshub.InputHeader("ce-id", uuid.New().String()), + eventshub.InputHeader("content-type", contenttype), + eventshub.InputBody("{}"), + eventshub.InputMethod("POST"), + )(ctx, t) + + store := eventshub.StoreFromContext(ctx, source) + events := knconf.Correlate(store.AssertAtLeast(ctx, t, 2, knconf.SentEventMatcher(""))) + for _, e := range events { + if e.Response.StatusCode < 200 || e.Response.StatusCode > 299 { + t.Errorf("Expected statuscode 2XX for sequence %d got %d", e.Response.Sequence, e.Response.StatusCode) + } + } + } +} + +func brokerAcceptsStructuredContentMode(ctx context.Context, t feature.T) { + brokerName := state.GetStringOrFail(ctx, t, "brokerName") + + contenttype := "application/cloudevents+json" + bodycontent := `{ + "specversion" : "1.0", + "type" : "sometype", + "source" : "json.request.sender.test.knative.dev", + "id" : "2222-4444-6666", + "time" : "2020-07-06T09:23:12Z", + "datacontenttype" : "application/json", + "data" : { + "message" : "helloworld" + } +}` + source := feature.MakeRandomK8sName("source") + eventshub.Install(source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputHeader("content-type", contenttype), + eventshub.InputBody(bodycontent), + eventshub.InputMethod("POST"), + )(ctx, t) + + store := eventshub.StoreFromContext(ctx, source) + events := knconf.Correlate(store.AssertAtLeast(ctx, t, 2, knconf.SentEventMatcher(""))) + for _, e := range events { + if e.Response.StatusCode < 200 || e.Response.StatusCode > 299 { + t.Errorf("Expected statuscode 2XX for sequence %d got %d", e.Response.Sequence, e.Response.StatusCode) + } + } +} + +func brokerRejectsUnknownCEVersion(ctx context.Context, t feature.T) { + brokerName := state.GetStringOrFail(ctx, t, "brokerName") + + uuids := map[string]string{ + uuid.New().String(): "19.0", + } + for id, version := range uuids { + // We need to use a different source name, otherwise, it will try to update + // the pod, which is immutable. + source := feature.MakeRandomK8sName("source") + eventshub.Install(source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputHeader("ce-specversion", version), + eventshub.InputHeader("ce-type", "sometype"), + eventshub.InputHeader("ce-source", "400.request.sender.test.knative.dev"), + eventshub.InputHeader("ce-id", id), + eventshub.InputBody("{}"), + )(ctx, t) + + store := eventshub.StoreFromContext(ctx, source) + // We are looking for two events, one of them is the sent event and the other + // is Response, so correlate them first. We want to make sure the event was sent and that the + // response was what was expected. + // Note: We pass in "" for the match ID because when we construct the headers manually + // above, they do not get stuff into the sent/response SentId fields. + events := knconf.Correlate(store.AssertAtLeast(ctx, t, 2, knconf.SentEventMatcher(""))) + for _, e := range events { + // Make sure HTTP response code is 4XX + if e.Response.StatusCode < 400 || e.Response.StatusCode > 499 { + t.Errorf("Expected statuscode 4XX for sequence %d got %d", e.Response.Sequence, e.Response.StatusCode) + } + } + } +} + +func brokerAcceptResponseSuccess(ctx context.Context, t feature.T) { + brokerName := state.GetStringOrFail(ctx, t, "brokerName") + + uuids := map[string]string{ + uuid.New().String(): "1.0", + } + for id, version := range uuids { + source := feature.MakeRandomK8sName("source") + eventshub.Install(source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputHeader("ce-specversion", version), + eventshub.InputHeader("ce-type", "sometype"), + eventshub.InputHeader("ce-source", "200.request.sender.test.knative.dev"), + eventshub.InputHeader("ce-id", id), + eventshub.InputBody("{}"), + eventshub.InputMethod("POST"), + )(ctx, t) + + store := eventshub.StoreFromContext(ctx, source) + events := knconf.Correlate(store.AssertAtLeast(ctx, t, 2, knconf.SentEventMatcher(""))) + for _, e := range events { + // Make sure HTTP response code is 200 + if e.Response.StatusCode < 200 || e.Response.StatusCode > 299 { + t.Errorf("Expected statuscode 200 for sequence %d got %d", e.Response.Sequence, e.Response.StatusCode) + } + } + } +} + +func brokerRejectsGetRequest(ctx context.Context, t feature.T) { + brokerName := state.GetStringOrFail(ctx, t, "brokerName") + + uuids := map[string]string{ + uuid.New().String(): "1.0", + } + for id, version := range uuids { + // We need to use a different source name, otherwise, it will try to update + // the pod, which is immutable. + source := feature.MakeRandomK8sName("source") + eventshub.Install(source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputHeader("ce-specversion", version), + eventshub.InputHeader("ce-type", "sometype"), + eventshub.InputHeader("ce-source", "400.request.sender.test.knative.dev"), + eventshub.InputHeader("ce-id", id), + eventshub.InputBody("{}"), + eventshub.InputMethod("GET"), + )(ctx, t) + + store := eventshub.StoreFromContext(ctx, source) + // We are looking for two events, one of them is the sent event and the other + // is Response, so correlate them first. We want to make sure the event was sent and that the + // response was what was expected. + // Note: We pass in "" for the match ID because when we construct the headers manually + // above, they do not get stuff into the sent/response SentId fields. + events := knconf.Correlate(store.AssertAtLeast(ctx, t, 2, knconf.SentEventMatcher(""))) + for _, e := range events { + // Make sure HTTP response code is 405 + if e.Response.StatusCode != 405 { + t.Errorf("Expected statuscode 405 for sequence %d got %d", e.Response.Sequence, e.Response.StatusCode) + } + } + } +} + +func brokerRejectsMalformedCE(ctx context.Context, t feature.T) { + brokerName := state.GetStringOrFail(ctx, t, "brokerName") + headers := map[string]string{ + "ce-specversion": "1.0", + "ce-type": "sometype", + "ce-source": "conformancetest.request.sender.test.knative.dev", + "ce-id": uuid.New().String(), + } + + for k := range headers { + // Add all but the one key we want to omit. + // https://github.com/knative/eventing/issues/5143 + if k == "ce-type" || k == "ce-source" || k == "ce-id" { + t.Logf("SKIPPING missing header %q due to known bug: https://github.com/knative/eventing/issues/5143", k) + continue + } + + var options []eventshub.EventsHubOption + for k2, v2 := range headers { + if k != k2 { + options = append(options, eventshub.InputHeader(k2, v2)) + t.Logf("Adding Header Value: %q => %q", k2, v2) + } + } + options = append(options, eventshub.StartSenderToResource(broker.GVR(), brokerName)) + options = append(options, eventshub.InputBody("{}")) + // We need to use a different source name, otherwise, it will try to update + // the pod, which is immutable. + source := feature.MakeRandomK8sName("source") + eventshub.Install(source, options...)(ctx, t) + + store := eventshub.StoreFromContext(ctx, source) + // We are looking for two events, one of them is the sent event and the other + // is Response, so correlate them first. We want to make sure the event was sent and that the + // response was what was expected. + // Note: We pass in "" for the match ID because when we construct the headers manually + // above, they do not get stuff into the sent/response SentId fields. + events := knconf.Correlate(store.AssertAtLeast(ctx, t, 2, knconf.SentEventMatcher(""))) + for _, e := range events { + // Make sure HTTP response code is 4XX + if e.Response.StatusCode < 400 || e.Response.StatusCode > 499 { + t.Errorf("Expected statuscode 4XX with missing required field %q for sequence %d got %d", k, e.Response.Sequence, e.Response.StatusCode) + t.Logf("Sent event was: %s\nresponse: %s\n", e.Sent.String(), e.Response.String()) + } + } + } +} + +// source ---> [broker] ---[trigger]--> recorder +func brokerEventVersionNotUpgraded(ctx context.Context, t feature.T) { + // brokerName := state.GetStringOrFail(ctx, t, "brokerName") + + // Create a trigger, +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/broker/delivery.go b/vendor/knative.dev/eventing/test/rekt/features/broker/delivery.go new file mode 100644 index 0000000000..cc7996c22d --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/broker/delivery.go @@ -0,0 +1,43 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package broker + +import ( + "knative.dev/reconciler-test/pkg/feature" + + "knative.dev/eventing/test/rekt/resources/broker" +) + +func DefaultDeliverySpec() *feature.Feature { + f := feature.NewFeatureNamed("default delivery spec") + + brokerName := feature.MakeRandomK8sName("broker") + + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + + f.Requirement("broker is ready", broker.IsReady(brokerName)) + f.Requirement("broker is addressable", broker.IsAddressable(brokerName)) + + f.Assert("broker has delivery spec set", broker.WaitForCondition(brokerName, + broker.HasDelivery(). + And(broker.HasDeliveryRetry()). + And(broker.HasDeliveryBackoffDelay()). + And(broker.HasDeliveryBackoffPolicy()), + )) + + return f +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/broker/eventing_tls_feature.go b/vendor/knative.dev/eventing/test/rekt/features/broker/eventing_tls_feature.go new file mode 100644 index 0000000000..15d8894be5 --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/broker/eventing_tls_feature.go @@ -0,0 +1,105 @@ +/* +Copyright 2023 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package broker + +import ( + "context" + "time" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/google/uuid" + "k8s.io/apimachinery/pkg/types" + "knative.dev/pkg/system" + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/eventshub/assert" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/resources/service" + "knative.dev/reconciler-test/resources/certificate" + + "knative.dev/eventing/test/rekt/features/featureflags" + "knative.dev/eventing/test/rekt/resources/addressable" + "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/eventing/test/rekt/resources/trigger" +) + +func RotateMTChannelBrokerTLSCertificates() *feature.Feature { + ingressCertificateName := "mt-broker-ingress-server-tls" + ingressSecretName := "mt-broker-ingress-server-tls" + + filterCertificateName := "mt-broker-filter-server-tls" + + brokerName := feature.MakeRandomK8sName("broker") + triggerName := feature.MakeRandomK8sName("trigger") + sink := feature.MakeRandomK8sName("sink") + source := feature.MakeRandomK8sName("source") + + f := feature.NewFeatureNamed("Rotate MTChannelBroker TLS certificate") + + f.Prerequisite("transport encryption is strict", featureflags.TransportEncryptionStrict()) + f.Prerequisite("should not run when Istio is enabled", featureflags.IstioDisabled()) + + f.Setup("Rotate ingress certificate", certificate.Rotate(certificate.RotateCertificate{ + Certificate: types.NamespacedName{ + Namespace: system.Namespace(), + Name: ingressCertificateName, + }, + })) + // We cannot externally verify this certificate rotation + f.Setup("Rotate filter certificate", certificate.Rotate(certificate.RotateCertificate{ + Certificate: types.NamespacedName{ + Namespace: system.Namespace(), + Name: filterCertificateName, + }, + })) + + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiverTLS)) + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Setup("Broker is ready", broker.IsReady(brokerName)) + f.Setup("install trigger", func(ctx context.Context, t feature.T) { + d := service.AsDestinationRef(sink) + d.CACerts = eventshub.GetCaCerts(ctx) + trigger.Install(triggerName, trigger.WithBrokerName(brokerName), trigger.WithSubscriberFromDestination(d))(ctx, t) + }) + f.Setup("trigger is ready", trigger.IsReady(triggerName)) + f.Setup("Broker has HTTPS address", broker.ValidateAddress(brokerName, addressable.AssertHTTPSAddress)) + + event := cetest.FullEvent() + event.SetID(uuid.New().String()) + + f.Requirement("install source", eventshub.Install(source, + eventshub.StartSenderToResourceTLS(broker.GVR(), brokerName, nil), + eventshub.InputEvent(event), + // Send multiple events so that we take into account that the certificate rotation might + // be detected by the server after some time. + eventshub.SendMultipleEvents(100, 3*time.Second), + )) + + f.Assert("Event sent", assert.OnStore(source). + MatchSentEvent(cetest.HasId(event.ID())). + AtLeast(1), + ) + f.Assert("Event received", assert.OnStore(sink). + MatchReceivedEvent(cetest.HasId(event.ID())). + AtLeast(1), + ) + f.Assert("Source match updated peer certificate", assert.OnStore(source). + MatchPeerCertificatesReceived(assert.MatchPeerCertificatesFromSecret(system.Namespace(), ingressSecretName, "tls.crt")). + AtLeast(1), + ) + + return f +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/broker/feature.go b/vendor/knative.dev/eventing/test/rekt/features/broker/feature.go new file mode 100644 index 0000000000..3704da705b --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/broker/feature.go @@ -0,0 +1,1084 @@ +/* +Copyright 2022 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package broker + +import ( + "context" + "encoding/base64" + "fmt" + "strings" + + cloudevents "github.com/cloudevents/sdk-go/v2" + "github.com/cloudevents/sdk-go/v2/binding/spec" + "github.com/cloudevents/sdk-go/v2/test" + "github.com/google/uuid" + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/state" + + duckv1 "knative.dev/eventing/pkg/apis/duck/v1" + eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" + "knative.dev/eventing/test/rekt/features" + "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/eventing/test/rekt/resources/channel" + "knative.dev/eventing/test/rekt/resources/subscription" + "knative.dev/eventing/test/rekt/resources/trigger" + + v1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/network" + "knative.dev/pkg/ptr" + + "knative.dev/reconciler-test/pkg/eventshub" + eventasssert "knative.dev/reconciler-test/pkg/eventshub/assert" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/manifest" + "knative.dev/reconciler-test/pkg/resources/service" +) + +func ManyTriggers() *feature.FeatureSet { + fs := &feature.FeatureSet{Name: "Broker with many triggers"} + + // Construct different type, source and extensions of events + any := eventingv1.TriggerAnyFilter + eventType1 := "type1" + eventType2 := "type2" + eventSource1 := "http://source1.com" + eventSource2 := "http://source2.com" + // Be careful with the length of extension name and values, + // we use extension name and value as a part of the name of resources like subscriber and trigger, + // the maximum characters allowed of resource name is 63 + extensionName1 := "extname1" + extensionValue1 := "extval1" + extensionName2 := "extname2" + extensionValue2 := "extvalue2" + nonMatchingExtensionName := "nonmatchingextname" + nonMatchingExtensionValue := "nonmatchingextval" + + eventFilters1 := make(map[string]eventTestCase) + eventFilters1["dumper-1"] = newEventTestCase(any, any) + eventFilters1["dumper-12"] = newEventTestCase(eventType1, any) + eventFilters1["dumper-123"] = newEventTestCase(any, eventSource1) + eventFilters1["dumper-1234"] = newEventTestCase(eventType1, eventSource1) + + eventFilters2 := make(map[string]eventTestCase) + eventFilters2["dumper-12345"] = newEventTestCaseWithExtensions(any, any, map[string]interface{}{extensionName1: extensionValue1}) + eventFilters2["dumper-123456"] = newEventTestCaseWithExtensions(any, any, map[string]interface{}{extensionName1: extensionValue1, extensionName2: extensionValue2}) + eventFilters2["dumper-1234567"] = newEventTestCaseWithExtensions(any, any, map[string]interface{}{extensionName2: extensionValue2}) + eventFilters2["dumper-654321"] = newEventTestCaseWithExtensions(eventType1, any, map[string]interface{}{extensionName1: extensionValue1}) + eventFilters2["dumper-54321"] = newEventTestCaseWithExtensions(any, any, map[string]interface{}{extensionName1: any}) + eventFilters2["dumper-4321"] = newEventTestCaseWithExtensions(any, eventSource1, map[string]interface{}{extensionName1: extensionValue1}) + eventFilters2["dumper-321"] = newEventTestCaseWithExtensions(any, eventSource1, map[string]interface{}{extensionName1: extensionValue1, extensionName2: extensionValue2}) + eventFilters2["dumper-21"] = newEventTestCaseWithExtensions(any, eventSource2, map[string]interface{}{extensionName1: extensionValue1, extensionName2: extensionValue1}) + + tests := []struct { + name string + // These are the event context attributes and extension attributes that will be send. + eventsToSend []eventTestCase + // These are the event context attributes and extension attributes that triggers will listen to + // This map is to configure sink and corresponding filter to construct trigger + eventFilters map[string]eventTestCase + }{ + { + name: "test default broker with many attribute triggers", + eventsToSend: []eventTestCase{ + {Type: eventType1, Source: eventSource1}, + {Type: eventType1, Source: eventSource2}, + {Type: eventType2, Source: eventSource1}, + {Type: eventType2, Source: eventSource2}, + }, + eventFilters: eventFilters1, + }, + { + name: "test default broker with many attribute and extension triggers", + eventsToSend: []eventTestCase{ + {Type: eventType1, Source: eventSource1, Extensions: map[string]interface{}{extensionName1: extensionValue1}}, + {Type: eventType1, Source: eventSource1, Extensions: map[string]interface{}{extensionName1: extensionValue1, extensionName2: extensionValue2}}, + {Type: eventType1, Source: eventSource1, Extensions: map[string]interface{}{extensionName2: extensionValue2}}, + {Type: eventType1, Source: eventSource2, Extensions: map[string]interface{}{extensionName1: extensionValue1}}, + {Type: eventType2, Source: eventSource1, Extensions: map[string]interface{}{extensionName1: nonMatchingExtensionValue}}, + {Type: eventType2, Source: eventSource2, Extensions: map[string]interface{}{nonMatchingExtensionName: extensionValue1}}, + {Type: eventType2, Source: eventSource2, Extensions: map[string]interface{}{extensionName1: extensionValue1, extensionName2: extensionValue2}}, + {Type: eventType2, Source: eventSource2, Extensions: map[string]interface{}{extensionName1: extensionValue1, nonMatchingExtensionName: extensionValue2}}, + }, + eventFilters: eventFilters2, + }, + } + + for _, testcase := range tests { + + testcase := testcase // capture variable + f := feature.NewFeatureNamed(testcase.name) + + // Create the broker + brokerName := feature.MakeRandomK8sName("broker") + + f.Setup("install broker, sinks and triggers", func(ctx context.Context, t feature.T) { + broker.Install(brokerName, broker.WithEnvConfig()...)(ctx, t) + + for sink, eventFilter := range testcase.eventFilters { + eventshub.Install(sink, eventshub.StartReceiver)(ctx, t) + + filter := eventingv1.TriggerFilterAttributes{ + "type": eventFilter.Type, + "source": eventFilter.Source, + } + + // Point the Trigger subscriber to the sink svc. + cfg := []manifest.CfgFn{ + trigger.WithSubscriber(service.AsKReference(sink), ""), + trigger.WithFilter(filter), + trigger.WithExtensions(eventFilter.Extensions), + trigger.WithBrokerName(brokerName), + } + + trigger.Install(sink, cfg...)(ctx, t) + } + + broker.IsReady(brokerName)(ctx, t) + broker.IsAddressable(brokerName)(ctx, t) + + for sink := range testcase.eventFilters { + trigger.IsReady(sink)(ctx, t) + } + }) + + for _, event := range testcase.eventsToSend { + eventToSend := cloudevents.NewEvent() + eventToSend.SetID(event.toID()) + eventToSend.SetType(event.Type) + eventToSend.SetSource(event.Source) + for k, v := range event.Extensions { + eventToSend.SetExtension(k, v) + } + data := fmt.Sprintf(`{"msg":"%s"}`, eventToSend.ID()) + eventToSend.SetData(cloudevents.ApplicationJSON, []byte(data)) + + source := feature.MakeRandomK8sName("source") + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(eventToSend), + )) + + f.Assert("source sent event", eventasssert.OnStore(source). + MatchSentEvent(test.HasId(eventToSend.ID())). + AtLeast(1), + ) + + for sink, eventFilter := range testcase.eventFilters { + sink := sink // capture variable + matcher := event.toEventMatcher() // capture variable + + // Check on every dumper whether we should expect this event or not + if eventFilter.toEventMatcher()(eventToSend) == nil { + f.Assert(fmt.Sprintf("%s receive event %s", sink, eventToSend.ID()), func(ctx context.Context, t feature.T) { + eventasssert.OnStore(sink). + Match(features.HasKnNamespaceHeader(environment.FromContext(ctx).Namespace())). + MatchReceivedEvent(test.HasId(eventToSend.ID())). + MatchReceivedEvent(matcher). + AtLeast(1)(ctx, t) + }) + } + } + } + + fs.Features = append(fs.Features, f) + } + + return fs +} + +func BrokerWorkFlowWithTransformation() *feature.FeatureSet { + createSubscriberFn := func(ref *v1.KReference, uri string) manifest.CfgFn { + return subscription.WithSubscriber(ref, uri, "") + } + fs := &feature.FeatureSet{ + Name: "Knative Broker - Transformation - Channel flow and Trigger event flow", + + Features: []*feature.Feature{ + brokerChannelFlowWithTransformation(createSubscriberFn), + brokerEventTransformationForTrigger(), + }, + } + return fs +} + +/* +BrokerChannelFlowWithTransformation tests the following topology: + ------------- ---------------------- + | | | | + v | v | +EventSource ---> Broker ---> Trigger1 -------> Sink1(Transformation) + | + | + |-------> Trigger2 -------> Sink2(Logger1) + | + | + |-------> Trigger3 -------> Channel --------> Subscription --------> Sink3(Logger2) +Explanation: +Trigger1 filters the orignal event and transforms it to a new event, +Trigger2 logs all events, +Trigger3 filters the transformed event and sends it to Channel. +*/ + +func brokerChannelFlowWithTransformation(createSubscriberFn func(ref *v1.KReference, uri string) manifest.CfgFn) *feature.Feature { + f := feature.NewFeatureNamed("Broker topology of transformation") + + source := feature.MakeRandomK8sName("source") + + sink1 := feature.MakeRandomK8sName("sink1") + sink2 := feature.MakeRandomK8sName("sink2") + sink3 := feature.MakeRandomK8sName("sink3") + + trigger1 := feature.MakeRandomK8sName("trigger1") + trigger2 := feature.MakeRandomK8sName("trigger2") + trigger3 := feature.MakeRandomK8sName("trigger3") + + // Construct original cloudevent message + eventType := "type1" + eventSource := "http://source1.com" + eventBody := `{"msg":"e2e-brokerchannel-body"}` + // Construct cloudevent message after transformation + transformedEventType := "type2" + transformedEventSource := "http://source2.com" + transformedBody := `{"msg":"transformed body"}` + // Construct eventToSend + eventToSend := cloudevents.NewEvent() + eventToSend.SetID(uuid.New().String()) + eventToSend.SetType(eventType) + eventToSend.SetSource(eventSource) + eventToSend.SetData(cloudevents.ApplicationJSON, []byte(eventBody)) + + //Install the broker + brokerName := feature.MakeRandomK8sName("broker") + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Setup("broker is ready", broker.IsReady(brokerName)) + f.Setup("broker is addressable", broker.IsAddressable(brokerName)) + + f.Setup("install sink1", eventshub.Install(sink1, + eventshub.ReplyWithTransformedEvent(transformedEventType, transformedEventSource, transformedBody), + eventshub.StartReceiver), + ) + f.Setup("install sink2", eventshub.Install(sink2, eventshub.StartReceiver)) + f.Setup("install sink3", eventshub.Install(sink3, eventshub.StartReceiver)) + + // filter1 filters the original events + filter1 := eventingv1.TriggerFilterAttributes{ + "type": eventType, + "source": eventSource, + } + // filter2 filters all events + filter2 := eventingv1.TriggerFilterAttributes{ + "type": eventingv1.TriggerAnyFilter, + } + // filter3 filters events after transformation + filter3 := eventingv1.TriggerFilterAttributes{ + "type": transformedEventType, + "source": transformedEventSource, + } + + // Install the trigger1 point to Broker and transform the original events to new events + f.Setup("install trigger1", trigger.Install( + trigger1, + trigger.WithBrokerName(brokerName), + trigger.WithFilter(filter1), + trigger.WithSubscriber(service.AsKReference(sink1), ""), + )) + f.Setup("trigger1 goes ready", trigger.IsReady(trigger1)) + // Install the trigger2 point to Broker to filter all the events + f.Setup("install trigger2", trigger.Install( + trigger2, + trigger.WithBrokerName(brokerName), + trigger.WithFilter(filter2), + trigger.WithSubscriber(service.AsKReference(sink2), ""), + )) + f.Setup("trigger2 goes ready", trigger.IsReady(trigger2)) + + // Install the channel and corresponding subscription point to sink3 + channelName := feature.MakeRandomK8sName("channel") + f.Setup("install channel", channel.Install(channelName, + channel.WithTemplate(), + )) + sub := feature.MakeRandomK8sName("subscription") + f.Setup("install subscription", subscription.Install(sub, + subscription.WithChannel(channel.AsRef(channelName)), + createSubscriberFn(service.AsKReference(sink3), ""), + )) + f.Setup("subscription is ready", subscription.IsReady(sub)) + f.Setup("channel is ready", channel.IsReady(channelName)) + + // Install the trigger3 point to Broker to filter the events after transformation point to channel + f.Setup("install trigger3", trigger.Install( + trigger3, + trigger.WithBrokerName(brokerName), + trigger.WithFilter(filter3), + trigger.WithSubscriber(channel.AsRef(channelName), ""), + )) + f.Setup("trigger3 goes ready", trigger.IsReady(trigger3)) + + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(eventToSend), + )) + + eventMatcher := eventasssert.MatchEvent( + test.HasSource(eventSource), + test.HasType(eventType), + test.HasData([]byte(eventBody)), + ) + transformEventMatcher := eventasssert.MatchEvent( + test.HasSource(transformedEventSource), + test.HasType(transformedEventType), + test.HasData([]byte(transformedBody)), + ) + + f.Stable("(Trigger1 point to) sink1 has all the events"). + Must("delivers original events", + eventasssert.OnStore(sink1).Match(eventMatcher).AtLeast(1)) + + f.Stable("(Trigger2 point to) sink2 has all the events"). + Must("delivers original events", + eventasssert.OnStore(sink2).Match(eventMatcher).AtLeast(1)). + Must("delivers transformation events", + eventasssert.OnStore(sink2).Match(transformEventMatcher).AtLeast(1)) + + f.Stable("(Trigger3 point to) Channel's subscriber just has events after transformation"). + Must("delivers transformation events", + eventasssert.OnStore(sink3).Match(transformEventMatcher).AtLeast(1)). + Must("delivers original events", + eventasssert.OnStore(sink3).Match(eventMatcher).Not()) + + return f +} + +/* +BrokerEventTransformationForTrigger tests the following scenario: + + 5 4 + ------------- ---------------------- + | | | | + 1 v 2 | v 3 | + +EventSource ---> Broker ---> Trigger1 -------> Sink1(Transformation) + + | + | 6 7 + |-------> Trigger2 -------> Sink2(Logger) + +Note: the number denotes the sequence of the event that flows in this test case. +*/ +func brokerEventTransformationForTrigger() *feature.Feature { + f := feature.NewFeatureNamed("Broker event transformation for trigger") + config := BrokerEventTransformationForTriggerSetup(f) + BrokerEventTransformationForTriggerAssert(f, config) + return f +} + +type brokerEventTransformationConfig struct { + Broker string + Sink1 string + Sink2 string + EventToSend cloudevents.Event + TransformedEvent cloudevents.Event +} + +func BrokerEventTransformationForTriggerSetup(f *feature.Feature) brokerEventTransformationConfig { + sink1 := feature.MakeRandomK8sName("sink1") + sink2 := feature.MakeRandomK8sName("sink2") + + trigger1 := feature.MakeRandomK8sName("trigger1") + trigger2 := feature.MakeRandomK8sName("trigger2") + + // Construct original cloudevent message + eventToSend := cloudevents.NewEvent() + eventToSend.SetType("type1") + eventToSend.SetSource("http://source1.com") + eventToSend.SetData(cloudevents.ApplicationJSON, []byte(`{"msg":"e2e-brokerchannel-body"}`)) + + // Construct cloudevent message after transformation + transformedEvent := cloudevents.NewEvent() + transformedEvent.SetType("type2") + transformedEvent.SetSource("http://source2.com") + transformedEvent.SetData(cloudevents.ApplicationJSON, []byte(`{"msg":"transformed body"}`)) + + //Install the broker + brokerName := feature.MakeRandomK8sName("broker") + f.Setup("Set context variables", func(ctx context.Context, t feature.T) { + state.SetOrFail(ctx, t, "brokerName", brokerName) + state.SetOrFail(ctx, t, "sink1", sink1) + state.SetOrFail(ctx, t, "sink2", sink2) + }) + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Setup("broker is ready", broker.IsReady(brokerName)) + f.Setup("broker is addressable", broker.IsAddressable(brokerName)) + + f.Setup("install sink1", eventshub.Install(sink1, + eventshub.ReplyWithTransformedEvent(transformedEvent.Type(), transformedEvent.Source(), string(transformedEvent.Data())), + eventshub.StartReceiver), + ) + f.Setup("install sink2", eventshub.Install(sink2, eventshub.StartReceiver)) + + // filter1 filters the original events + filter1 := eventingv1.TriggerFilterAttributes{ + "type": eventToSend.Type(), + "source": eventToSend.Source(), + } + // filter2 filters events after transformation + filter2 := eventingv1.TriggerFilterAttributes{ + "type": transformedEvent.Type(), + "source": transformedEvent.Source(), + } + + // Install the trigger1 point to Broker and transform the original events to new events + f.Setup("install trigger1", trigger.Install( + trigger1, + trigger.WithBrokerName(brokerName), + trigger.WithFilter(filter1), + trigger.WithSubscriber(service.AsKReference(sink1), ""), + )) + f.Setup("trigger1 goes ready", trigger.IsReady(trigger1)) + // Install the trigger2 point to Broker to filter all the events + f.Setup("install trigger2", trigger.Install( + trigger2, + trigger.WithBrokerName(brokerName), + trigger.WithFilter(filter2), + trigger.WithSubscriber(service.AsKReference(sink2), ""), + )) + f.Setup("trigger2 goes ready", trigger.IsReady(trigger2)) + + return brokerEventTransformationConfig{ + Broker: brokerName, + Sink1: sink1, + Sink2: sink2, + EventToSend: eventToSend, + TransformedEvent: transformedEvent, + } +} + +func BrokerEventTransformationForTriggerAssert(f *feature.Feature, + cfg brokerEventTransformationConfig) { + + source := feature.MakeRandomK8sName("source") + + // Set new ID every time we send event to allow calling this function repeatedly + cfg.EventToSend.SetID(uuid.New().String()) + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResource(broker.GVR(), cfg.Broker), + eventshub.InputEvent(cfg.EventToSend), + )) + + eventMatcher := eventasssert.MatchEvent( + test.HasId(cfg.EventToSend.ID()), + test.HasSource(cfg.EventToSend.Source()), + test.HasType(cfg.EventToSend.Type()), + test.HasData(cfg.EventToSend.Data()), + ) + transformEventMatcher := eventasssert.MatchEvent( + test.HasSource(cfg.TransformedEvent.Source()), + test.HasType(cfg.TransformedEvent.Type()), + test.HasData(cfg.TransformedEvent.Data()), + ) + + f.Stable("Trigger has filtered all transformed events"). + Must("trigger 1 delivers original events", + eventasssert.OnStore(cfg.Sink1).Match(eventMatcher).AtLeast(1)). + Must("trigger 1 does not deliver transformed events", + eventasssert.OnStore(cfg.Sink1).Match(transformEventMatcher).Not()). + Must("trigger 2 delivers transformed events", + eventasssert.OnStore(cfg.Sink2).Match(transformEventMatcher).AtLeast(1)). + Must("trigger 2 does not deliver original events", + eventasssert.OnStore(cfg.Sink2).Match(eventMatcher).Not()) +} + +func BrokerPreferHeaderCheck() *feature.Feature { + f := feature.NewFeatureNamed("Broker PreferHeader Check") + + source := feature.MakeRandomK8sName("source") + sink := feature.MakeRandomK8sName("sink") + via := feature.MakeRandomK8sName("via") + + eventSource := "source1" + eventType := "type1" + eventBody := `{"msg":"test msg"}` + event := cloudevents.NewEvent() + event.SetID(uuid.New().String()) + event.SetType(eventType) + event.SetSource(eventSource) + event.SetData(cloudevents.ApplicationJSON, []byte(eventBody)) + + //Install the broker + brokerName := feature.MakeRandomK8sName("broker") + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Requirement("broker is ready", broker.IsReady(brokerName)) + f.Requirement("broker is addressable", broker.IsAddressable(brokerName)) + + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver)) + + // Point the Trigger subscriber to the sink svc. + cfg := []manifest.CfgFn{trigger.WithSubscriber(service.AsKReference(sink), ""), trigger.WithBrokerName(brokerName)} + + // Install the trigger + f.Setup("install trigger", trigger.Install(via, cfg...)) + f.Setup("trigger goes ready", trigger.IsReady(via)) + + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(event), + )) + + f.Stable("test message without explicit prefer header should have the header"). + Must("delivers events", + eventasssert.OnStore(sink).Match( + eventasssert.HasAdditionalHeader("Prefer", "reply"), + ).AtLeast(1)) + + return f +} + +func BrokerRedelivery() *feature.FeatureSet { + fs := &feature.FeatureSet{ + Name: "Knative Broker - Redelivery - with different sequences", + Features: []*feature.Feature{ + brokerRedeliveryFibonacci(5), + brokerRedeliveryDropN(5, 5), + }, + } + + return fs +} + +func brokerRedeliveryFibonacci(retryNum int32) *feature.Feature { + f := feature.NewFeatureNamed("Broker reply with a bad status code following the fibonacci sequence") + + source := feature.MakeRandomK8sName("source") + sink := feature.MakeRandomK8sName("sink") + via := feature.MakeRandomK8sName("via") + + eventSource := "source1" + eventType := "type1" + eventBody := `{"msg":"fibonacci"}` + event := cloudevents.NewEvent() + event.SetID(uuid.New().String()) + event.SetType(eventType) + event.SetSource(eventSource) + event.SetData(cloudevents.ApplicationJSON, []byte(eventBody)) + + //Install the broker + brokerName := feature.MakeRandomK8sName("broker") + + exp := duckv1.BackoffPolicyLinear + brokerConfig := append(broker.WithEnvConfig(), broker.WithRetry(retryNum, &exp, ptr.String("PT1S"))) + f.Setup("install broker", broker.Install(brokerName, brokerConfig...)) + f.Requirement("broker is ready", broker.IsReady(brokerName)) + f.Requirement("broker is addressable", broker.IsAddressable(brokerName)) + + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver)) + + // Point the Trigger subscriber to the sink svc. + cfg := []manifest.CfgFn{trigger.WithSubscriber(service.AsKReference(sink), ""), trigger.WithBrokerName(brokerName)} + + // Install the trigger + f.Setup("install trigger", trigger.Install(via, cfg...)) + f.Setup("trigger goes ready", trigger.IsReady(via)) + + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(event), + eventshub.FibonacciDrop, + )) + + f.Stable("Broker Redelivery following the fibonacci sequence"). + Must("delivers events", + eventasssert.OnStore(sink).Match( + eventasssert.MatchKind(eventasssert.EventReceived), + eventasssert.MatchEvent( + test.HasSource(eventSource), + test.HasType(eventType), + test.HasData([]byte(eventBody)), + ), + ).AtLeast(1)) + + return f +} + +func brokerRedeliveryDropN(retryNum int32, dropNum uint) *feature.Feature { + f := feature.NewFeatureNamed("Broker reply with a bad status code to the first n events") + + source := feature.MakeRandomK8sName("source") + sink := feature.MakeRandomK8sName("sink") + via := feature.MakeRandomK8sName("via") + + eventSource := "source2" + eventType := "type2" + eventBody := `{"msg":"DropN"}` + event := cloudevents.NewEvent() + event.SetID(uuid.New().String()) + event.SetType(eventType) + event.SetSource(eventSource) + event.SetData(cloudevents.ApplicationJSON, []byte(eventBody)) + + //Install the broker + brokerName := feature.MakeRandomK8sName("broker") + exp := duckv1.BackoffPolicyLinear + brokerConfig := append(broker.WithEnvConfig(), broker.WithRetry(retryNum, &exp, ptr.String("PT1S"))) + + f.Setup("install broker", broker.Install(brokerName, brokerConfig...)) + f.Requirement("broker is ready", broker.IsReady(brokerName)) + f.Requirement("broker is addressable", broker.IsAddressable(brokerName)) + + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver)) + + // Point the Trigger subscriber to the sink svc. + cfg := []manifest.CfgFn{trigger.WithSubscriber(service.AsKReference(sink), ""), trigger.WithBrokerName(brokerName)} + + // Install the trigger + f.Setup("install trigger", trigger.Install(via, cfg...)) + f.Setup("trigger goes ready", trigger.IsReady(via)) + + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(event), + eventshub.DropFirstN(dropNum), + )) + + f.Stable("Broker Redelivery failed the first n events"). + Must("delivers events", + func(ctx context.Context, t feature.T) { + eventasssert.OnStore(sink). + Match(features.HasKnNamespaceHeader(environment.FromContext(ctx).Namespace())). + Match( + eventasssert.MatchKind(eventasssert.EventReceived), + eventasssert.MatchEvent( + test.HasSource(eventSource), + test.HasType(eventType), + test.HasData([]byte(eventBody)), + ), + ). + AtLeast(1)(ctx, t) + }) + + return f +} + +func BrokerDeadLetterSinkExtensions() *feature.FeatureSet { + fs := &feature.FeatureSet{ + Name: "Knative Broker - DeadLetterSink - with Extensions", + + Features: []*feature.Feature{ + brokerSubscriberUnreachable(), + brokerSubscriberErrorNodata(), + brokerSubscriberErrorWithdata(), + }, + } + return fs +} + +func brokerSubscriberUnreachable() *feature.Feature { + f := feature.NewFeatureNamed("Broker Subscriber Unreachable") + + source := feature.MakeRandomK8sName("source") + sink := feature.MakeRandomK8sName("sink") + triggerName := feature.MakeRandomK8sName("triggerName") + + eventSource := "source1" + eventType := "type1" + eventBody := `{"msg":"test msg"}` + event := cloudevents.NewEvent() + event.SetID(uuid.New().String()) + event.SetType(eventType) + event.SetSource(eventSource) + event.SetData(cloudevents.ApplicationJSON, []byte(eventBody)) + + subscriberUri := fmt.Sprintf("http://fake.svc.%s", network.GetClusterDomainName()) + + //Install the broker + brokerName := feature.MakeRandomK8sName("broker") + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Requirement("broker is ready", broker.IsReady(brokerName)) + f.Requirement("broker is addressable", broker.IsAddressable(brokerName)) + + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver)) + + // Install the trigger and Point the Trigger subscriber to the sink svc. + f.Setup("install trigger", trigger.Install( + triggerName, + trigger.WithBrokerName(brokerName), + trigger.WithSubscriber(nil, subscriberUri), + trigger.WithDeadLetterSink(service.AsKReference(sink), ""), + )) + f.Setup("trigger goes ready", trigger.IsReady(triggerName)) + + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(event), + )) + + f.Assert("Receives dls extensions when subscriber is unreachable", + func(ctx context.Context, t feature.T) { + eventasssert.OnStore(sink). + Match(features.HasKnNamespaceHeader(environment.FromContext(ctx).Namespace())). + MatchEvent( + test.HasExtension("knativeerrordest", subscriberUri), + ). + AtLeast(1)(ctx, t) + }, + ) + return f +} + +func brokerSubscriberErrorNodata() *feature.Feature { + f := feature.NewFeatureNamed("Broker Subscriber Error Nodata") + + source := feature.MakeRandomK8sName("source") + sink := feature.MakeRandomK8sName("sink") + failer := feature.MakeRandomK8sName("failer") + triggerName := feature.MakeRandomK8sName("triggerName") + + eventSource := "source1" + eventType := "type1" + eventBody := `{"msg":"test msg"}` + event := cloudevents.NewEvent() + event.SetID(uuid.New().String()) + event.SetType(eventType) + event.SetSource(eventSource) + event.SetData(cloudevents.ApplicationJSON, []byte(eventBody)) + + //Install the broker + brokerName := feature.MakeRandomK8sName("broker") + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Requirement("broker is ready", broker.IsReady(brokerName)) + f.Requirement("broker is addressable", broker.IsAddressable(brokerName)) + + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver)) + + f.Setup("install failing receiver", eventshub.Install(failer, + eventshub.StartReceiver, + eventshub.DropFirstN(1), + eventshub.DropEventsResponseCode(422), + )) + + // Install the trigger and Point the Trigger subscriber to the sink svc. + f.Setup("install trigger", trigger.Install( + triggerName, + trigger.WithBrokerName(brokerName), + trigger.WithSubscriber(service.AsKReference(failer), ""), + trigger.WithDeadLetterSink(service.AsKReference(sink), ""), + )) + f.Setup("trigger goes ready", trigger.IsReady(triggerName)) + + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(event), + )) + + f.Assert("Receives dls extensions without errordata", assertEnhancedWithKnativeErrorExtensions( + sink, + func(ctx context.Context) test.EventMatcher { + failerAddress, _ := service.Address(ctx, failer) + return test.HasExtension("knativeerrordest", failerAddress.URL.String()) + }, + func(ctx context.Context) test.EventMatcher { + return test.HasExtension("knativeerrorcode", "422") + }, + )) + + return f +} + +func brokerSubscriberErrorWithdata() *feature.Feature { + f := feature.NewFeatureNamed("Broker Subscriber Error With data encoded") + + source := feature.MakeRandomK8sName("source") + sink := feature.MakeRandomK8sName("sink") + failer := feature.MakeRandomK8sName("failer") + triggerName := feature.MakeRandomK8sName("triggerName") + + eventSource := "source1" + eventType := "type1" + eventBody := `{"msg":"test msg"}` + event := cloudevents.NewEvent() + event.SetID(uuid.New().String()) + event.SetType(eventType) + event.SetSource(eventSource) + event.SetData(cloudevents.ApplicationJSON, []byte(eventBody)) + + //Install the broker + brokerName := feature.MakeRandomK8sName("broker") + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Requirement("broker is ready", broker.IsReady(brokerName)) + f.Requirement("broker is addressable", broker.IsAddressable(brokerName)) + + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver)) + + errorData := `{ "message": "catastrophic failure" }` + f.Setup("install failing receiver", eventshub.Install(failer, + eventshub.StartReceiver, + eventshub.DropFirstN(1), + eventshub.DropEventsResponseCode(422), + eventshub.DropEventsResponseBody(errorData), + )) + + // Install the trigger and Point the Trigger subscriber to the sink svc. + f.Setup("install trigger", trigger.Install( + triggerName, + trigger.WithBrokerName(brokerName), + trigger.WithSubscriber(service.AsKReference(failer), ""), + trigger.WithDeadLetterSink(service.AsKReference(sink), ""), + )) + f.Setup("trigger goes ready", trigger.IsReady(triggerName)) + + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(event), + )) + + f.Assert("Receives dls extensions with errordata", assertEnhancedWithKnativeErrorExtensions( + sink, + func(ctx context.Context) test.EventMatcher { + failerAddress, _ := service.Address(ctx, failer) + return test.HasExtension("knativeerrordest", failerAddress.URL.String()) + }, + func(ctx context.Context) test.EventMatcher { + return test.HasExtension("knativeerrorcode", "422") + }, + func(ctx context.Context) test.EventMatcher { + return test.HasExtension("knativeerrordata", base64.StdEncoding.EncodeToString([]byte(errorData))) + }, + )) + + return f +} + +func assertEnhancedWithKnativeErrorExtensions(sinkName string, matcherfns ...func(ctx context.Context) test.EventMatcher) feature.StepFn { + return func(ctx context.Context, t feature.T) { + matchers := make([]test.EventMatcher, len(matcherfns)) + for i, fn := range matcherfns { + matchers[i] = fn(ctx) + } + _ = eventshub.StoreFromContext(ctx, sinkName).AssertExact( + ctx, + t, + 1, + eventasssert.MatchKind(eventshub.EventReceived), + eventasssert.MatchEvent(matchers...), + ) + } +} + +func BrokerDeliverLongMessage() *feature.FeatureSet { + fs := &feature.FeatureSet{ + Name: "Knative Broker - DeadLetterSink - with Extensions", + + Features: []*feature.Feature{ + brokerSubscriberLongMessage(), + }, + } + return fs +} + +func brokerSubscriberLongMessage() *feature.Feature { + f := feature.NewFeatureNamed("Broker Subscriber with long data message") + + source := feature.MakeRandomK8sName("source") + sink := feature.MakeRandomK8sName("sink") + triggerName := feature.MakeRandomK8sName("triggerName") + + eventSource := "source1" + eventType := "type1" + eventBody := strings.Repeat("X", 36864) + event := cloudevents.NewEvent() + event.SetID(uuid.New().String()) + event.SetType(eventType) + event.SetSource(eventSource) + event.SetData(cloudevents.TextPlain, []byte(eventBody)) + + //Install the broker + brokerName := feature.MakeRandomK8sName("broker") + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Requirement("broker is ready", broker.IsReady(brokerName)) + f.Requirement("broker is addressable", broker.IsAddressable(brokerName)) + + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver)) + + // Install the trigger and Point the Trigger subscriber to the sink svc. + f.Setup("install trigger", trigger.Install( + triggerName, + trigger.WithBrokerName(brokerName), + trigger.WithSubscriber(service.AsKReference(sink), ""), + )) + f.Setup("trigger goes ready", trigger.IsReady(triggerName)) + + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(event), + )) + + f.Assert("receive long event on sink exactly once", + eventasssert.OnStore(sink). + MatchEvent(test.HasData([]byte(eventBody))). + Exact(1), + ) + return f +} + +/* +Following test sends an event to the first sink, Sink1, which will send a long response destined to Sink2. +The test will assert that the long response is received by Sink2 +EventSource ---> Broker ---> Trigger1 ---> Sink1(Transformation) ---> Trigger2 --> Sink2 +*/ + +func BrokerDeliverLongResponseMessage() *feature.FeatureSet { + fs := &feature.FeatureSet{ + Name: "Knative Broker - Long Response Message", + + Features: []*feature.Feature{ + brokerSubscriberLongResponseMessage(), + }, + } + return fs +} + +func brokerSubscriberLongResponseMessage() *feature.Feature { + f := feature.NewFeatureNamed("Broker, chain of Triggers, long response message from first subscriber") + + source := feature.MakeRandomK8sName("source") + sink1 := feature.MakeRandomK8sName("sink1") + sink2 := feature.MakeRandomK8sName("sink2") + trigger1 := feature.MakeRandomK8sName("trigger1") + trigger2 := feature.MakeRandomK8sName("trigger2") + + eventSource1 := "source1" + eventSource2 := "source2" + eventType1 := "type1" + eventType2 := "type2" + eventBody := `{"msg":"eventBody"}` + transformedEventBody := `{"msg":"` + strings.Repeat("X", 36000) + `"}` + event := cloudevents.NewEvent() + event.SetID(uuid.New().String()) + event.SetType(eventType1) + event.SetSource(eventSource1) + event.SetData(cloudevents.TextPlain, []byte(eventBody)) + + //Install the broker + brokerName := feature.MakeRandomK8sName("broker") + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Requirement("broker is ready", broker.IsReady(brokerName)) + f.Requirement("broker is addressable", broker.IsAddressable(brokerName)) + + // Sink1 will transform the event so it can be filtered by Trigger2 + f.Setup("install sink1", eventshub.Install( + sink1, + eventshub.ReplyWithTransformedEvent(eventType2, eventSource2, transformedEventBody), + eventshub.StartReceiver, + )) + + f.Setup("install sink2", eventshub.Install(sink2, eventshub.StartReceiver)) + + // Install the Triggers with appropriate Sinks and filters + f.Setup("install trigger1", trigger.Install( + trigger1, + trigger.WithBrokerName(brokerName), + trigger.WithSubscriber(service.AsKReference(sink1), ""), + trigger.WithFilter(map[string]string{"type": eventType1, "source": eventSource1}), + )) + f.Setup("trigger1 goes ready", trigger.IsReady(trigger1)) + + f.Setup("install trigger2", trigger.Install( + trigger2, + trigger.WithBrokerName(brokerName), + trigger.WithSubscriber(service.AsKReference(sink2), ""), + trigger.WithFilter(map[string]string{"type": eventType2, "source": eventSource2}), + )) + f.Setup("trigger2 goes ready", trigger.IsReady(trigger2)) + + // Install the Source + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(event), + )) + + f.Assert("receive long event on sink1 exactly once", + eventasssert.OnStore(sink1). + MatchEvent(test.HasData([]byte(eventBody))). + Exact(1), + ) + + f.Assert("receive long event on sink2 exactly once", + eventasssert.OnStore(sink2). + MatchEvent(test.HasData([]byte(transformedEventBody))). + Exact(1), + ) + + return f +} + +type eventTestCase struct { + Type string + Source string + Extensions map[string]interface{} +} + +func newEventTestCase(tp, source string) eventTestCase { + return eventTestCase{Type: tp, Source: source} +} + +func newEventTestCaseWithExtensions(tp string, source string, extensions map[string]interface{}) eventTestCase { + return eventTestCase{Type: tp, Source: source, Extensions: extensions} +} + +// toEventMatcher converts the test case to the event matcher +func (tc eventTestCase) toEventMatcher() test.EventMatcher { + var matchers []test.EventMatcher + if tc.Type == eventingv1.TriggerAnyFilter { + matchers = append(matchers, test.ContainsAttributes(spec.Type)) + } else { + matchers = append(matchers, test.HasType(tc.Type)) + } + + if tc.Source == eventingv1.TriggerAnyFilter { + matchers = append(matchers, test.ContainsAttributes(spec.Source)) + } else { + matchers = append(matchers, test.HasSource(tc.Source)) + } + + for k, v := range tc.Extensions { + if v == eventingv1.TriggerAnyFilter { + matchers = append(matchers, test.ContainsExtensions(k)) + } else { + matchers = append(matchers, test.HasExtension(k, v)) + } + } + + return test.AllOf(matchers...) +} + +func (tc eventTestCase) toID() string { + id := fmt.Sprintf("%s-%s", tc.Type, tc.Source) + for k, v := range tc.Extensions { + id += fmt.Sprintf("-%s_%s", k, v) + } + return id +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/broker/oidc_feature.go b/vendor/knative.dev/eventing/test/rekt/features/broker/oidc_feature.go new file mode 100644 index 0000000000..c6d688a18b --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/broker/oidc_feature.go @@ -0,0 +1,230 @@ +/* +Copyright 2024 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package broker + +import ( + "context" + + "knative.dev/pkg/apis" + + "github.com/cloudevents/sdk-go/v2/test" + "github.com/google/uuid" + "knative.dev/eventing/test/rekt/features/featureflags" + "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/eventing/test/rekt/resources/delivery" + "knative.dev/eventing/test/rekt/resources/trigger" + triggerresources "knative.dev/eventing/test/rekt/resources/trigger" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/reconciler-test/pkg/eventshub" + eventassert "knative.dev/reconciler-test/pkg/eventshub/assert" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/resources/service" +) + +func BrokerSendEventWithOIDC() *feature.FeatureSet { + return &feature.FeatureSet{ + Name: "Broker send events with OIDC support", + Features: []*feature.Feature{ + BrokerSendEventWithOIDCTokenToSubscriber(), + BrokerSendEventWithOIDCTokenToReply(), + BrokerSendEventWithOIDCTokenToDLS(), + }, + } +} + +func BrokerSendEventWithOIDCTokenToSubscriber() *feature.Feature { + f := feature.NewFeatureNamed("Broker supports flow with OIDC tokens") + + f.Prerequisite("OIDC Authentication is enabled", featureflags.AuthenticationOIDCEnabled()) + f.Prerequisite("transport encryption is strict", featureflags.TransportEncryptionStrict()) + f.Prerequisite("should not run when Istio is enabled", featureflags.IstioDisabled()) + + source := feature.MakeRandomK8sName("source") + brokerName := feature.MakeRandomK8sName("broker") + sink := feature.MakeRandomK8sName("sink") + triggerName := feature.MakeRandomK8sName("triggerName") + sinkAudience := "sink-audience" + + event := test.FullEvent() + + // Install the broker + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Setup("broker is ready", broker.IsReady(brokerName)) + f.Setup("broker is addressable", broker.IsAddressable(brokerName)) + + // Install the sink + f.Setup("install sink", eventshub.Install( + sink, + eventshub.StartReceiverTLS, + eventshub.OIDCReceiverAudience(sinkAudience), + )) + + f.Setup("Install the trigger", func(ctx context.Context, t feature.T) { + d := service.AsDestinationRef(sink) + d.CACerts = eventshub.GetCaCerts(ctx) + d.Audience = &sinkAudience + trigger.Install(triggerName, trigger.WithBrokerName(brokerName), trigger.WithSubscriberFromDestination(d))(ctx, t) + }) + f.Setup("trigger goes ready", trigger.IsReady(triggerName)) + + // Send event + f.Requirement("install source", eventshub.Install( + source, + eventshub.StartSenderToResourceTLS(broker.GVR(), brokerName, nil), + eventshub.InputEvent(event), + )) + + f.Alpha("Broker"). + Must("handles event with valid OIDC token", eventassert.OnStore(sink).MatchReceivedEvent(test.HasId(event.ID())).Exact(1)). + Must("uses triggers identity for OIDC", eventassert.OnStore(sink).MatchWithContext( + eventassert.MatchKind(eventshub.EventReceived).WithContext(), + eventassert.MatchOIDCUserFromResource(triggerresources.GVR(), triggerName)).AtLeast(1)) + + return f +} + +func BrokerSendEventWithOIDCTokenToDLS() *feature.Feature { + f := feature.NewFeature() + + f.Prerequisite("OIDC Authentication is enabled", featureflags.AuthenticationOIDCEnabled()) + f.Prerequisite("transport encryption is strict", featureflags.TransportEncryptionStrict()) + f.Prerequisite("should not run when Istio is enabled", featureflags.IstioDisabled()) + + brokerName := feature.MakeRandomK8sName("broker") + dls := feature.MakeRandomK8sName("dls") + triggerName := feature.MakeRandomK8sName("trigger") + source := feature.MakeRandomK8sName("source") + dlsAudience := "dls-audience" + + event := test.FullEvent() + event.SetID(uuid.New().String()) + + // Install DLS sink + f.Setup("install dead letter sink", eventshub.Install(dls, + eventshub.OIDCReceiverAudience(dlsAudience), + eventshub.StartReceiverTLS)) + + f.Setup("install broker", func(ctx context.Context, t feature.T) { + brokerConfig := append(broker.WithEnvConfig(), + delivery.WithDeadLetterSinkFromDestination(&duckv1.Destination{ + Ref: service.AsKReference(dls), + Audience: &dlsAudience, + CACerts: eventshub.GetCaCerts(ctx), + })) + broker.Install(brokerName, brokerConfig...)(ctx, t) + }) + + f.Setup("Broker is ready", broker.IsReady(brokerName)) + + f.Setup("Install the trigger", func(ctx context.Context, t feature.T) { + // create an empty destination ref + d := duckv1.Destination{} + d.CACerts = eventshub.GetCaCerts(ctx) + d.URI, _ = apis.ParseURL("bad://uri") + trigger.Install(triggerName, trigger.WithBrokerName(brokerName), trigger.WithSubscriberFromDestination(&d))(ctx, t) + + }) + + f.Setup("trigger is ready", trigger.IsReady(triggerName)) + + // Send events after data plane is ready. + f.Requirement("install source", eventshub.Install(source, + eventshub.StartSenderToResourceTLS(broker.GVR(), brokerName, nil), + eventshub.InputEvent(event), + )) + + // Assert events ended up where we expected. + f.Stable("broker with DLS"). + Must("deliver event to DLQ", eventassert.OnStore(dls).MatchReceivedEvent(test.HasId(event.ID())).AtLeast(1)). + Must("uses triggers identity for OIDC", eventassert.OnStore(dls).MatchWithContext( + eventassert.MatchKind(eventshub.EventReceived).WithContext(), + eventassert.MatchOIDCUserFromResource(triggerresources.GVR(), triggerName)).AtLeast(1)) + + return f +} + +func BrokerSendEventWithOIDCTokenToReply() *feature.Feature { + //1. An event is sent to a broker. + //2. A trigger routes this event to a subscriber. + //3. The subscriber processes and replies to the event. + //4. A helper trigger routes the reply to a designated sink. + //5. The test verifies that the reply reaches the sink with the expected modifications. + f := feature.NewFeature() + + f.Prerequisite("OIDC Authentication is enabled", featureflags.AuthenticationOIDCEnabled()) + f.Prerequisite("transport encryption is strict", featureflags.TransportEncryptionStrict()) + f.Prerequisite("should not run when Istio is enabled", featureflags.IstioDisabled()) + + brokerName := feature.MakeRandomK8sName("broker") + subscriber := feature.MakeRandomK8sName("subscriber") + reply := feature.MakeRandomK8sName("reply") + triggerName := feature.MakeRandomK8sName("trigger") + helperTriggerName := feature.MakeRandomK8sName("helper-trigger") + source := feature.MakeRandomK8sName("source") + + event := test.FullEvent() + event.SetID(uuid.New().String()) + + replyEventType := "reply-type" + replyEventSource := "reply-source" + + // Install subscriber + f.Setup("install subscriber", eventshub.Install(subscriber, + eventshub.ReplyWithTransformedEvent(replyEventType, replyEventSource, ""), + eventshub.StartReceiverTLS)) + + // Install sink for reply + // Hint: we don't need to require OIDC auth at the reply sink, because the + // actual reply is sent to the broker ingress, which must support OIDC. This + // reply sink is only to check that the reply was sent and routed correctly. + f.Setup("install sink for reply", eventshub.Install(reply, + eventshub.StartReceiverTLS)) + + // Install broker + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Setup("Broker is ready", broker.IsReady(brokerName)) + + f.Setup("install the trigger", func(ctx context.Context, t feature.T) { + d := service.AsDestinationRef(subscriber) + d.CACerts = eventshub.GetCaCerts(ctx) + trigger.Install(triggerName, trigger.WithBrokerName(brokerName), trigger.WithSubscriberFromDestination(d), trigger.WithFilter(map[string]string{ + "type": event.Type(), + }))(ctx, t) + }) + + f.Setup("trigger is ready", trigger.IsReady(triggerName)) + + f.Setup("install the trigger and specify the CA cert of the destination", func(ctx context.Context, t feature.T) { + d := service.AsDestinationRef(reply) + d.CACerts = eventshub.GetCaCerts(ctx) + trigger.Install(helperTriggerName, trigger.WithBrokerName(brokerName), trigger.WithSubscriberFromDestination(d), trigger.WithFilter(map[string]string{ + "type": replyEventType, + }))(ctx, t) + }) + + // Send events after data plane is ready. + f.Requirement("install source", eventshub.Install(source, + eventshub.StartSenderToResourceTLS(broker.GVR(), brokerName, nil), + eventshub.InputEvent(event), + )) + + // Assert events ended up where we expected. + f.Stable("broker with reply"). + Must("deliver event to reply sink", eventassert.OnStore(reply).MatchReceivedEvent(test.HasSource(replyEventSource)).AtLeast(1)) + + return f +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/broker/readyness.go b/vendor/knative.dev/eventing/test/rekt/features/broker/readyness.go new file mode 100644 index 0000000000..e26384d56e --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/broker/readyness.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package broker + +import ( + "fmt" + + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/manifest" + "knative.dev/reconciler-test/pkg/resources/service" + + "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/eventing/test/rekt/resources/trigger" +) + +// TriggerGoesReady returns a feature that tests after the creation of a +// Trigger, it becomes ready. This feature assumes the Broker already exists. +func TriggerGoesReady(name, brokerName string, cfg ...manifest.CfgFn) *feature.Feature { + f := new(feature.Feature) + + // The test needs a subscriber. + sub := feature.MakeRandomK8sName("sub") + f.Setup("install a service", service.Install(sub, + service.WithSelectors(map[string]string{"app": "rekt"}))) + // Append user-provided cfg to the end, in case they are providing their own subscriber. + cfg = append([]manifest.CfgFn{trigger.WithSubscriber(service.AsKReference(sub), ""), trigger.WithBrokerName(brokerName)}, cfg...) + + // Install the trigger + f.Setup(fmt.Sprintf("install trigger %q", name), trigger.Install(name, cfg...)) + + // Wait for a ready broker. + f.Setup("Broker is ready", broker.IsReady(brokerName)) + f.Setup("Trigger is ready", trigger.IsReady(name)) + + return f +} + +// GoesReady returns a feature that will create a Broker of the given +// name and class, and confirm it becomes ready with an address. +func GoesReady(name string, cfg ...manifest.CfgFn) *feature.Feature { + f := new(feature.Feature) + + f.Setup(fmt.Sprintf("install broker %q", name), broker.Install(name, cfg...)) + f.Setup("Broker is ready", broker.IsReady(name)) + f.Setup("Broker is addressable", broker.IsAddressable(name)) + + return f +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/broker/source_to_sink.go b/vendor/knative.dev/eventing/test/rekt/features/broker/source_to_sink.go new file mode 100644 index 0000000000..bf0c543114 --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/broker/source_to_sink.go @@ -0,0 +1,145 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package broker + +import ( + "time" + + "github.com/google/uuid" + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/manifest" + "knative.dev/reconciler-test/pkg/resources/service" + + "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/eventing/test/rekt/resources/delivery" + "knative.dev/eventing/test/rekt/resources/trigger" + + . "github.com/cloudevents/sdk-go/v2/test" + . "knative.dev/reconciler-test/pkg/eventshub/assert" +) + +// SourceToSink tests to see if a Ready Broker acts as middleware. +// LoadGenerator --> in [Broker] out --> Recorder +func SourceToSink(brokerName string) *feature.Feature { + source := feature.MakeRandomK8sName("source") + sink := feature.MakeRandomK8sName("sink") + via := feature.MakeRandomK8sName("via") + event := FullEvent() + + f := new(feature.Feature) + + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver)) + + // Point the Trigger subscriber to the sink svc. + cfg := []manifest.CfgFn{trigger.WithSubscriber(service.AsKReference(sink), ""), trigger.WithBrokerName(brokerName)} + + // Install the trigger + f.Setup("install trigger", trigger.Install(via, cfg...)) + + f.Setup("trigger goes ready", trigger.IsReady(via)) + + f.Requirement("install source", eventshub.Install(source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(event), + )) + + f.Stable("broker as middleware"). + Must("deliver an event", + OnStore(sink).MatchEvent(HasId(event.ID())).Exact(1)) + + return f +} + +// SourceToSinkWithDLQ tests to see if a Trigger with no DLQ and a bad Sink, subscribed +// to a Ready Broker, forward unsent events to it's Broker's DLQ +// +// source ---> broker --[trigger]--> bad uri +// +// | +// +--[DLQ]--> dlq +func SourceToSinkWithDLQ() *feature.Feature { + f := feature.NewFeature() + + brokerName := feature.MakeRandomK8sName("broker") + dls := feature.MakeRandomK8sName("dls") + triggerName := feature.MakeRandomK8sName("trigger") + source := feature.MakeRandomK8sName("source") + + f.Setup("install dead letter sink service", eventshub.Install(dls, eventshub.StartReceiver)) + + brokerConfig := append(broker.WithEnvConfig(), delivery.WithDeadLetterSink(service.AsKReference(dls), "")) + f.Setup("install broker", broker.Install(brokerName, brokerConfig...)) + f.Setup("Broker is ready", broker.IsReady(brokerName)) + f.Setup("install trigger", trigger.Install(triggerName, trigger.WithBrokerName(brokerName), trigger.WithSubscriber(nil, "bad://uri"))) + f.Setup("trigger is ready", trigger.IsReady(triggerName)) + + ce := FullEvent() + ce.SetID(uuid.New().String()) + + // Send events after data plane is ready. + f.Requirement("install source", eventshub.Install(source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(ce), + )) + + // Assert events ended up where we expected. + f.Stable("broker with DLS"). + Must("deliver event to DLQ", OnStore(dls).MatchEvent(HasId(ce.ID())).AtLeast(1)) + + return f +} + +// SourceToSinkWithFlakyDLQ tests to see if a Ready Broker acts as middleware. +// +// source ---> broker --[trigger]--> flake 1/3 --> recorder +// +// | +// +--[DLQ]--> recorder +func SourceToSinkWithFlakyDLQ(brokerName string) *feature.Feature { + source := feature.MakeRandomK8sName("source") + sink := feature.MakeRandomK8sName("sink") + dlq := feature.MakeRandomK8sName("dlq") + via := feature.MakeRandomK8sName("via") + + f := feature.NewFeatureNamed("Source to sink with flaky DLS") + + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver)) + + f.Setup("install dlq", eventshub.Install(dlq, eventshub.StartReceiver)) + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver, eventshub.DropFirstN(2))) + f.Setup("update broker with DLQ", broker.Install(brokerName, broker.WithDeadLetterSink(service.AsKReference(dlq), ""))) + f.Setup("install trigger", trigger.Install(via, trigger.WithBrokerName(brokerName), trigger.WithSubscriber(service.AsKReference(sink), ""))) + f.Setup("trigger goes ready", trigger.IsReady(via)) + f.Setup("broker goes ready", broker.IsReady(via)) + + f.Requirement("install source", eventshub.Install(source, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.SendMultipleEvents(3, time.Millisecond), + eventshub.EnableIncrementalId, + )) + + f.Stable("broker with DLS"). + Must("deliver event flaky sent to DLQ event[0]", + OnStore(dlq).MatchEvent(HasId("1")).Exact(1)). + Must("deliver event flaky sent to DLQ event[1]", + OnStore(dlq).MatchEvent(HasId("2")).Exact(1)). + Must("deliver event sink receiver got event[2]", + OnStore(sink).MatchEvent(HasId("3")).Exact(1)) + + return f +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/broker/topology.go b/vendor/knative.dev/eventing/test/rekt/features/broker/topology.go new file mode 100644 index 0000000000..897a9a3348 --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/broker/topology.go @@ -0,0 +1,250 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package broker + +import ( + "context" + "fmt" + "strconv" + + conformanceevent "github.com/cloudevents/conformance/pkg/event" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + v1 "knative.dev/eventing/pkg/apis/duck/v1" + eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" + "knative.dev/eventing/test/rekt/features/knconf" + brokerresources "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/eventing/test/rekt/resources/delivery" + triggerresources "knative.dev/eventing/test/rekt/resources/trigger" + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/manifest" +) + +type triggerCfg struct { + failCount uint + filter *eventingv1.TriggerFilter + delivery *v1.DeliverySpec + reply *conformanceevent.Event +} + +// createBrokerTriggerDeliveryTopology creates a topology that allows us to test the various +// delivery configurations. +// +// source ---> [broker (brokerDS)] --+--[trigger0 (ds, filter)]--> "t0" + (optional reply) +// +// | | | +// | | +--> "t0dlq" (optional) +// | ... +// | +-[trigger{n} (ds, filter)]--> "t{n}" + (optional reply) +// | | +// | +--> "t{n}dlq" (optional) +// | +// +--[DLQ]--> "dlq" (optional) +func createBrokerTriggerTopology(f *feature.Feature, brokerName string, brokerDS *v1.DeliverySpec, triggers []triggerCfg, brokerOpts ...manifest.CfgFn) *eventshub.EventProber { + prober := eventshub.NewProber() + + f.Setup("install recorder for broker dlq", prober.ReceiverInstall("brokerdlq")) + brokerOpts = append(brokerOpts, brokerresources.WithEnvConfig()...) + + if brokerDS != nil { + if brokerDS.DeadLetterSink != nil { + brokerOpts = append(brokerOpts, delivery.WithDeadLetterSink(prober.AsKReference("brokerdlq"), "")) + } + if brokerDS.Retry != nil { + brokerOpts = append(brokerOpts, delivery.WithRetry(*brokerDS.Retry, brokerDS.BackoffPolicy, brokerDS.BackoffDelay)) + } + } + f.Setup("Create Broker", brokerresources.Install(brokerName, brokerOpts...)) + f.Setup("Broker is Ready", brokerresources.IsReady(brokerName)) // We want to block until broker is ready to go. + + prober.SetTargetResource(brokerresources.GVR(), brokerName) + + for i, t := range triggers { + name := fmt.Sprintf("t%d", i) + dlqName := fmt.Sprintf("t%ddlq", i) + + nameOpts := []eventshub.EventsHubOption{eventshub.DropFirstN(t.failCount)} + if t.reply != nil { + nameOpts = append(nameOpts, + eventshub.ReplyWithTransformedEvent(t.reply.Attributes.Type, t.reply.Attributes.Source, t.reply.Data)) + } + + // TODO: Optimize these to only install things required. For example, if there's no tn dlq, no point creating a prober for it. + f.Setup("install recorder for "+name, prober.ReceiverInstall(name, nameOpts...)) + f.Setup("install recorder for "+dlqName, prober.ReceiverInstall(dlqName)) + + tOpts := []manifest.CfgFn{triggerresources.WithSubscriber(prober.AsKReference(name), ""), triggerresources.WithBrokerName(brokerName)} + + if t.delivery != nil { + if t.delivery.DeadLetterSink != nil { + tOpts = append(tOpts, delivery.WithDeadLetterSink(prober.AsKReference(dlqName), "")) + } + if t.delivery.Retry != nil { + tOpts = append(tOpts, delivery.WithRetry(*t.delivery.Retry, t.delivery.BackoffPolicy, t.delivery.BackoffDelay)) + } + } + if t.filter != nil { + tOpts = append(tOpts, triggerresources.WithFilter(t.filter.Attributes)) + } + + triggerName := feature.MakeRandomK8sName(name) + f.Setup("Create Trigger"+strconv.Itoa(i)+" with recorder", + triggerresources.Install(triggerName, tOpts...)) + + f.Setup("Trigger"+strconv.Itoa(i)+" is ready", + triggerresources.IsReady(triggerName)) + } + return prober +} + +// createExpectedEventMap creates a datastructure for a given test topology created by `createBrokerTriggerDeliveryTopology` function. +// Things we know from the DeliverySpecs passed in are where failed events from both t1 and t2 should land in. +// We also know how many events (incoming as well as how many failures the trigger subscriber is supposed to see). +// Note there are lot of baked assumptions and very tight coupling between this and `createBrokerTriggerDeliveryTopology` function. +func createExpectedEventPatterns(brokerDS *v1.DeliverySpec, triggers []triggerCfg) map[string]knconf.EventPattern { + // By default, assume that nothing gets anything. + p := map[string]knconf.EventPattern{ + "brokerdlq": { + Success: []bool{}, + Interval: []uint{}, + }, + } + + brokerdlq := false + for i, t := range triggers { + name := fmt.Sprintf("t%d", i) + dlqName := fmt.Sprintf("t%ddlq", i) + p[name] = knconf.EventPattern{ + Success: []bool{}, + Interval: []uint{}, + } + p[dlqName] = knconf.EventPattern{ + Success: []bool{}, + Interval: []uint{}, + } + + attempts := knconf.DeliveryAttempts(t.delivery, brokerDS) + + p[name] = knconf.PatternFromEstimates(attempts, t.failCount) + if attempts <= t.failCount { + if t.delivery != nil && t.delivery.DeadLetterSink != nil { + p[dlqName] = knconf.PatternFromEstimates(1, 0) + } else { + brokerdlq = true + } + } + // TODO: replies do not work yet. + } + + if brokerdlq && brokerDS != nil && brokerDS.DeadLetterSink != nil { + p["brokerdlq"] = knconf.PatternFromEstimates(1, 0) + } + + return p +} + +func assertExpectedRoutedEvents(prober *eventshub.EventProber, expected map[string][]conformanceevent.Event) feature.StepFn { + return func(ctx context.Context, t feature.T) { + for prefix, want := range expected { + got := knconf.ReceivedEventsFromProber(ctx, prober, prefix) + + t.Logf("Expected Events %s; \nGot: %#v\n Want: %#v", prefix, got, want) + if len(want) != len(got) { + t.Errorf("Wanted %d events, got %d", len(want), len(got)) + } + + // Check event acceptance. + if len(want) != 0 && len(got) != 0 { + // ID is adjusted by eventshub. + except := []cmp.Option{ + cmpopts.IgnoreFields(conformanceevent.ContextAttributes{}, "ID", "Extensions"), + cmpopts.IgnoreMapEntries(func(k, v string) bool { return k == "knativearrivaltime" }), + } + if diff := cmp.Diff(want, got, except...); diff != "" { + t.Error("unexpected event routing behaviour (-want, +got) =", diff) + } + } + } + } +} + +// createExpectedEventRoutingMap takes in an array of trigger configurations as well as incoming events and +// constructs a map of where the events should land. Any replies in trigger configurations will be treated +// as matchable events (since they are going to be sent back to the Broker). +// TODO: This function only handles replies generated to incoming events properly and it's fine for our +// tests for now. But if you wanted to test calling filter T0 which would generated EReply which would +// match filter T1 which would generate EReplyTwo, then that won't work. +func createExpectedEventRoutingMap(triggerConfigs []triggerCfg, inEvents []conformanceevent.Event) map[string][]conformanceevent.Event { + ret := make(map[string][]conformanceevent.Event, len(triggerConfigs)) + + repliesGenerated := make([]conformanceevent.Event, 0) + + // For each of the events (both incoming and newly created (replies)) check each trigger filter and append + // to the expected events if it matches. + for _, e := range inEvents { + for i, config := range triggerConfigs { + triggerName := fmt.Sprintf("t%d", i) + if eventMatchesTrigger(e, config.filter) { + ret[triggerName] = append(ret[triggerName], e) + // Ok, so if there is a reply, and this trigger was tickled, add as "generated reply" event that's + // used below. + if config.reply != nil { + repliesGenerated = append(repliesGenerated, *config.reply) + } + } + } + } + + for _, e := range repliesGenerated { + for i, config := range triggerConfigs { + triggerName := fmt.Sprintf("t%d", i) + if eventMatchesTrigger(e, config.filter) { + ret[triggerName] = append(ret[triggerName], e) + } + } + } + return ret +} + +// eventNMatchesTrigger checks an event and returns True if the event matches the event. +// nil filter means everything matches, so it's safe to pass nil in here. +func eventMatchesTrigger(event conformanceevent.Event, filter *eventingv1.TriggerFilter) bool { + // With no filter, everything matches + if filter == nil { + return true + } + for attribute, value := range filter.Attributes { + switch attribute { + case "type": + return event.Attributes.Type == value + case "source": + return event.Attributes.Source == value + case "subject": + return event.Attributes.Subject == value + } + // Not a well known attribute, check extensions. + filterAttribute, ok := event.Attributes.Extensions[attribute] + if !ok { + // We want an attribute on the event, but it's not there, so no soup for you. + return false + } + return filterAttribute == attribute + } + // TODO: Do more matching here as necessary. + return false +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/trigger/client.go b/vendor/knative.dev/eventing/test/rekt/features/trigger/client.go new file mode 100644 index 0000000000..07cd23a898 --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/trigger/client.go @@ -0,0 +1,66 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package trigger + +import ( + "context" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" + eventingclientsetv1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1" + eventingclient "knative.dev/eventing/pkg/client/injection/client" + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/state" +) + +const ( + TriggerNameKey = "triggerName" +) + +func GetTrigger(ctx context.Context, t feature.T) *eventingv1.Trigger { + c := Client(ctx) + name := state.GetStringOrFail(ctx, t, TriggerNameKey) + + trigger, err := c.Triggers.Get(ctx, name, metav1.GetOptions{}) + if err != nil { + t.Errorf("failed to get Trigger, %v", err) + } + return trigger +} + +func SetTriggerName(name string) feature.StepFn { + return func(ctx context.Context, t feature.T) { + state.SetOrFail(ctx, t, TriggerNameKey, name) + } +} + +type EventingClient struct { + Brokers eventingclientsetv1.BrokerInterface + Triggers eventingclientsetv1.TriggerInterface +} + +func Client(ctx context.Context) *EventingClient { + ec := eventingclient.Get(ctx).EventingV1() + env := environment.FromContext(ctx) + + return &EventingClient{ + Brokers: ec.Brokers(env.Namespace()), + Triggers: ec.Triggers(env.Namespace()), + } +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/trigger/control_plane.go b/vendor/knative.dev/eventing/test/rekt/features/trigger/control_plane.go new file mode 100644 index 0000000000..59cb548e7a --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/trigger/control_plane.go @@ -0,0 +1,86 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package trigger + +import ( + "context" + + "github.com/stretchr/testify/assert" + + eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" + triggerresources "knative.dev/eventing/test/rekt/resources/trigger" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/resources/service" +) + +func Defaulting() *feature.FeatureSet { + fs := &feature.FeatureSet{ + Name: "Knative Trigger Specification - Defaulting", + Features: []*feature.Feature{ + Defaulting_Filter(), + Defaulting_SubscriberNamespace(), + }, + } + + return fs +} + +func Defaulting_Filter() *feature.Feature { + f := feature.NewFeatureNamed("Broker") + + resourceName := feature.MakeRandomK8sName("trigger") + + withSubscriber := triggerresources.WithSubscriber(service.AsKReference("sub"), "") + + f.Setup("Set Trigger name", SetTriggerName(resourceName)) + f.Setup("Create a Trigger with empty spec.filter", + triggerresources.Install(resourceName, triggerresources.WithBrokerName("broker"), withSubscriber)) + + f.Stable("Conformance"). + Must("Trigger MUST default spec.filter to empty filter", + defaultFilterIsSetOnTrigger) + return f +} + +func Defaulting_SubscriberNamespace() *feature.Feature { + f := feature.NewFeatureNamed("Broker") + + resourceName := feature.MakeRandomK8sName("trigger") + + withSubscriber := triggerresources.WithSubscriber(service.AsKReference("sub"), "") + + f.Setup("Set Trigger name", SetTriggerName(resourceName)) + f.Setup("Create a Trigger with empty subscriber namespace", + triggerresources.Install(resourceName, triggerresources.WithBrokerName("broker"), withSubscriber)) + + f.Stable("Conformance"). + Must("Trigger subscriber namespace MUST be defaulted to Trigger namespace", + triggerNamespaceIsSetOnSubscriber) + return f +} + +func defaultFilterIsSetOnTrigger(ctx context.Context, t feature.T) { + trigger := GetTrigger(ctx, t) + + assert.Equal(t, &eventingv1.TriggerFilter{}, trigger.Spec.Filter) +} + +func triggerNamespaceIsSetOnSubscriber(ctx context.Context, t feature.T) { + trigger := GetTrigger(ctx, t) + + assert.Equal(t, trigger.Namespace, trigger.Spec.Subscriber.Ref.Namespace) +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/trigger/crossnamespace.go b/vendor/knative.dev/eventing/test/rekt/features/trigger/crossnamespace.go new file mode 100644 index 0000000000..1dbb42932c --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/trigger/crossnamespace.go @@ -0,0 +1,81 @@ +/* +Copyright 2024 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package trigger + +import ( + "context" + + cetest "github.com/cloudevents/sdk-go/v2/test" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + eventingclient "knative.dev/eventing/pkg/client/injection/client" + "knative.dev/eventing/test/rekt/features/featureflags" + "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/eventing/test/rekt/resources/trigger" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/eventshub/assert" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/manifest" + "knative.dev/reconciler-test/pkg/resources/service" +) + +func CrossNamespaceEventLinks(brokerEnvCtx context.Context) *feature.Feature { + f := feature.NewFeature() + + f.Prerequisite("Cross Namespace Event Links is enabled", featureflags.CrossEventLinksEnabled()) + + sourceName := feature.MakeRandomK8sName("source") + subscriberName := feature.MakeRandomK8sName("subscriber") + + ev := cetest.FullEvent() + + triggerName := feature.MakeRandomK8sName("trigger") + brokerName := feature.MakeRandomK8sName("broker") + brokerNamespace := environment.FromContext(brokerEnvCtx).Namespace() + + brokerRef := &duckv1.KReference{ + APIVersion: "eventing.knative.dev/v1", + Kind: "Broker", + Name: brokerName, + Namespace: brokerNamespace, + } + + triggerCfg := []manifest.CfgFn{ + trigger.WithSubscriber(service.AsKReference(subscriberName), ""), + trigger.WithBrokerRef(brokerRef), + } + + f.Setup("install broker", broker.Install(brokerName, append(broker.WithEnvConfig(), broker.WithNamespace(brokerNamespace))...)) + f.Setup("install trigger", trigger.Install(triggerName, triggerCfg...)) + + f.Setup("install subscriber", eventshub.Install(subscriberName, eventshub.StartReceiver)) + + // .IsReady uses the environment in the context to find the resource, hence we can only check the trigger + // However, the trigger being ready implies the broker is ready, so we are okay + f.Setup("trigger is ready", trigger.IsReady(triggerName)) + f.Requirement("install event source", eventshub.Install(sourceName, eventshub.StartSenderToNamespacedResource(broker.GVR(), brokerName, brokerNamespace), eventshub.InputEvent(ev))) + + f.Assert("event is received by subscriber", assert.OnStore(subscriberName).MatchEvent(cetest.HasId(ev.ID())).Exact(1)) + + f.Teardown("delete trigger", func(ctx context.Context, t feature.T) { + env := environment.FromContext(ctx) + eventingclient.Get(ctx).EventingV1().Triggers(env.Namespace()).Delete(ctx, triggerName, metav1.DeleteOptions{}) + }) + + return f +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go b/vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go new file mode 100644 index 0000000000..0d26de3ed5 --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go @@ -0,0 +1,273 @@ +/* +Copyright 2022 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package trigger + +import ( + "context" + "fmt" + + "github.com/cloudevents/sdk-go/v2/test" + "k8s.io/utils/pointer" + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/network" + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/manifest" + "knative.dev/reconciler-test/pkg/resources/service" + + "knative.dev/reconciler-test/pkg/eventshub/assert" + + eventingv1 "knative.dev/eventing/pkg/apis/duck/v1" + "knative.dev/eventing/pkg/eventingtls/eventingtlstesting" + "knative.dev/eventing/test/rekt/features/featureflags" + "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/eventing/test/rekt/resources/pingsource" + "knative.dev/eventing/test/rekt/resources/trigger" +) + +// This test is for avoiding regressions on the trigger dependency annotation functionality. +func TriggerDependencyAnnotation() *feature.Feature { + sink := feature.MakeRandomK8sName("sink") + triggerName := feature.MakeRandomK8sName("triggerName") + + f := new(feature.Feature) + + //Install the broker + brokerName := feature.MakeRandomK8sName("broker") + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Setup("broker is ready", broker.IsReady(brokerName)) + f.Setup("broker is addressable", broker.IsAddressable(brokerName)) + + psourcename := "test-ping-source-annotation" + dependencyAnnotation := `{"kind":"PingSource","name":"test-ping-source-annotation","apiVersion":"sources.knative.dev/v1"}` + annotations := map[string]interface{}{ + "knative.dev/dependency": dependencyAnnotation, + } + + // Add the annotation to trigger and point the Trigger subscriber to the sink svc. + f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver)) + cfg := []manifest.CfgFn{ + trigger.WithSubscriber(service.AsKReference(sink), ""), + trigger.WithAnnotations(annotations), + trigger.WithBrokerName(brokerName), + } + + // Install the trigger + f.Setup("install trigger", trigger.Install(triggerName, cfg...)) + + // trigger won't go ready until after the pingsource exists, because of the dependency annotation + f.Requirement("trigger goes ready", trigger.IsReady(triggerName)) + + f.Requirement("install pingsource", func(ctx context.Context, t feature.T) { + brokeruri, err := broker.Address(ctx, brokerName) + if err != nil { + t.Error("failed to get address of broker", err) + } + cfg := []manifest.CfgFn{ + pingsource.WithSchedule("*/1 * * * *"), + pingsource.WithSink(&duckv1.Destination{URI: brokeruri.URL, CACerts: brokeruri.CACerts}), + pingsource.WithData("text/plain", "Test trigger-annotation"), + } + pingsource.Install(psourcename, cfg...)(ctx, t) + }) + f.Requirement("PingSource goes ready", pingsource.IsReady(psourcename)) + + f.Stable("pingsource as event source to test trigger with annotations"). + Must("delivers events on broker with URI", assert.OnStore(sink).MatchEvent( + test.HasType("dev.knative.sources.ping"), + test.DataContains("Test trigger-annotation"), + ).AtLeast(1)) + + return f +} + +func TriggerSupportsDeliveryFormat() *feature.FeatureSet { + return &feature.FeatureSet{ + Name: "Trigger supports delivery format", + Features: []*feature.Feature{triggerWithDispatcherFormat("json"), triggerWithDispatcherFormat("binary")}, + } +} + +func triggerWithDispatcherFormat(format string) *feature.Feature { + f := feature.NewFeatureNamed(fmt.Sprintf("Trigger supports sending with %s delivery format", format)) + + brokerName := feature.MakeRandomK8sName("broker") + sourceName := feature.MakeRandomK8sName("source") + sinkName := feature.MakeRandomK8sName("sink") + triggerName := feature.MakeRandomK8sName("trigger") + eventToSend := test.FullEvent() + + f.Setup("Install Broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Setup("Broker is ready", broker.IsReady(brokerName)) + f.Setup("Broker is addressable", broker.IsAddressable(brokerName)) + + f.Setup("Install Sink", eventshub.Install(sinkName, eventshub.VerifyEventFormat(format), eventshub.StartReceiver)) + + f.Setup("Install trigger", trigger.Install(triggerName, trigger.WithBrokerName(brokerName), trigger.WithFormat(format), trigger.WithSubscriber(service.AsKReference(sinkName), ""))) + f.Setup("Trigger is ready", trigger.IsReady(triggerName)) + + f.Requirement("Install source", eventshub.Install(sourceName, eventshub.InputEvent(eventToSend), eventshub.StartSenderToResource(broker.GVR(), brokerName))) + + f.Alpha("trigger"). + Must("dispatch event with correct format", assert.OnStore(sinkName).MatchReceivedEvent(test.HasId(eventToSend.ID())).AtLeast(1)) + + return f +} + +func TriggerWithTLSSubscriber() *feature.Feature { + f := feature.NewFeatureNamed("Trigger with TLS subscriber") + + f.Prerequisite("should not run when Istio is enabled", featureflags.IstioDisabled()) + + brokerName := feature.MakeRandomK8sName("broker") + sourceName := feature.MakeRandomK8sName("source") + sinkName := feature.MakeRandomK8sName("sink") + triggerName := feature.MakeRandomK8sName("trigger") + dlsName := feature.MakeRandomK8sName("dls") + dlsTriggerName := feature.MakeRandomK8sName("dls-trigger") + + eventToSend := test.FullEvent() + + // Install Broker + f.Setup("Install Broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Setup("Broker is ready", broker.IsReady(brokerName)) + f.Setup("Broker is addressable", broker.IsAddressable(brokerName)) + + // Install Sink + f.Setup("Install Sink", eventshub.Install(sinkName, eventshub.StartReceiverTLS)) + f.Setup("Install dead letter sink service", eventshub.Install(dlsName, eventshub.StartReceiverTLS)) + + // Install Trigger + f.Setup("Install trigger", func(ctx context.Context, t feature.T) { + subscriber := service.AsDestinationRef(sinkName) + subscriber.CACerts = eventshub.GetCaCerts(ctx) + + trigger.Install(triggerName, trigger.WithBrokerName(brokerName), + trigger.WithSubscriberFromDestination(subscriber))(ctx, t) + }) + f.Setup("Wait for Trigger to become ready", trigger.IsReady(triggerName)) + + f.Setup("Install failing trigger", func(ctx context.Context, t feature.T) { + dls := service.AsDestinationRef(dlsName) + dls.CACerts = eventshub.GetCaCerts(ctx) + + linear := eventingv1.BackoffPolicyLinear + trigger.Install(dlsTriggerName, trigger.WithBrokerName(brokerName), + trigger.WithRetry(2, &linear, pointer.String("PT1S")), + trigger.WithDeadLetterSinkFromDestination(dls), + trigger.WithSubscriber(nil, "http://127.0.0.1:2468"))(ctx, t) + }) + f.Setup("Wait for failing Trigger to become ready", trigger.IsReady(dlsTriggerName)) + + // Install Source + f.Requirement("Install Source", eventshub.Install( + sourceName, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(eventToSend), + )) + + f.Assert("Trigger delivers events to TLS subscriber", assert.OnStore(sinkName). + MatchReceivedEvent(test.HasId(eventToSend.ID())). + AtLeast(1)) + f.Assert("Trigger delivers events to TLS dead letter sink", assert.OnStore(dlsName). + MatchReceivedEvent(test.HasId(eventToSend.ID())). + AtLeast(1)) + + return f +} + +func TriggerWithTLSSubscriberTrustBundle() *feature.Feature { + f := feature.NewFeatureNamed("Trigger with TLS subscriber - trust bundle") + + f.Prerequisite("should not run when Istio is enabled", featureflags.IstioDisabled()) + + brokerName := feature.MakeRandomK8sName("broker") + sourceName := feature.MakeRandomK8sName("source") + sinkName := feature.MakeRandomK8sName("sink") + triggerName := feature.MakeRandomK8sName("trigger") + dlsName := feature.MakeRandomK8sName("dls") + dlsTriggerName := feature.MakeRandomK8sName("dls-trigger") + + eventToSend := test.FullEvent() + + // Install Broker + f.Setup("Install Broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + f.Setup("Broker is ready", broker.IsReady(brokerName)) + f.Setup("Broker is addressable", broker.IsAddressable(brokerName)) + + // Install Sink + f.Setup("Install Sink", eventshub.Install(sinkName, + eventshub.IssuerRef(eventingtlstesting.IssuerKind, eventingtlstesting.IssuerName), + eventshub.StartReceiverTLS, + )) + f.Setup("Install dead letter sink service", eventshub.Install(dlsName, + eventshub.IssuerRef(eventingtlstesting.IssuerKind, eventingtlstesting.IssuerName), + eventshub.StartReceiverTLS, + )) + + // Install Trigger + f.Setup("Install trigger", func(ctx context.Context, t feature.T) { + subscriber := &duckv1.Destination{ + URI: &apis.URL{ + Scheme: "https", // Force using https + Host: network.GetServiceHostname(sinkName, environment.FromContext(ctx).Namespace()), + }, + CACerts: nil, // CA certs are in the trust-bundle + } + + trigger.Install(triggerName, trigger.WithBrokerName(brokerName), + trigger.WithSubscriberFromDestination(subscriber))(ctx, t) + }) + f.Setup("Wait for Trigger to become ready", trigger.IsReady(triggerName)) + + f.Setup("Install failing trigger", func(ctx context.Context, t feature.T) { + dls := &duckv1.Destination{ + URI: &apis.URL{ + Scheme: "https", // Force using https + Host: network.GetServiceHostname(dlsName, environment.FromContext(ctx).Namespace()), + }, + CACerts: nil, // CA certs are in the trust-bundle + } + + linear := eventingv1.BackoffPolicyLinear + trigger.Install(dlsTriggerName, trigger.WithBrokerName(brokerName), + trigger.WithRetry(2, &linear, pointer.String("PT1S")), + trigger.WithDeadLetterSinkFromDestination(dls), + trigger.WithSubscriber(nil, "http://127.0.0.1:2468"))(ctx, t) + }) + f.Setup("Wait for failing Trigger to become ready", trigger.IsReady(dlsTriggerName)) + + // Install Source + f.Requirement("Install Source", eventshub.Install( + sourceName, + eventshub.StartSenderToResource(broker.GVR(), brokerName), + eventshub.InputEvent(eventToSend), + )) + + f.Assert("Trigger delivers events to TLS subscriber", assert.OnStore(sinkName). + MatchEvent(test.HasId(eventToSend.ID())). + Match(assert.MatchKind(eventshub.EventReceived)). + AtLeast(1)) + f.Assert("Trigger delivers events to TLS dead letter sink", assert.OnStore(dlsName). + MatchEvent(test.HasId(eventToSend.ID())). + Match(assert.MatchKind(eventshub.EventReceived)). + AtLeast(1)) + + return f +} diff --git a/vendor/knative.dev/eventing/test/rekt/features/trigger/trigger_sink_resolution.go b/vendor/knative.dev/eventing/test/rekt/features/trigger/trigger_sink_resolution.go new file mode 100644 index 0000000000..e8462481b7 --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/features/trigger/trigger_sink_resolution.go @@ -0,0 +1,184 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package trigger + +import ( + "context" + + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/feature" + + "knative.dev/eventing/test/rekt/resources/broker" + "knative.dev/eventing/test/rekt/resources/delivery" + "knative.dev/eventing/test/rekt/resources/trigger" +) + +// SourceToTriggerSinkWithDLS tests to see if a Ready Trigger with a DLS defined send +// failing events to it's DLS. +// +// source ---> broker --[trigger]--> bad uri +// +// | +// +--[DLS]--> sink +func SourceToTriggerSinkWithDLS() *feature.Feature { + f := feature.NewFeatureNamed("Trigger with DLS") + + triggerName := feature.MakeRandomK8sName("trigger") + brokerName := feature.MakeRandomK8sName("broker") + triggerSinkName := feature.MakeRandomK8sName("trigger-sink") + + prober := eventshub.NewProber() + prober.SetTargetResource(broker.GVR(), brokerName) + prober.SenderFullEvents(3) + + f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) + + // Setup Probes + f.Setup("install recorder", prober.ReceiverInstall(triggerSinkName)) + + // Setup trigger + f.Setup("install trigger", trigger.Install( + triggerName, + trigger.WithBrokerName(brokerName), + trigger.WithSubscriber(nil, "bad://uri"), + delivery.WithDeadLetterSink(prober.AsKReference(triggerSinkName), ""))) + + // Resources ready. + f.Setup("trigger goes ready", trigger.IsReady(triggerName)) + + // Install sender. + f.Requirement("install source", prober.SenderInstall("source")) + + // Assert events ended up where we expected. + f.Stable("trigger with DLS"). + Must("accepted all events", prober.AssertSentAll("source")). + Must("deliver event to DLS", prober.AssertReceivedAll("source", triggerSinkName)) + + return f +} + +// SourceToTriggerSinkWithDLSDontUseBrokers tests to see if a Ready Trigger sends +// failing events to it's DLS even when it's corresponding Ready Broker also have a DLS defined. +// +// source ---> broker --[trigger]--> bad uri +// +// | | +// +--[DLS] +--[DLS]--> sink +func SourceToTriggerSinkWithDLSDontUseBrokers() *feature.Feature { + f := feature.NewFeatureNamed("When Trigger DLS is defined, Broker DLS is ignored") + + triggerName := feature.MakeRandomK8sName("trigger") + brokerName := feature.MakeRandomK8sName("broker") + triggerSinkName := feature.MakeRandomK8sName("trigger-sink") + brokerSinkName := feature.MakeRandomK8sName("broker-sink") + + prober := eventshub.NewProber() + prober.SetTargetResource(broker.GVR(), brokerName) + prober.SenderFullEvents(3) + + // Setup Probes + f.Setup("install trigger recorder", prober.ReceiverInstall(triggerSinkName)) + f.Setup("install brokers recorder", prober.ReceiverInstall(brokerSinkName)) + + // Setup topology + brokerConfig := append( + broker.WithEnvConfig(), + delivery.WithDeadLetterSink(prober.AsKReference(brokerSinkName), "")) + f.Setup("install broker with DLS", broker.Install( + brokerName, + brokerConfig..., + )) + + f.Setup("install trigger", trigger.Install( + triggerName, + trigger.WithBrokerName(brokerName), + trigger.WithSubscriber(nil, "bad://uri"), + delivery.WithDeadLetterSink(prober.AsKReference(triggerSinkName), ""))) + + // Resources ready. + f.Setup("trigger goes ready", trigger.IsReady(triggerName)) + + // Install events after topology is ready. + f.Requirement("install source", prober.SenderInstall("source")) + + // Assert events ended up where we expected. + f.Stable("trigger with a valid DLS ref"). + Must("accept all events", prober.AssertSentAll("source")). + Must("deliver events to trigger DLS", prober.AssertReceivedAll("source", triggerSinkName)). + Must("not deliver events to its broker DLS", noEventsToDLS(prober, brokerSinkName)) + + return f +} + +// source ---> broker +--[trigger]--> bad uri +// +// | | +// | +--[trigger]--> sink +// | +// +--[DLQ]--> dlq +func BadTriggerDoesNotAffectOkTrigger() *feature.Feature { + f := feature.NewFeatureNamed("Bad Trigger does not affect good Trigger") + + prober := eventshub.NewProber() + brokerName := feature.MakeRandomK8sName("broker") + via1 := feature.MakeRandomK8sName("via") + via2 := feature.MakeRandomK8sName("via") + dlq := feature.MakeRandomK8sName("dlq") + sink := feature.MakeRandomK8sName("sink") + source := feature.MakeRandomK8sName("source") + + prober.SenderFullEvents(3) + + // Setup Probes + f.Setup("install dlq", prober.ReceiverInstall(dlq)) + f.Setup("install sink2", prober.ReceiverInstall(sink)) + + // Setup data plane + brokerConfig := append(broker.WithEnvConfig(), delivery.WithDeadLetterSink(prober.AsKReference(dlq), "")) + f.Setup("install broker", broker.Install(brokerName, brokerConfig...)) + // Block till broker is ready + f.Setup("Broker is ready", broker.IsReady(brokerName)) + prober.SetTargetResource(broker.GVR(), brokerName) + + f.Setup("install trigger via1", trigger.Install(via1, trigger.WithBrokerName(brokerName), trigger.WithSubscriber(nil, "bad://uri"))) + f.Setup("install trigger via2", trigger.Install(via2, trigger.WithBrokerName(brokerName), trigger.WithSubscriber(prober.AsKReference(sink), ""))) + + // Resources ready. + f.Setup("trigger1 goes ready", trigger.IsReady(via1)) + f.Setup("trigger2 goes ready", trigger.IsReady(via2)) + + // Install events after data plane is ready. + f.Requirement("install source", prober.SenderInstall(source)) + + // Assert events ended up where we expected. + f.Stable("broker with DLQ"). + Must("accepted all events", prober.AssertSentAll(source)). + Must("deliver event to DLQ (via1)", prober.AssertReceivedAll(source, dlq)). + Must("deliver event to sink (via2)", prober.AssertReceivedAll(source, sink)) + + return f +} + +func noEventsToDLS(prober *eventshub.EventProber, sinkName string) feature.StepFn { + return func(ctx context.Context, t feature.T) { + if len(prober.ReceivedBy(ctx, sinkName)) == 0 { + t.Log("no events were sent to %s DLS", sinkName) + } else { + t.Errorf("events were received by %s DLS", sinkName) + } + } +} diff --git a/vendor/knative.dev/eventing/test/rekt/resources/broker/broker.go b/vendor/knative.dev/eventing/test/rekt/resources/broker/broker.go new file mode 100644 index 0000000000..81c170ad0d --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/resources/broker/broker.go @@ -0,0 +1,289 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package broker + +import ( + "context" + "embed" + "fmt" + "log" + "os" + "time" + + "github.com/kelseyhightower/envconfig" + "go.uber.org/multierr" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/wait" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/k8s" + "knative.dev/reconciler-test/pkg/manifest" + + eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" + eventingclient "knative.dev/eventing/pkg/client/injection/client" + "knative.dev/eventing/test/rekt/resources/addressable" + "knative.dev/eventing/test/rekt/resources/delivery" +) + +//go:embed *.yaml +var yaml embed.FS + +var EnvCfg EnvConfig + +type EnvConfig struct { + BrokerClass string `envconfig:"BROKER_CLASS" default:"MTChannelBasedBroker" required:"true"` + BrokerTemplatesDir string `envconfig:"BROKER_TEMPLATES"` +} + +func init() { + // Process EventingGlobal. + if err := envconfig.Process("", &EnvCfg); err != nil { + log.Fatal("Failed to process env var", err) + } +} + +func WithEnvConfig() []manifest.CfgFn { + cfg := []manifest.CfgFn{WithBrokerClass(EnvCfg.BrokerClass)} + + if EnvCfg.BrokerTemplatesDir != "" { + cfg = append(cfg, WithBrokerTemplateFiles(EnvCfg.BrokerTemplatesDir)) + } + return cfg +} + +func GVR() schema.GroupVersionResource { + return schema.GroupVersionResource{Group: "eventing.knative.dev", Version: "v1", Resource: "brokers"} +} + +// WithBrokerClass adds the broker class config to a Broker spec. +func WithBrokerClass(class string) manifest.CfgFn { + return func(cfg map[string]interface{}) { + cfg["brokerClass"] = class + } +} + +// WithAnnotations adds annotations to the broker +func WithAnnotations(annotations map[string]interface{}) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if annotations != nil { + cfg["annotations"] = annotations + } + } +} + +func WithBrokerTemplateFiles(dir string) manifest.CfgFn { + return func(cfg map[string]interface{}) { + cfg["__brokerTemplateDir"] = dir + } +} + +// WithConfig adds the specified config map to the Broker spec. +func WithConfig(name string) manifest.CfgFn { + return func(templateData map[string]interface{}) { + cfg := make(map[string]interface{}) + cfg["kind"] = "ConfigMap" + cfg["apiVersion"] = "v1" + cfg["name"] = name + templateData["config"] = cfg + } +} + +func WithNamespace(namespace string) manifest.CfgFn { + return func(cfg map[string]interface{}) { + cfg["namespace"] = namespace + } +} + +// WithConfigNamespace adds the specified config map namespace to the Broker spec. +func WithConfigNamespace(namespace string) manifest.CfgFn { + return func(cfg map[string]interface{}) { + cfg["configNamespace"] = namespace + } +} + +// WithDeadLetterSink adds the dead letter sink related config to a Broker spec. +var WithDeadLetterSink = delivery.WithDeadLetterSink + +// WithRetry adds the retry related config to a Broker spec. +var WithRetry = delivery.WithRetry + +// WithTimeout adds the timeout related config to the config. +var WithTimeout = delivery.WithTimeout + +// Install will create a Broker resource, augmented with the config fn options. +func Install(name string, opts ...manifest.CfgFn) feature.StepFn { + cfg := map[string]interface{}{ + "name": name, + } + for _, fn := range opts { + fn(cfg) + } + + if dir, ok := cfg["__brokerTemplateDir"]; ok { + return func(ctx context.Context, t feature.T) { + if _, err := manifest.InstallYamlFS(ctx, os.DirFS(dir.(string)), cfg); err != nil { + t.Fatal(err) + } + } + } + return func(ctx context.Context, t feature.T) { + if _, err := manifest.InstallYamlFS(ctx, yaml, cfg); err != nil { + t.Fatal(err) + } + } +} + +// IsReady tests to see if a Broker becomes ready within the time given. +func IsReady(name string, timing ...time.Duration) feature.StepFn { + return k8s.IsReady(GVR(), name, timing...) +} + +// IsNotReady tests to see if a Broker becomes NotReady within the time given. +func IsNotReady(name string, timing ...time.Duration) feature.StepFn { + return k8s.IsNotReady(GVR(), name, timing...) +} + +// IsAddressable tests to see if a Broker becomes addressable within the time +// given. +func IsAddressable(name string, timings ...time.Duration) feature.StepFn { + return k8s.IsAddressable(GVR(), name, timings...) +} + +// ValidateAddress validates the address retured by Address +func ValidateAddress(name string, validate addressable.ValidateAddressFn, timings ...time.Duration) feature.StepFn { + return addressable.ValidateAddress(GVR(), name, validate, timings...) +} + +// Address returns a broker's address. +func Address(ctx context.Context, name string, timings ...time.Duration) (*duckv1.Addressable, error) { + return addressable.Address(ctx, GVR(), name, timings...) +} + +type Condition struct { + Name string + Condition func(br eventingv1.Broker) (bool, error) +} + +func (c Condition) And(other Condition) Condition { + return c.compose(other, func(c1, c2 bool) bool { return c1 && c2 }) +} + +func (c Condition) compose(other Condition, combineFunc func(c1, c2 bool) bool) Condition { + return Condition{ + Name: c.Name + " + " + other.Name, + Condition: func(br eventingv1.Broker) (bool, error) { + c1, err1 := c.Condition(br) + c2, err2 := other.Condition(br) + return combineFunc(c1, c2), multierr.Append(err1, err2) + }, + } +} + +func WaitForCondition(name string, condition Condition, timing ...time.Duration) feature.StepFn { + return func(ctx context.Context, t feature.T) { + env := environment.FromContext(ctx) + interval, timeout := k8s.PollTimings(ctx, timing) + var lastErr error + var lastBroker *eventingv1.Broker + err := wait.PollUntilContextTimeout(ctx, interval, timeout, true, func(ctx context.Context) (done bool, err error) { + br, err := eventingclient.Get(ctx). + EventingV1(). + Brokers(env.Namespace()). + Get(ctx, name, metav1.GetOptions{}) + if err != nil { + lastErr = err + return false, nil + } + + lastBroker = br + return condition.Condition(*br) + }) + if err != nil { + t.Fatalf("failed to verify condition %s %v: %v\n%+v\n", condition.Name, err, lastErr, lastBroker) + } + } +} + +func HasDelivery() Condition { + return Condition{ + Name: "has delivery", + Condition: func(br eventingv1.Broker) (bool, error) { + return br.Spec.Delivery != nil, nil + }, + } +} + +func HasDeliveryRetry() Condition { + return Condition{ + Name: "has delivery retry", + Condition: func(br eventingv1.Broker) (bool, error) { + return br.Spec.Delivery != nil && + br.Spec.Delivery.Retry != nil && + *br.Spec.Delivery.Retry > 0, nil + }, + } +} + +func HasDeliveryBackoffDelay() Condition { + return Condition{ + Name: "has delivery backoff delay", + Condition: func(br eventingv1.Broker) (bool, error) { + return br.Spec.Delivery != nil && + br.Spec.Delivery.BackoffDelay != nil && + len(*br.Spec.Delivery.BackoffDelay) > 0, nil + }, + } +} + +func HasDeliveryBackoffPolicy() Condition { + return Condition{ + Name: "has delivery backoff policy", + Condition: func(br eventingv1.Broker) (bool, error) { + return br.Spec.Delivery != nil && + br.Spec.Delivery.BackoffPolicy != nil && + len(*br.Spec.Delivery.BackoffPolicy) > 0, nil + }, + } +} + +func AsDestinationRef(name string) *duckv1.Destination { + return &duckv1.Destination{ + Ref: AsKReference(name), + } +} + +// AsKReference returns a KReference for a Broker without namespace. +func AsKReference(name string) *duckv1.KReference { + return &duckv1.KReference{ + Kind: "Broker", + Name: name, + APIVersion: "eventing.knative.dev/v1", + } +} + +func InstallMTBroker(name string) *feature.Feature { + f := feature.NewFeatureNamed("Multi-tenant channel-based broker") + f.Setup(fmt.Sprintf("Install broker %q", name), Install(name, WithEnvConfig()...)) + f.Requirement("Broker is ready", IsReady(name)) + return f +} + +func InstallMTBrokerStepFn(brokerName string) feature.StepFn { + return Install(brokerName, WithEnvConfig()...) +} diff --git a/vendor/knative.dev/eventing/test/rekt/resources/broker/broker.yaml b/vendor/knative.dev/eventing/test/rekt/resources/broker/broker.yaml new file mode 100644 index 0000000000..ec73900e5b --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/resources/broker/broker.yaml @@ -0,0 +1,77 @@ +# Copyright 2020 The Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: eventing.knative.dev/v1 +kind: Broker +metadata: + name: {{ .name }} + namespace: {{ .namespace }} + {{ if or .brokerClass .annotations }} + annotations: + {{ if .brokerClass }} + eventing.knative.dev/broker.class: {{ .brokerClass }} + {{ end }} + {{ if .annotations }} + {{ range $key, $value := .annotations }} + {{ $key }}: {{ $value }} + {{ end }} + {{ end }} + {{ end }} +spec: + {{ if .config }} + config: + kind: {{ .config.kind }} + {{ if .configNamespace }} + namespace: {{ .configNamespace }} + {{ else }} + namespace: {{ .namespace }} + {{ end }} + name: {{ .config.name }} + apiVersion: {{ .config.apiVersion }} + {{ end }} + {{ if .delivery }} + delivery: + {{ if .delivery.timeout }} + timeout: {{ .delivery.timeout }} + {{ end }} + {{ if .delivery.deadLetterSink }} + deadLetterSink: + {{ if .delivery.deadLetterSink.ref }} + ref: + kind: {{ .delivery.deadLetterSink.ref.kind }} + namespace: {{ .namespace }} + name: {{ .delivery.deadLetterSink.ref.name }} + apiVersion: {{ .delivery.deadLetterSink.ref.apiVersion }} + {{ end }} + {{ if .delivery.deadLetterSink.uri }} + uri: {{ .delivery.deadLetterSink.uri }} + {{ end }} + {{ if .delivery.deadLetterSink.CACerts }} + CACerts: |- + {{ .delivery.deadLetterSink.CACerts }} + {{ end }} + {{ if .delivery.deadLetterSink.audience }} + audience: {{ .delivery.deadLetterSink.audience }} + {{ end }} + {{ end }} + {{ if .delivery.retry }} + retry: {{ .delivery.retry}} + {{ end }} + {{ if .delivery.backoffPolicy }} + backoffPolicy: {{ .delivery.backoffPolicy}} + {{ end }} + {{ if .delivery.backoffDelay }} + backoffDelay: "{{ .delivery.backoffDelay}}" + {{ end }} + {{ end }} diff --git a/vendor/knative.dev/eventing/test/rekt/resources/pingsource/pingsource.go b/vendor/knative.dev/eventing/test/rekt/resources/pingsource/pingsource.go new file mode 100644 index 0000000000..492a570f67 --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/resources/pingsource/pingsource.go @@ -0,0 +1,129 @@ +/* +Copyright 2021 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package pingsource + +import ( + "context" + "embed" + "strings" + "time" + + "k8s.io/apimachinery/pkg/runtime/schema" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/reconciler-test/pkg/k8s" + + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/manifest" +) + +//go:embed *.yaml +var yaml embed.FS + +func Gvr() schema.GroupVersionResource { + return schema.GroupVersionResource{Group: "sources.knative.dev", Version: "v1", Resource: "pingsources"} +} + +// Install will create a Broker resource, augmented with the config fn options. +func Install(name string, opts ...manifest.CfgFn) feature.StepFn { + cfg := map[string]interface{}{ + "name": name, + } + for _, fn := range opts { + fn(cfg) + } + return func(ctx context.Context, t feature.T) { + if _, err := manifest.InstallYamlFS(ctx, yaml, cfg); err != nil { + t.Fatal(err, cfg) + } + } +} + +// IsReady tests to see if a PingSource becomes ready within the time given. +func IsReady(name string, timings ...time.Duration) feature.StepFn { + return k8s.IsReady(Gvr(), name, timings...) +} + +// WithSink adds the sink related config to a PingSource spec. +func WithSink(dest *duckv1.Destination) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if _, set := cfg["sink"]; !set { + cfg["sink"] = map[string]interface{}{} + } + sink := cfg["sink"].(map[string]interface{}) + + uri := dest.URI + ref := dest.Ref + + if dest.CACerts != nil { + // This is a multi-line string and should be indented accordingly. + // Replace "new line" with "new line + spaces". + sink["CACerts"] = strings.ReplaceAll(*dest.CACerts, "\n", "\n ") + } + if dest.Audience != nil { + sink["audience"] = *dest.Audience + } + if uri != nil { + sink["uri"] = uri.String() + } + if ref != nil { + if _, set := sink["ref"]; !set { + sink["ref"] = map[string]interface{}{} + } + sref := sink["ref"].(map[string]interface{}) + sref["apiVersion"] = ref.APIVersion + sref["kind"] = ref.Kind + if ref.Namespace != "" { + sref["namespace"] = ref.Namespace + } + sref["name"] = ref.Name + } + + } +} + +// WithData adds the contentType and data config to a PingSource spec. +func WithData(contentType, data string) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if contentType != "" { + cfg["contentType"] = contentType + } + if data != "" { + cfg["data"] = data + } + } +} + +// WithDataBase64 adds the contentType and dataBase64 config to a PingSource spec. +func WithDataBase64(contentType, dataBase64 string) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if contentType != "" { + cfg["contentType"] = contentType + } + if dataBase64 != "" { + cfg["dataBase64"] = dataBase64 + } + } +} + +// WithSchedule add the schedule config to a Pingsource spec. +func WithSchedule(schedule string) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if schedule != "" { + cfg["schedule"] = schedule + } + } +} diff --git a/vendor/knative.dev/eventing/test/rekt/resources/pingsource/pingsource.yaml b/vendor/knative.dev/eventing/test/rekt/resources/pingsource/pingsource.yaml new file mode 100644 index 0000000000..1653eaaa27 --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/resources/pingsource/pingsource.yaml @@ -0,0 +1,56 @@ +# Copyright 2021 The Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: sources.knative.dev/v1 +kind: PingSource +metadata: + name: {{ .name }} + namespace: {{ .namespace }} +spec: + {{ if .schedule }} + schedule: '{{ .schedule }}' + {{ end }} + {{ if .contentType }} + contentType: '{{ .contentType }}' + {{ end }} + {{ if .data }} + data: '{{ .data }}' + {{ end }} + {{ if .dataBase64 }} + dataBase64: '{{ .dataBase64 }}' + {{ end }} + {{if .sink }} + sink: + {{ if .sink.ref }} + ref: + kind: {{ .sink.ref.kind }} + {{ if .sink.ref.namespace }} + namespace: {{ .sink.ref.namespace }} + {{ else }} + namespace: {{ .namespace }} + {{ end }} + name: {{ .sink.ref.name }} + apiVersion: {{ .sink.ref.apiVersion }} + {{ end }} + {{ if .sink.uri }} + uri: {{ .sink.uri }} + {{ end }} + {{ if .sink.CACerts }} + CACerts: |- + {{ .sink.CACerts }} + {{ end }} + {{if .sink.audience }} + audience: {{ .sink.audience}} + {{ end }} + {{ end }} diff --git a/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go new file mode 100644 index 0000000000..78f3ba62e8 --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go @@ -0,0 +1,252 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package trigger + +import ( + "context" + "embed" + "encoding/json" + "strings" + "time" + + "k8s.io/apimachinery/pkg/runtime/schema" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/k8s" + "knative.dev/reconciler-test/pkg/manifest" + "sigs.k8s.io/yaml" + + eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" + + "knative.dev/eventing/test/rekt/resources/delivery" +) + +//go:embed *.yaml +var yamlEmbed embed.FS + +func GVR() schema.GroupVersionResource { + return schema.GroupVersionResource{Group: "eventing.knative.dev", Version: "v1", Resource: "triggers"} +} + +// WithFilter adds the filter related config to a Trigger spec. +func WithFilter(attributes map[string]string) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if _, set := cfg["filter"]; !set { + cfg["filter"] = map[string]interface{}{} + } + filter := cfg["filter"].(map[string]interface{}) + if _, set := filter["filter"]; !set { + filter["attributes"] = map[string]interface{}{} + } + attrs := filter["attributes"].(map[string]interface{}) + + for k, v := range attributes { + attrs[k] = v + } + } +} + +// WithSubscriber adds the subscriber related config to a Trigger spec. +func WithSubscriber(ref *duckv1.KReference, uri string) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if _, set := cfg["subscriber"]; !set { + cfg["subscriber"] = map[string]interface{}{} + } + subscriber := cfg["subscriber"].(map[string]interface{}) + + if uri != "" { + subscriber["uri"] = uri + } + if ref != nil { + if _, set := subscriber["ref"]; !set { + subscriber["ref"] = map[string]interface{}{} + } + sref := subscriber["ref"].(map[string]interface{}) + sref["apiVersion"] = ref.APIVersion + sref["kind"] = ref.Kind + // skip namespace + sref["name"] = ref.Name + } + } +} + +// WithSubscriberFromDestination adds the subscriber related config to a Trigger spec. +func WithSubscriberFromDestination(dest *duckv1.Destination) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if _, set := cfg["subscriber"]; !set { + cfg["subscriber"] = map[string]interface{}{} + } + subscriber := cfg["subscriber"].(map[string]interface{}) + + uri := dest.URI + ref := dest.Ref + + if dest.CACerts != nil { + // This is a multi-line string and should be indented accordingly. + // Replace "new line" with "new line + spaces". + subscriber["CACerts"] = strings.ReplaceAll(*dest.CACerts, "\n", "\n ") + } + + if dest.Audience != nil { + subscriber["audience"] = *dest.Audience + } + + if uri != nil { + subscriber["uri"] = uri.String() + } + if ref != nil { + if _, set := subscriber["ref"]; !set { + subscriber["ref"] = map[string]interface{}{} + } + sref := subscriber["ref"].(map[string]interface{}) + sref["apiVersion"] = ref.APIVersion + sref["kind"] = ref.Kind + // skip namespace + sref["name"] = ref.Name + } + } +} + +// WithAnnotations adds annotations to the trigger +func WithAnnotations(annotations map[string]interface{}) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if _, set := cfg["annotations"]; !set { + cfg["annotations"] = map[string]string{} + } + + if annotations != nil { + annotation := cfg["annotations"].(map[string]string) + for k, v := range annotations { + annotation[k] = v.(string) + } + } + } +} + +// WithExtensions adds the ceOverrides related config to a ContainerSource spec. +func WithExtensions(extensions map[string]interface{}) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if _, set := cfg["ceOverrides"]; !set { + cfg["ceOverrides"] = map[string]interface{}{} + } + ceOverrides := cfg["ceOverrides"].(map[string]interface{}) + + if extensions != nil { + if _, set := ceOverrides["extensions"]; !set { + ceOverrides["extensions"] = map[string]interface{}{} + } + ceExt := ceOverrides["extensions"].(map[string]interface{}) + for k, v := range extensions { + ceExt[k] = v + } + } + } +} + +func WithBrokerName(brokerName string) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if brokerName != "" { + cfg["brokerName"] = brokerName + } + } +} + +// WithBrokerRef adds the brokerRef related config to a Trigger spec. +func WithBrokerRef(ref *duckv1.KReference) manifest.CfgFn { + return func(cfg map[string]interface{}) { + if _, set := cfg["brokerRef"]; !set { + cfg["brokerRef"] = map[string]interface{}{} + } + brokerRef := cfg["brokerRef"].(map[string]interface{}) + + if ref != nil { + brokerRef["apiVersion"] = ref.APIVersion + brokerRef["kind"] = ref.Kind + brokerRef["name"] = ref.Name + brokerRef["namespace"] = ref.Namespace + } + + cfg["brokerRef"] = brokerRef + } +} + +// WithDeadLetterSink adds the dead letter sink related config to a Trigger spec. +var WithDeadLetterSink = delivery.WithDeadLetterSink + +// WithDeadLetterSinkFromDestination adds the dead letter sink related config to the config. +var WithDeadLetterSinkFromDestination = delivery.WithDeadLetterSinkFromDestination + +// WithRetry adds the retry related config to a Trigger spec. +var WithRetry = delivery.WithRetry + +// WithTimeout adds the timeout related config to the config. +var WithTimeout = delivery.WithTimeout + +// WithFormat adds the format related config to a Trigger spec +var WithFormat = delivery.WithFormat + +// Install will create a Trigger resource, augmented with the config fn options. +func Install(name string, opts ...manifest.CfgFn) feature.StepFn { + cfg := map[string]interface{}{ + "name": name, + } + for _, fn := range opts { + fn(cfg) + } + return func(ctx context.Context, t feature.T) { + if _, err := manifest.InstallYamlFS(ctx, yamlEmbed, cfg); err != nil { + t.Fatal(err) + } + } +} + +// IsReady tests to see if a Trigger becomes ready within the time given. +func IsReady(name string, timing ...time.Duration) feature.StepFn { + return k8s.IsReady(GVR(), name, timing...) +} + +func WithNewFilters(filters []eventingv1.SubscriptionsAPIFilter) manifest.CfgFn { + jsonBytes, err := json.Marshal(filters) + if err != nil { + panic(err) + } + + yamlBytes, err := yaml.JSONToYAML(jsonBytes) + if err != nil { + panic(err) + } + + filtersYaml := string(yamlBytes) + + lines := strings.Split(filtersYaml, "\n") + out := make([]string, 0, len(lines)) + for i := range lines { + out = append(out, " "+lines[i]) + } + + return func(m map[string]interface{}) { + m["filters"] = strings.Join(out, "\n") + } +} + +func AsKReference(name string) *duckv1.KReference { + return &duckv1.KReference{ + Kind: "Trigger", + Name: name, + APIVersion: "eventing.knative.dev/v1", + } +} diff --git a/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml new file mode 100644 index 0000000000..b7825ffb5d --- /dev/null +++ b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml @@ -0,0 +1,102 @@ +# Copyright 2020 The Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: eventing.knative.dev/v1 +kind: Trigger +metadata: + name: {{ .name }} + namespace: {{ .namespace }} + {{ if .annotations }} + annotations: + {{ range $key, $value := .annotations }} + {{ $key }}: '{{ $value }}' + {{ end }} + {{ end }} +spec: + {{ if .brokerName }} + broker: {{ .brokerName }} + {{ end }} + {{ if .brokerRef }} + brokerRef: + kind: {{ .brokerRef.kind }} + namespace: {{ .brokerRef.namespace }} + name: {{ .brokerRef.name }} + apiVersion: {{ .brokerRef.apiVersion }} + {{ end }} + {{ if .filter }} + filter: + attributes: + {{ range $key, $value := .filter.attributes }} + {{ $key }}: "{{ $value }}" + {{ end }} + {{ end }} + {{ if .filters }} + filters: +{{ .filters }} + {{ end }} + {{ if .subscriber }} + subscriber: + {{ if .subscriber.ref }} + ref: + kind: {{ .subscriber.ref.kind }} + namespace: {{ .namespace }} + name: {{ .subscriber.ref.name }} + apiVersion: {{ .subscriber.ref.apiVersion }} + {{ end }} + {{ if .subscriber.uri }} + uri: {{ .subscriber.uri }} + {{ end }} + {{ if .subscriber.CACerts }} + CACerts: |- + {{ .subscriber.CACerts }} + {{ end }} + {{ if .subscriber.audience }} + audience: {{ .subscriber.audience }} + {{ end }} + {{ end }} + {{ if .delivery }} + delivery: + {{ if .delivery.timeout }} + timeout: {{ .delivery.timeout }} + {{ end }} + {{ if .delivery.deadLetterSink }} + deadLetterSink: + {{ if .delivery.deadLetterSink.ref }} + ref: + kind: {{ .delivery.deadLetterSink.ref.kind }} + namespace: {{ .namespace }} + name: {{ .delivery.deadLetterSink.ref.name }} + apiVersion: {{ .delivery.deadLetterSink.ref.apiVersion }} + {{ end }} + {{ if .delivery.deadLetterSink.uri }} + uri: {{ .delivery.deadLetterSink.uri }} + {{ end }} + {{ if .delivery.deadLetterSink.CACerts }} + CACerts: |- + {{ .delivery.deadLetterSink.CACerts }} + {{ end }} + {{ end }} + {{ if .delivery.retry }} + retry: {{ .delivery.retry}} + {{ end }} + {{ if .delivery.backoffPolicy }} + backoffPolicy: {{ .delivery.backoffPolicy}} + {{ end }} + {{ if .delivery.backoffDelay }} + backoffDelay: "{{ .delivery.backoffDelay}}" + {{ end }} + {{ if .delivery.format }} + format: {{ .delivery.format }} + {{ end }} + {{ end }} diff --git a/vendor/knative.dev/eventing/test/upgrade/upgrade.go b/vendor/knative.dev/eventing/test/upgrade/upgrade.go index 6d00a4f6c6..cc9b6bf29f 100644 --- a/vendor/knative.dev/eventing/test/upgrade/upgrade.go +++ b/vendor/knative.dev/eventing/test/upgrade/upgrade.go @@ -23,7 +23,10 @@ import ( "sync" "testing" + "knative.dev/eventing/pkg/apis/eventing" + brokerfeatures "knative.dev/eventing/test/rekt/features/broker" "knative.dev/eventing/test/rekt/features/channel" + brokerresources "knative.dev/eventing/test/rekt/resources/broker" "knative.dev/eventing/test/rekt/resources/channel_impl" "knative.dev/eventing/test/rekt/resources/subscription" duckv1 "knative.dev/pkg/apis/duck/v1" @@ -37,7 +40,16 @@ import ( "knative.dev/reconciler-test/pkg/manifest" ) -var channelConfigMux = &sync.Mutex{} +var ( + channelConfigMux = &sync.Mutex{} + brokerConfigMux = &sync.Mutex{} + opts = []environment.EnvOpts{ + knative.WithKnativeNamespace(system.Namespace()), + knative.WithLoggingConfig, + knative.WithTracingConfig, + k8s.WithEventListener, + } +) // RunMainTest expects flags to be already initialized. // This function needs to be exposed, so that test cases in other repositories can call the upgrade @@ -63,7 +75,7 @@ type DurableFeature struct { EnvOpts []environment.EnvOpts setupEnv environment.Environment setupCtx context.Context - VerifyF *feature.Feature + VerifyF func() *feature.Feature Global environment.GlobalEnvironment } @@ -83,14 +95,14 @@ func (fe *DurableFeature) Setup(label string) pkgupgrade.Operation { func (fe *DurableFeature) Verify(label string) pkgupgrade.Operation { return pkgupgrade.NewOperation(label, func(c pkgupgrade.Context) { c.T.Parallel() - fe.setupEnv.Test(fe.setupCtx, c.T, fe.VerifyF) + fe.setupEnv.Test(fe.setupCtx, c.T, fe.VerifyF()) }) } func (fe *DurableFeature) VerifyAndTeardown(label string) pkgupgrade.Operation { return pkgupgrade.NewOperation(label, func(c pkgupgrade.Context) { c.T.Parallel() - fe.setupEnv.Test(fe.setupCtx, c.T, fe.VerifyF) + fe.setupEnv.Test(fe.setupCtx, c.T, fe.VerifyF()) // Ensures teardown of resources/namespace. fe.setupEnv.Finish() }) @@ -103,7 +115,7 @@ func (fe *DurableFeature) SetupVerifyAndTeardown(label string) pkgupgrade.Operat append(fe.EnvOpts, environment.Managed(c.T))..., ) env.Test(ctx, c.T, fe.SetupF) - env.Test(ctx, c.T, fe.VerifyF) + env.Test(ctx, c.T, fe.VerifyF()) }) } @@ -290,14 +302,29 @@ func InMemoryChannelFeature(glob environment.GlobalEnvironment) *DurableFeature setupF := feature.NewFeature() sink, ch := channel.ChannelChainSetup(setupF, 1, createSubscriberFn) - verifyF := feature.NewFeature() - channel.ChannelChainAssert(verifyF, sink, ch) + verifyF := func() *feature.Feature { + f := feature.NewFeatureNamed(setupF.Name) + channel.ChannelChainAssert(f, sink, ch) + return f + } - opts := []environment.EnvOpts{ - knative.WithKnativeNamespace(system.Namespace()), - knative.WithLoggingConfig, - knative.WithTracingConfig, - k8s.WithEventListener, + return &DurableFeature{SetupF: setupF, VerifyF: verifyF, Global: glob, EnvOpts: opts} +} + +func BrokerEventTransformationForTrigger(glob environment.GlobalEnvironment, +) *DurableFeature { + // Prevent race conditions on EnvCfg.BrokerClass when running tests in parallel. + brokerConfigMux.Lock() + defer brokerConfigMux.Unlock() + brokerresources.EnvCfg.BrokerClass = eventing.MTChannelBrokerClassValue + + setupF := feature.NewFeature() + cfg := brokerfeatures.BrokerEventTransformationForTriggerSetup(setupF) + + verifyF := func() *feature.Feature { + f := feature.NewFeatureNamed(setupF.Name) + brokerfeatures.BrokerEventTransformationForTriggerAssert(f, cfg) + return f } return &DurableFeature{SetupF: setupF, VerifyF: verifyF, Global: glob, EnvOpts: opts} diff --git a/vendor/modules.txt b/vendor/modules.txt index 693a1047df..89a730475d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -574,8 +574,8 @@ golang.org/x/crypto/openpgp/s2k golang.org/x/crypto/pbkdf2 golang.org/x/crypto/pkcs12 golang.org/x/crypto/pkcs12/internal/rc2 -# golang.org/x/mod v0.20.0 -## explicit; go 1.18 +# golang.org/x/mod v0.21.0 +## explicit; go 1.22.0 golang.org/x/mod/internal/lazyregexp golang.org/x/mod/module golang.org/x/mod/semver @@ -627,8 +627,8 @@ golang.org/x/text/unicode/norm # golang.org/x/time v0.6.0 ## explicit; go 1.18 golang.org/x/time/rate -# golang.org/x/tools v0.24.0 -## explicit; go 1.19 +# golang.org/x/tools v0.25.0 +## explicit; go 1.22.0 golang.org/x/tools/go/ast/astutil golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/packages @@ -690,7 +690,7 @@ google.golang.org/genproto/googleapis/api/httpbody google.golang.org/genproto/googleapis/rpc/code google.golang.org/genproto/googleapis/rpc/errdetails google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.66.0 +# google.golang.org/grpc v1.66.2 ## explicit; go 1.21 google.golang.org/grpc google.golang.org/grpc/attributes @@ -1362,11 +1362,11 @@ k8s.io/utils/pointer k8s.io/utils/ptr k8s.io/utils/strings/slices k8s.io/utils/trace -# knative.dev/caching v0.0.0-20240909014459-1bbe214d75e7 +# knative.dev/caching v0.0.0-20240917105744-d1191d7426a6 ## explicit; go 1.22.0 knative.dev/caching/pkg/apis/caching knative.dev/caching/pkg/apis/caching/v1alpha1 -# knative.dev/eventing v0.42.1-0.20240911141024-c91a9d8a471d +# knative.dev/eventing v0.42.1-0.20240917082247-e79f3b65893a ## explicit; go 1.22.0 knative.dev/eventing/cmd/heartbeats knative.dev/eventing/pkg/apis @@ -1406,36 +1406,9 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1 knative.dev/eventing/pkg/client/clientset/versioned/typed/sinks/v1alpha1 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2 -knative.dev/eventing/pkg/client/informers/externalversions -knative.dev/eventing/pkg/client/informers/externalversions/eventing -knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1 -knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1alpha1 -knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta1 -knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta2 -knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta3 -knative.dev/eventing/pkg/client/informers/externalversions/flows -knative.dev/eventing/pkg/client/informers/externalversions/flows/v1 -knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces -knative.dev/eventing/pkg/client/informers/externalversions/messaging -knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1 -knative.dev/eventing/pkg/client/informers/externalversions/sinks -knative.dev/eventing/pkg/client/informers/externalversions/sinks/v1alpha1 -knative.dev/eventing/pkg/client/informers/externalversions/sources -knative.dev/eventing/pkg/client/informers/externalversions/sources/v1 -knative.dev/eventing/pkg/client/informers/externalversions/sources/v1beta2 knative.dev/eventing/pkg/client/injection/client -knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy -knative.dev/eventing/pkg/client/injection/informers/factory -knative.dev/eventing/pkg/client/listers/eventing/v1 knative.dev/eventing/pkg/client/listers/eventing/v1alpha1 -knative.dev/eventing/pkg/client/listers/eventing/v1beta1 knative.dev/eventing/pkg/client/listers/eventing/v1beta2 -knative.dev/eventing/pkg/client/listers/eventing/v1beta3 -knative.dev/eventing/pkg/client/listers/flows/v1 -knative.dev/eventing/pkg/client/listers/messaging/v1 -knative.dev/eventing/pkg/client/listers/sinks/v1alpha1 -knative.dev/eventing/pkg/client/listers/sources/v1 -knative.dev/eventing/pkg/client/listers/sources/v1beta2 knative.dev/eventing/pkg/crossnamespace knative.dev/eventing/pkg/duck knative.dev/eventing/pkg/eventfilter @@ -1454,16 +1427,21 @@ knative.dev/eventing/test/lib/duck knative.dev/eventing/test/lib/resources knative.dev/eventing/test/lib/sender knative.dev/eventing/test/rekt/features +knative.dev/eventing/test/rekt/features/broker knative.dev/eventing/test/rekt/features/channel knative.dev/eventing/test/rekt/features/featureflags knative.dev/eventing/test/rekt/features/knconf +knative.dev/eventing/test/rekt/features/trigger knative.dev/eventing/test/rekt/resources/account_role knative.dev/eventing/test/rekt/resources/addressable +knative.dev/eventing/test/rekt/resources/broker knative.dev/eventing/test/rekt/resources/channel knative.dev/eventing/test/rekt/resources/channel_impl knative.dev/eventing/test/rekt/resources/containersource knative.dev/eventing/test/rekt/resources/delivery +knative.dev/eventing/test/rekt/resources/pingsource knative.dev/eventing/test/rekt/resources/subscription +knative.dev/eventing/test/rekt/resources/trigger knative.dev/eventing/test/test_images knative.dev/eventing/test/upgrade knative.dev/eventing/test/upgrade/prober @@ -1478,7 +1456,7 @@ knative.dev/eventing/test/upgrade/prober/wathola/sender # knative.dev/hack v0.0.0-20240909014011-fc6a8452af6d ## explicit; go 1.21 knative.dev/hack -# knative.dev/networking v0.0.0-20240909015032-433920a35ef4 +# knative.dev/networking v0.0.0-20240912132036-ed319d7a8e69 ## explicit; go 1.22.0 knative.dev/networking/pkg knative.dev/networking/pkg/apis/networking @@ -1495,7 +1473,7 @@ knative.dev/networking/pkg/http/proxy knative.dev/networking/pkg/http/stats knative.dev/networking/pkg/ingress knative.dev/networking/pkg/k8s -# knative.dev/pkg v0.0.0-20240912132815-3002873b449c +# knative.dev/pkg v0.0.0-20240917091217-aaab500c26c4 ## explicit; go 1.22.0 knative.dev/pkg/apiextensions/storageversion knative.dev/pkg/apiextensions/storageversion/cmd/migrate @@ -1575,7 +1553,7 @@ knative.dev/pkg/webhook knative.dev/pkg/webhook/certificates knative.dev/pkg/webhook/certificates/resources knative.dev/pkg/webhook/resourcesemantics/conversion -# knative.dev/reconciler-test v0.0.0-20240910170818-bb4bca018fb3 +# knative.dev/reconciler-test v0.0.0-20240911144508-6372b7a0c4b1 ## explicit; go 1.22.0 knative.dev/reconciler-test/cmd/eventshub knative.dev/reconciler-test/pkg/environment @@ -1604,7 +1582,7 @@ knative.dev/reconciler-test/pkg/resources/service knative.dev/reconciler-test/pkg/resources/serviceaccount knative.dev/reconciler-test/pkg/state knative.dev/reconciler-test/resources/certificate -# knative.dev/serving v0.42.1-0.20240912104927-74ea38ab1b9c +# knative.dev/serving v0.42.1-0.20240917122220-cc9b0605d421 ## explicit; go 1.22.0 knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1