From d4433cda4bc7ebb094b7f82a0212a59c12eba7e2 Mon Sep 17 00:00:00 2001 From: Scott Nichols <32305648+n3wscott@users.noreply.github.com> Date: Fri, 20 Dec 2019 07:53:34 -0800 Subject: [PATCH] Migrate current sources to legacy (#2336) --- cmd/sources_controller/main.go | 12 +- cmd/webhook/main.go | 10 +- ...ce.yaml => 300-legacyapiserversource.yaml} | 0 ...ce.yaml => 300-legacycontainersource.yaml} | 0 ...urce.yaml => 300-legacycronjobsource.yaml} | 0 ...inding.yaml => 300-legacysinkbinding.yaml} | 0 hack/update-codegen.sh | 16 +- pkg/adapter/apiserver/controller_test.go | 2 +- pkg/adapter/apiserver/events/events.go | 2 +- pkg/adapter/apiserver/ref_test.go | 2 +- pkg/adapter/apiserver/resource_test.go | 2 +- pkg/adapter/cronjobevents/adapter.go | 2 +- .../{sources => legacysources}/register.go | 2 +- .../v1alpha1/apiserver_defaults.go | 0 .../v1alpha1/apiserver_defaults_test.go | 0 .../v1alpha1/apiserver_lifecycle.go | 0 .../v1alpha1/apiserver_lifecycle_test.go | 0 .../v1alpha1/apiserver_types.go | 0 .../v1alpha1/apiserver_validation.go | 0 .../v1alpha1/apiserver_validation_test.go | 0 .../v1alpha1/containersource_defaults.go | 0 .../v1alpha1/containersource_defaults_test.go | 0 .../v1alpha1/containersource_lifecycle.go | 0 .../containersource_lifecycle_test.go | 0 .../v1alpha1/containersource_types.go | 0 .../v1alpha1/containersource_validation.go | 0 .../containersource_validation_test.go | 0 .../v1alpha1/cron_job_defaults.go | 0 .../v1alpha1/cron_job_defaults_test.go | 0 .../v1alpha1/cron_job_lifecycle.go | 0 .../v1alpha1/cron_job_lifecycle_test.go | 2 +- .../v1alpha1/cron_job_types.go | 0 .../v1alpha1/cron_job_types_test.go | 0 .../v1alpha1/cron_job_validation.go | 0 .../v1alpha1/cron_job_validation_test.go | 0 .../v1alpha1/doc.go | 0 .../v1alpha1/implements_test.go | 0 .../v1alpha1/register.go | 4 +- .../v1alpha1/register_test.go | 0 .../v1alpha1/sinkbinding_context.go | 0 .../v1alpha1/sinkbinding_context_test.go | 0 .../v1alpha1/sinkbinding_defaults.go | 0 .../v1alpha1/sinkbinding_defaults_test.go | 0 .../v1alpha1/sinkbinding_lifecycle.go | 0 .../v1alpha1/sinkbinding_lifecycle_test.go | 0 .../v1alpha1/sinkbinding_types.go | 0 .../v1alpha1/sinkbinding_validation.go | 0 .../v1alpha1/sinkbinding_validation_test.go | 0 .../v1alpha1/zz_generated.deepcopy.go | 0 pkg/client/clientset/versioned/clientset.go | 14 -- .../versioned/fake/clientset_generated.go | 7 - .../clientset/versioned/fake/register.go | 2 - .../clientset/versioned/scheme/register.go | 2 - .../informers/externalversions/factory.go | 6 - .../informers/externalversions/generic.go | 11 -- .../clientset/versioned/clientset.go | 90 +++++++++ pkg/legacyclient/clientset/versioned/doc.go | 20 ++ .../versioned/fake/clientset_generated.go | 82 ++++++++ .../clientset/versioned/fake/doc.go | 20 ++ .../clientset/versioned/fake/register.go | 56 ++++++ .../clientset/versioned/scheme/doc.go | 20 ++ .../clientset/versioned/scheme/register.go | 56 ++++++ .../v1alpha1/apiserversource.go | 4 +- .../v1alpha1/containersource.go | 4 +- .../legacysources}/v1alpha1/cronjobsource.go | 4 +- .../typed/legacysources}/v1alpha1/doc.go | 0 .../typed/legacysources}/v1alpha1/fake/doc.go | 0 .../v1alpha1/fake/fake_apiserversource.go | 2 +- .../v1alpha1/fake/fake_containersource.go | 2 +- .../v1alpha1/fake/fake_cronjobsource.go | 2 +- .../fake/fake_legacysources_client.go} | 2 +- .../v1alpha1/fake/fake_sinkbinding.go | 2 +- .../v1alpha1/generated_expansion.go | 0 .../v1alpha1/legacysources_client.go} | 4 +- .../legacysources}/v1alpha1/sinkbinding.go | 4 +- .../informers/externalversions/factory.go | 180 ++++++++++++++++++ .../informers/externalversions/generic.go | 68 +++++++ .../internalinterfaces/factory_interfaces.go | 40 ++++ .../legacysources}/interface.go | 4 +- .../v1alpha1/apiserversource.go | 12 +- .../v1alpha1/containersource.go | 12 +- .../legacysources}/v1alpha1/cronjobsource.go | 12 +- .../legacysources}/v1alpha1/interface.go | 2 +- .../legacysources}/v1alpha1/sinkbinding.go | 12 +- pkg/legacyclient/injection/client/client.go | 49 +++++ .../injection/client/fake/fake.go | 54 ++++++ .../injection/informers/factory/factory.go | 56 ++++++ .../injection/informers/factory/fake/fake.go | 45 +++++ .../apiserversource/apiserversource.go | 6 +- .../v1alpha1/apiserversource/fake/fake.go | 4 +- .../containersource/containersource.go | 6 +- .../v1alpha1/containersource/fake/fake.go | 4 +- .../v1alpha1/cronjobsource/cronjobsource.go | 6 +- .../v1alpha1/cronjobsource/fake/fake.go | 4 +- .../v1alpha1/sinkbinding/fake/fake.go | 4 +- .../v1alpha1/sinkbinding/sinkbinding.go | 6 +- .../v1alpha1/apiserversource.go | 2 +- .../v1alpha1/containersource.go | 2 +- .../legacysources}/v1alpha1/cronjobsource.go | 2 +- .../v1alpha1/expansion_generated.go | 0 .../legacysources}/v1alpha1/sinkbinding.go | 2 +- .../apiserversource.go | 10 +- .../apiserversource_test.go | 8 +- .../cfg_host.go | 2 +- .../controller.go | 6 +- .../controller_test.go | 4 +- .../doc.go | 2 +- .../resources/eventtype.go | 2 +- .../resources/labels.go | 0 .../resources/receive_adapter.go | 2 +- .../resources/receive_adapter_test.go | 2 +- .../containersource.go | 10 +- .../containersource_test.go | 6 +- .../controller.go | 6 +- .../controller_test.go | 4 +- .../doc.go | 2 +- .../resources/arguments.go | 2 +- .../resources/deployment.go | 0 .../resources/deployment_test.go | 2 +- .../controller.go | 6 +- .../controller_test.go | 4 +- .../cronjobsource.go | 10 +- .../cronjobsource_test.go | 8 +- .../doc.go | 2 +- .../resources/eventtype.go | 2 +- .../resources/labels.go | 0 .../resources/receive_adapter.go | 2 +- .../resources/receive_adapter_test.go | 2 +- .../controller.go | 6 +- pkg/reconciler/reconciler.go | 19 +- pkg/reconciler/testing/apiserversource.go | 2 +- pkg/reconciler/testing/containersource.go | 2 +- pkg/reconciler/testing/cronjobsource.go | 2 +- pkg/reconciler/testing/factory.go | 15 +- pkg/reconciler/testing/listers.go | 23 ++- pkg/reconciler/trigger/trigger_test.go | 2 +- test/common/client.go | 7 + test/common/creation.go | 26 +-- test/e2e/sinkbinding_test.go | 4 +- test/e2e/source_api_server_test.go | 4 +- test/e2e/source_container_test.go | 4 +- test/e2e/source_cron_job_test.go | 4 +- 142 files changed, 1065 insertions(+), 227 deletions(-) rename config/{300-apiserversource.yaml => 300-legacyapiserversource.yaml} (100%) rename config/{300-containersource.yaml => 300-legacycontainersource.yaml} (100%) rename config/{300-cronjobsource.yaml => 300-legacycronjobsource.yaml} (100%) rename config/{300-sinkbinding.yaml => 300-legacysinkbinding.yaml} (100%) rename pkg/apis/{sources => legacysources}/register.go (96%) rename pkg/apis/{sources => legacysources}/v1alpha1/apiserver_defaults.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/apiserver_defaults_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/apiserver_lifecycle.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/apiserver_lifecycle_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/apiserver_types.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/apiserver_validation.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/apiserver_validation_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/containersource_defaults.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/containersource_defaults_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/containersource_lifecycle.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/containersource_lifecycle_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/containersource_types.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/containersource_validation.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/containersource_validation_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/cron_job_defaults.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/cron_job_defaults_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/cron_job_lifecycle.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/cron_job_lifecycle_test.go (99%) rename pkg/apis/{sources => legacysources}/v1alpha1/cron_job_types.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/cron_job_types_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/cron_job_validation.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/cron_job_validation_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/doc.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/implements_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/register.go (92%) rename pkg/apis/{sources => legacysources}/v1alpha1/register_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/sinkbinding_context.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/sinkbinding_context_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/sinkbinding_defaults.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/sinkbinding_defaults_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/sinkbinding_lifecycle.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/sinkbinding_lifecycle_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/sinkbinding_types.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/sinkbinding_validation.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/sinkbinding_validation_test.go (100%) rename pkg/apis/{sources => legacysources}/v1alpha1/zz_generated.deepcopy.go (100%) create mode 100644 pkg/legacyclient/clientset/versioned/clientset.go create mode 100644 pkg/legacyclient/clientset/versioned/doc.go create mode 100644 pkg/legacyclient/clientset/versioned/fake/clientset_generated.go create mode 100644 pkg/legacyclient/clientset/versioned/fake/doc.go create mode 100644 pkg/legacyclient/clientset/versioned/fake/register.go create mode 100644 pkg/legacyclient/clientset/versioned/scheme/doc.go create mode 100644 pkg/legacyclient/clientset/versioned/scheme/register.go rename pkg/{client/clientset/versioned/typed/sources => legacyclient/clientset/versioned/typed/legacysources}/v1alpha1/apiserversource.go (97%) rename pkg/{client/clientset/versioned/typed/sources => legacyclient/clientset/versioned/typed/legacysources}/v1alpha1/containersource.go (97%) rename pkg/{client/clientset/versioned/typed/sources => legacyclient/clientset/versioned/typed/legacysources}/v1alpha1/cronjobsource.go (97%) rename pkg/{client/clientset/versioned/typed/sources => legacyclient/clientset/versioned/typed/legacysources}/v1alpha1/doc.go (100%) rename pkg/{client/clientset/versioned/typed/sources => legacyclient/clientset/versioned/typed/legacysources}/v1alpha1/fake/doc.go (100%) rename pkg/{client/clientset/versioned/typed/sources => legacyclient/clientset/versioned/typed/legacysources}/v1alpha1/fake/fake_apiserversource.go (98%) rename pkg/{client/clientset/versioned/typed/sources => legacyclient/clientset/versioned/typed/legacysources}/v1alpha1/fake/fake_containersource.go (98%) rename pkg/{client/clientset/versioned/typed/sources => legacyclient/clientset/versioned/typed/legacysources}/v1alpha1/fake/fake_cronjobsource.go (98%) rename pkg/{client/clientset/versioned/typed/sources/v1alpha1/fake/fake_sources_client.go => legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_legacysources_client.go} (93%) rename pkg/{client/clientset/versioned/typed/sources => legacyclient/clientset/versioned/typed/legacysources}/v1alpha1/fake/fake_sinkbinding.go (98%) rename pkg/{client/clientset/versioned/typed/sources => legacyclient/clientset/versioned/typed/legacysources}/v1alpha1/generated_expansion.go (100%) rename pkg/{client/clientset/versioned/typed/sources/v1alpha1/sources_client.go => legacyclient/clientset/versioned/typed/legacysources/v1alpha1/legacysources_client.go} (95%) rename pkg/{client/clientset/versioned/typed/sources => legacyclient/clientset/versioned/typed/legacysources}/v1alpha1/sinkbinding.go (97%) create mode 100644 pkg/legacyclient/informers/externalversions/factory.go create mode 100644 pkg/legacyclient/informers/externalversions/generic.go create mode 100644 pkg/legacyclient/informers/externalversions/internalinterfaces/factory_interfaces.go rename pkg/{client/informers/externalversions/sources => legacyclient/informers/externalversions/legacysources}/interface.go (87%) rename pkg/{client/informers/externalversions/sources => legacyclient/informers/externalversions/legacysources}/v1alpha1/apiserversource.go (87%) rename pkg/{client/informers/externalversions/sources => legacyclient/informers/externalversions/legacysources}/v1alpha1/containersource.go (87%) rename pkg/{client/informers/externalversions/sources => legacyclient/informers/externalversions/legacysources}/v1alpha1/cronjobsource.go (87%) rename pkg/{client/informers/externalversions/sources => legacyclient/informers/externalversions/legacysources}/v1alpha1/interface.go (95%) rename pkg/{client/informers/externalversions/sources => legacyclient/informers/externalversions/legacysources}/v1alpha1/sinkbinding.go (87%) create mode 100644 pkg/legacyclient/injection/client/client.go create mode 100644 pkg/legacyclient/injection/client/fake/fake.go create mode 100644 pkg/legacyclient/injection/informers/factory/factory.go create mode 100644 pkg/legacyclient/injection/informers/factory/fake/fake.go rename pkg/{client/injection/informers/sources => legacyclient/injection/informers/legacysources}/v1alpha1/apiserversource/apiserversource.go (81%) rename pkg/{client/injection/informers/sources => legacyclient/injection/informers/legacysources}/v1alpha1/apiserversource/fake/fake.go (84%) rename pkg/{client/injection/informers/sources => legacyclient/injection/informers/legacysources}/v1alpha1/containersource/containersource.go (81%) rename pkg/{client/injection/informers/sources => legacyclient/injection/informers/legacysources}/v1alpha1/containersource/fake/fake.go (84%) rename pkg/{client/injection/informers/sources => legacyclient/injection/informers/legacysources}/v1alpha1/cronjobsource/cronjobsource.go (81%) rename pkg/{client/injection/informers/sources => legacyclient/injection/informers/legacysources}/v1alpha1/cronjobsource/fake/fake.go (84%) rename pkg/{client/injection/informers/sources => legacyclient/injection/informers/legacysources}/v1alpha1/sinkbinding/fake/fake.go (84%) rename pkg/{client/injection/informers/sources => legacyclient/injection/informers/legacysources}/v1alpha1/sinkbinding/sinkbinding.go (81%) rename pkg/{client/listers/sources => legacyclient/listers/legacysources}/v1alpha1/apiserversource.go (98%) rename pkg/{client/listers/sources => legacyclient/listers/legacysources}/v1alpha1/containersource.go (98%) rename pkg/{client/listers/sources => legacyclient/listers/legacysources}/v1alpha1/cronjobsource.go (98%) rename pkg/{client/listers/sources => legacyclient/listers/legacysources}/v1alpha1/expansion_generated.go (100%) rename pkg/{client/listers/sources => legacyclient/listers/legacysources}/v1alpha1/sinkbinding.go (98%) rename pkg/reconciler/{apiserversource => legacyapiserversource}/apiserversource.go (98%) rename pkg/reconciler/{apiserversource => legacyapiserversource}/apiserversource_test.go (99%) rename pkg/reconciler/{apiserversource => legacyapiserversource}/cfg_host.go (97%) rename pkg/reconciler/{apiserversource => legacyapiserversource}/controller.go (94%) rename pkg/reconciler/{apiserversource => legacyapiserversource}/controller_test.go (93%) rename pkg/reconciler/{apiserversource => legacyapiserversource}/doc.go (95%) rename pkg/reconciler/{apiserversource => legacyapiserversource}/resources/eventtype.go (96%) rename pkg/reconciler/{apiserversource => legacyapiserversource}/resources/labels.go (100%) rename pkg/reconciler/{apiserversource => legacyapiserversource}/resources/receive_adapter.go (98%) rename pkg/reconciler/{apiserversource => legacyapiserversource}/resources/receive_adapter_test.go (98%) rename pkg/reconciler/{containersource => legacycontainersource}/containersource.go (97%) rename pkg/reconciler/{containersource => legacycontainersource}/containersource_test.go (99%) rename pkg/reconciler/{containersource => legacycontainersource}/controller.go (91%) rename pkg/reconciler/{containersource => legacycontainersource}/controller_test.go (87%) rename pkg/reconciler/{containersource => legacycontainersource}/doc.go (95%) rename pkg/reconciler/{containersource => legacycontainersource}/resources/arguments.go (95%) rename pkg/reconciler/{containersource => legacycontainersource}/resources/deployment.go (100%) rename pkg/reconciler/{containersource => legacycontainersource}/resources/deployment_test.go (99%) rename pkg/reconciler/{cronjobsource => legacycronjobsource}/controller.go (94%) rename pkg/reconciler/{cronjobsource => legacycronjobsource}/controller_test.go (95%) rename pkg/reconciler/{cronjobsource => legacycronjobsource}/cronjobsource.go (97%) rename pkg/reconciler/{cronjobsource => legacycronjobsource}/cronjobsource_test.go (98%) rename pkg/reconciler/{cronjobsource => legacycronjobsource}/doc.go (95%) rename pkg/reconciler/{cronjobsource => legacycronjobsource}/resources/eventtype.go (96%) rename pkg/reconciler/{cronjobsource => legacycronjobsource}/resources/labels.go (100%) rename pkg/reconciler/{cronjobsource => legacycronjobsource}/resources/receive_adapter.go (98%) rename pkg/reconciler/{cronjobsource => legacycronjobsource}/resources/receive_adapter_test.go (98%) rename pkg/reconciler/{sinkbinding => legacysinkbinding}/controller.go (94%) diff --git a/cmd/sources_controller/main.go b/cmd/sources_controller/main.go index cabed7b5b37..6fdcec2eaad 100644 --- a/cmd/sources_controller/main.go +++ b/cmd/sources_controller/main.go @@ -20,16 +20,16 @@ import ( // Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters). // _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" - "knative.dev/eventing/pkg/reconciler/apiserversource" - "knative.dev/eventing/pkg/reconciler/containersource" - "knative.dev/eventing/pkg/reconciler/cronjobsource" + "knative.dev/eventing/pkg/reconciler/legacyapiserversource" + "knative.dev/eventing/pkg/reconciler/legacycontainersource" + "knative.dev/eventing/pkg/reconciler/legacycronjobsource" "knative.dev/pkg/injection/sharedmain" ) func main() { sharedmain.Main("source_controller", - apiserversource.NewController, - containersource.NewController, - cronjobsource.NewController, + legacyapiserversource.NewController, + legacycontainersource.NewController, + legacycronjobsource.NewController, ) } diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 6ff6ff84adf..7b25ad40b7a 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -24,11 +24,11 @@ import ( eventingduckv1alpha1 "knative.dev/eventing/pkg/apis/duck/v1alpha1" eventingv1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1" flowsv1alpha1 "knative.dev/eventing/pkg/apis/flows/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" messagingv1alpha1 "knative.dev/eventing/pkg/apis/messaging/v1alpha1" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" "knative.dev/eventing/pkg/defaultchannel" "knative.dev/eventing/pkg/logconfig" - "knative.dev/eventing/pkg/reconciler/sinkbinding" + "knative.dev/eventing/pkg/reconciler/legacysinkbinding" "knative.dev/pkg/configmap" "knative.dev/pkg/controller" "knative.dev/pkg/injection/sharedmain" @@ -146,7 +146,7 @@ func NewConfigValidationController(ctx context.Context, cmw configmap.Watcher) * } func NewSinkBindingWebhook(ctx context.Context, cmw configmap.Watcher) *controller.Impl { - sbresolver := sinkbinding.WithContextFactory(ctx, func(types.NamespacedName) {}) + sbresolver := legacysinkbinding.WithContextFactory(ctx, func(types.NamespacedName) {}) return psbinding.NewAdmissionController(ctx, @@ -157,7 +157,7 @@ func NewSinkBindingWebhook(ctx context.Context, cmw configmap.Watcher) *controll "/sinkbindings", // How to get all the Bindables for configuring the mutating webhook. - sinkbinding.ListAll, + legacysinkbinding.ListAll, // How to setup the context prior to invoking Do/Undo. sbresolver, @@ -180,6 +180,6 @@ func main() { NewDefaultingAdmissionController, // For each binding we have a controller and a binding webhook. - sinkbinding.NewController, NewSinkBindingWebhook, + legacysinkbinding.NewController, NewSinkBindingWebhook, ) } diff --git a/config/300-apiserversource.yaml b/config/300-legacyapiserversource.yaml similarity index 100% rename from config/300-apiserversource.yaml rename to config/300-legacyapiserversource.yaml diff --git a/config/300-containersource.yaml b/config/300-legacycontainersource.yaml similarity index 100% rename from config/300-containersource.yaml rename to config/300-legacycontainersource.yaml diff --git a/config/300-cronjobsource.yaml b/config/300-legacycronjobsource.yaml similarity index 100% rename from config/300-cronjobsource.yaml rename to config/300-legacycronjobsource.yaml diff --git a/config/300-sinkbinding.yaml b/config/300-legacysinkbinding.yaml similarity index 100% rename from config/300-sinkbinding.yaml rename to config/300-legacysinkbinding.yaml diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 821d7c5cdf6..b62166593e6 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -30,7 +30,13 @@ KNATIVE_CODEGEN_PKG=${KNATIVE_CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 $(dir # instead of the $GOPATH directly. For normal projects this can be dropped. ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \ knative.dev/eventing/pkg/client knative.dev/eventing/pkg/apis \ - "eventing:v1alpha1 sources:v1alpha1 messaging:v1alpha1 flows:v1alpha1" \ + "eventing:v1alpha1 messaging:v1alpha1 flows:v1alpha1" \ + --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt + +# TODO(#2312): Remove this after v0.13. +${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \ + knative.dev/eventing/pkg/legacyclient knative.dev/eventing/pkg/apis \ + "legacysources:v1alpha1" \ --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt # Only deepcopy the Duck types, as they are not real resources. @@ -42,7 +48,13 @@ ${CODEGEN_PKG}/generate-groups.sh "deepcopy" \ # Knative Injection ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \ knative.dev/eventing/pkg/client knative.dev/eventing/pkg/apis \ - "eventing:v1alpha1 sources:v1alpha1 messaging:v1alpha1 flows:v1alpha1 duck:v1alpha1" \ + "eventing:v1alpha1 messaging:v1alpha1 flows:v1alpha1 duck:v1alpha1" \ + --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt + +# TODO(#2312): Remove this after v0.13. +${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \ + knative.dev/eventing/pkg/legacyclient knative.dev/eventing/pkg/apis \ + "legacysources:v1alpha1" \ --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt # Make sure our dependencies are up-to-date diff --git a/pkg/adapter/apiserver/controller_test.go b/pkg/adapter/apiserver/controller_test.go index e77c0eeead2..30bb3506c3e 100644 --- a/pkg/adapter/apiserver/controller_test.go +++ b/pkg/adapter/apiserver/controller_test.go @@ -19,7 +19,7 @@ package apiserver import ( "testing" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" kncetesting "knative.dev/eventing/pkg/kncloudevents/testing" ) diff --git a/pkg/adapter/apiserver/events/events.go b/pkg/adapter/apiserver/events/events.go index b2f62ecddc8..013910a9314 100644 --- a/pkg/adapter/apiserver/events/events.go +++ b/pkg/adapter/apiserver/events/events.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" cloudevents "github.com/cloudevents/sdk-go" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) func MakeAddEvent(source string, obj interface{}) (*cloudevents.Event, error) { diff --git a/pkg/adapter/apiserver/ref_test.go b/pkg/adapter/apiserver/ref_test.go index 76cdb71197b..9566b9f0a7d 100644 --- a/pkg/adapter/apiserver/ref_test.go +++ b/pkg/adapter/apiserver/ref_test.go @@ -4,7 +4,7 @@ import ( "testing" "k8s.io/apimachinery/pkg/runtime/schema" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) func TestRefAddEvent(t *testing.T) { diff --git a/pkg/adapter/apiserver/resource_test.go b/pkg/adapter/apiserver/resource_test.go index 91e930379b4..bb842fd82bf 100644 --- a/pkg/adapter/apiserver/resource_test.go +++ b/pkg/adapter/apiserver/resource_test.go @@ -4,7 +4,7 @@ import ( "testing" "k8s.io/apimachinery/pkg/runtime/schema" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) func TestResourceAddEvent(t *testing.T) { diff --git a/pkg/adapter/cronjobevents/adapter.go b/pkg/adapter/cronjobevents/adapter.go index 68d7a437706..04dcd833834 100644 --- a/pkg/adapter/cronjobevents/adapter.go +++ b/pkg/adapter/cronjobevents/adapter.go @@ -25,7 +25,7 @@ import ( "github.com/robfig/cron" "go.uber.org/zap" "knative.dev/eventing/pkg/adapter" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/pkg/logging" "knative.dev/pkg/source" ) diff --git a/pkg/apis/sources/register.go b/pkg/apis/legacysources/register.go similarity index 96% rename from pkg/apis/sources/register.go rename to pkg/apis/legacysources/register.go index 4d2a4477695..9483995420c 100644 --- a/pkg/apis/sources/register.go +++ b/pkg/apis/legacysources/register.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package sources +package legacysources const ( GroupName = "sources.eventing.knative.dev" diff --git a/pkg/apis/sources/v1alpha1/apiserver_defaults.go b/pkg/apis/legacysources/v1alpha1/apiserver_defaults.go similarity index 100% rename from pkg/apis/sources/v1alpha1/apiserver_defaults.go rename to pkg/apis/legacysources/v1alpha1/apiserver_defaults.go diff --git a/pkg/apis/sources/v1alpha1/apiserver_defaults_test.go b/pkg/apis/legacysources/v1alpha1/apiserver_defaults_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/apiserver_defaults_test.go rename to pkg/apis/legacysources/v1alpha1/apiserver_defaults_test.go diff --git a/pkg/apis/sources/v1alpha1/apiserver_lifecycle.go b/pkg/apis/legacysources/v1alpha1/apiserver_lifecycle.go similarity index 100% rename from pkg/apis/sources/v1alpha1/apiserver_lifecycle.go rename to pkg/apis/legacysources/v1alpha1/apiserver_lifecycle.go diff --git a/pkg/apis/sources/v1alpha1/apiserver_lifecycle_test.go b/pkg/apis/legacysources/v1alpha1/apiserver_lifecycle_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/apiserver_lifecycle_test.go rename to pkg/apis/legacysources/v1alpha1/apiserver_lifecycle_test.go diff --git a/pkg/apis/sources/v1alpha1/apiserver_types.go b/pkg/apis/legacysources/v1alpha1/apiserver_types.go similarity index 100% rename from pkg/apis/sources/v1alpha1/apiserver_types.go rename to pkg/apis/legacysources/v1alpha1/apiserver_types.go diff --git a/pkg/apis/sources/v1alpha1/apiserver_validation.go b/pkg/apis/legacysources/v1alpha1/apiserver_validation.go similarity index 100% rename from pkg/apis/sources/v1alpha1/apiserver_validation.go rename to pkg/apis/legacysources/v1alpha1/apiserver_validation.go diff --git a/pkg/apis/sources/v1alpha1/apiserver_validation_test.go b/pkg/apis/legacysources/v1alpha1/apiserver_validation_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/apiserver_validation_test.go rename to pkg/apis/legacysources/v1alpha1/apiserver_validation_test.go diff --git a/pkg/apis/sources/v1alpha1/containersource_defaults.go b/pkg/apis/legacysources/v1alpha1/containersource_defaults.go similarity index 100% rename from pkg/apis/sources/v1alpha1/containersource_defaults.go rename to pkg/apis/legacysources/v1alpha1/containersource_defaults.go diff --git a/pkg/apis/sources/v1alpha1/containersource_defaults_test.go b/pkg/apis/legacysources/v1alpha1/containersource_defaults_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/containersource_defaults_test.go rename to pkg/apis/legacysources/v1alpha1/containersource_defaults_test.go diff --git a/pkg/apis/sources/v1alpha1/containersource_lifecycle.go b/pkg/apis/legacysources/v1alpha1/containersource_lifecycle.go similarity index 100% rename from pkg/apis/sources/v1alpha1/containersource_lifecycle.go rename to pkg/apis/legacysources/v1alpha1/containersource_lifecycle.go diff --git a/pkg/apis/sources/v1alpha1/containersource_lifecycle_test.go b/pkg/apis/legacysources/v1alpha1/containersource_lifecycle_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/containersource_lifecycle_test.go rename to pkg/apis/legacysources/v1alpha1/containersource_lifecycle_test.go diff --git a/pkg/apis/sources/v1alpha1/containersource_types.go b/pkg/apis/legacysources/v1alpha1/containersource_types.go similarity index 100% rename from pkg/apis/sources/v1alpha1/containersource_types.go rename to pkg/apis/legacysources/v1alpha1/containersource_types.go diff --git a/pkg/apis/sources/v1alpha1/containersource_validation.go b/pkg/apis/legacysources/v1alpha1/containersource_validation.go similarity index 100% rename from pkg/apis/sources/v1alpha1/containersource_validation.go rename to pkg/apis/legacysources/v1alpha1/containersource_validation.go diff --git a/pkg/apis/sources/v1alpha1/containersource_validation_test.go b/pkg/apis/legacysources/v1alpha1/containersource_validation_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/containersource_validation_test.go rename to pkg/apis/legacysources/v1alpha1/containersource_validation_test.go diff --git a/pkg/apis/sources/v1alpha1/cron_job_defaults.go b/pkg/apis/legacysources/v1alpha1/cron_job_defaults.go similarity index 100% rename from pkg/apis/sources/v1alpha1/cron_job_defaults.go rename to pkg/apis/legacysources/v1alpha1/cron_job_defaults.go diff --git a/pkg/apis/sources/v1alpha1/cron_job_defaults_test.go b/pkg/apis/legacysources/v1alpha1/cron_job_defaults_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/cron_job_defaults_test.go rename to pkg/apis/legacysources/v1alpha1/cron_job_defaults_test.go diff --git a/pkg/apis/sources/v1alpha1/cron_job_lifecycle.go b/pkg/apis/legacysources/v1alpha1/cron_job_lifecycle.go similarity index 100% rename from pkg/apis/sources/v1alpha1/cron_job_lifecycle.go rename to pkg/apis/legacysources/v1alpha1/cron_job_lifecycle.go diff --git a/pkg/apis/sources/v1alpha1/cron_job_lifecycle_test.go b/pkg/apis/legacysources/v1alpha1/cron_job_lifecycle_test.go similarity index 99% rename from pkg/apis/sources/v1alpha1/cron_job_lifecycle_test.go rename to pkg/apis/legacysources/v1alpha1/cron_job_lifecycle_test.go index 23f120bf7ae..39ed4d17678 100644 --- a/pkg/apis/sources/v1alpha1/cron_job_lifecycle_test.go +++ b/pkg/apis/legacysources/v1alpha1/cron_job_lifecycle_test.go @@ -24,7 +24,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/pkg/apis" ) diff --git a/pkg/apis/sources/v1alpha1/cron_job_types.go b/pkg/apis/legacysources/v1alpha1/cron_job_types.go similarity index 100% rename from pkg/apis/sources/v1alpha1/cron_job_types.go rename to pkg/apis/legacysources/v1alpha1/cron_job_types.go diff --git a/pkg/apis/sources/v1alpha1/cron_job_types_test.go b/pkg/apis/legacysources/v1alpha1/cron_job_types_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/cron_job_types_test.go rename to pkg/apis/legacysources/v1alpha1/cron_job_types_test.go diff --git a/pkg/apis/sources/v1alpha1/cron_job_validation.go b/pkg/apis/legacysources/v1alpha1/cron_job_validation.go similarity index 100% rename from pkg/apis/sources/v1alpha1/cron_job_validation.go rename to pkg/apis/legacysources/v1alpha1/cron_job_validation.go diff --git a/pkg/apis/sources/v1alpha1/cron_job_validation_test.go b/pkg/apis/legacysources/v1alpha1/cron_job_validation_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/cron_job_validation_test.go rename to pkg/apis/legacysources/v1alpha1/cron_job_validation_test.go diff --git a/pkg/apis/sources/v1alpha1/doc.go b/pkg/apis/legacysources/v1alpha1/doc.go similarity index 100% rename from pkg/apis/sources/v1alpha1/doc.go rename to pkg/apis/legacysources/v1alpha1/doc.go diff --git a/pkg/apis/sources/v1alpha1/implements_test.go b/pkg/apis/legacysources/v1alpha1/implements_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/implements_test.go rename to pkg/apis/legacysources/v1alpha1/implements_test.go diff --git a/pkg/apis/sources/v1alpha1/register.go b/pkg/apis/legacysources/v1alpha1/register.go similarity index 92% rename from pkg/apis/sources/v1alpha1/register.go rename to pkg/apis/legacysources/v1alpha1/register.go index a92c7c37717..a1affadb401 100644 --- a/pkg/apis/sources/v1alpha1/register.go +++ b/pkg/apis/legacysources/v1alpha1/register.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha1 import ( - "knative.dev/eventing/pkg/apis/sources" + "knative.dev/eventing/pkg/apis/legacysources" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -25,7 +25,7 @@ import ( ) // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: sources.GroupName, Version: "v1alpha1"} +var SchemeGroupVersion = schema.GroupVersion{Group: legacysources.GroupName, Version: "v1alpha1"} // Kind takes an unqualified kind and returns back a Group qualified GroupKind func Kind(kind string) schema.GroupKind { diff --git a/pkg/apis/sources/v1alpha1/register_test.go b/pkg/apis/legacysources/v1alpha1/register_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/register_test.go rename to pkg/apis/legacysources/v1alpha1/register_test.go diff --git a/pkg/apis/sources/v1alpha1/sinkbinding_context.go b/pkg/apis/legacysources/v1alpha1/sinkbinding_context.go similarity index 100% rename from pkg/apis/sources/v1alpha1/sinkbinding_context.go rename to pkg/apis/legacysources/v1alpha1/sinkbinding_context.go diff --git a/pkg/apis/sources/v1alpha1/sinkbinding_context_test.go b/pkg/apis/legacysources/v1alpha1/sinkbinding_context_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/sinkbinding_context_test.go rename to pkg/apis/legacysources/v1alpha1/sinkbinding_context_test.go diff --git a/pkg/apis/sources/v1alpha1/sinkbinding_defaults.go b/pkg/apis/legacysources/v1alpha1/sinkbinding_defaults.go similarity index 100% rename from pkg/apis/sources/v1alpha1/sinkbinding_defaults.go rename to pkg/apis/legacysources/v1alpha1/sinkbinding_defaults.go diff --git a/pkg/apis/sources/v1alpha1/sinkbinding_defaults_test.go b/pkg/apis/legacysources/v1alpha1/sinkbinding_defaults_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/sinkbinding_defaults_test.go rename to pkg/apis/legacysources/v1alpha1/sinkbinding_defaults_test.go diff --git a/pkg/apis/sources/v1alpha1/sinkbinding_lifecycle.go b/pkg/apis/legacysources/v1alpha1/sinkbinding_lifecycle.go similarity index 100% rename from pkg/apis/sources/v1alpha1/sinkbinding_lifecycle.go rename to pkg/apis/legacysources/v1alpha1/sinkbinding_lifecycle.go diff --git a/pkg/apis/sources/v1alpha1/sinkbinding_lifecycle_test.go b/pkg/apis/legacysources/v1alpha1/sinkbinding_lifecycle_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/sinkbinding_lifecycle_test.go rename to pkg/apis/legacysources/v1alpha1/sinkbinding_lifecycle_test.go diff --git a/pkg/apis/sources/v1alpha1/sinkbinding_types.go b/pkg/apis/legacysources/v1alpha1/sinkbinding_types.go similarity index 100% rename from pkg/apis/sources/v1alpha1/sinkbinding_types.go rename to pkg/apis/legacysources/v1alpha1/sinkbinding_types.go diff --git a/pkg/apis/sources/v1alpha1/sinkbinding_validation.go b/pkg/apis/legacysources/v1alpha1/sinkbinding_validation.go similarity index 100% rename from pkg/apis/sources/v1alpha1/sinkbinding_validation.go rename to pkg/apis/legacysources/v1alpha1/sinkbinding_validation.go diff --git a/pkg/apis/sources/v1alpha1/sinkbinding_validation_test.go b/pkg/apis/legacysources/v1alpha1/sinkbinding_validation_test.go similarity index 100% rename from pkg/apis/sources/v1alpha1/sinkbinding_validation_test.go rename to pkg/apis/legacysources/v1alpha1/sinkbinding_validation_test.go diff --git a/pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/legacysources/v1alpha1/zz_generated.deepcopy.go similarity index 100% rename from pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go rename to pkg/apis/legacysources/v1alpha1/zz_generated.deepcopy.go diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 7315a7ac9a7..ed577ee79ac 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -25,7 +25,6 @@ import ( eventingv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1alpha1" flowsv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1alpha1" messagingv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1alpha1" - sourcesv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1" ) type Interface interface { @@ -33,7 +32,6 @@ type Interface interface { EventingV1alpha1() eventingv1alpha1.EventingV1alpha1Interface FlowsV1alpha1() flowsv1alpha1.FlowsV1alpha1Interface MessagingV1alpha1() messagingv1alpha1.MessagingV1alpha1Interface - SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface } // Clientset contains the clients for groups. Each group has exactly one @@ -43,7 +41,6 @@ type Clientset struct { eventingV1alpha1 *eventingv1alpha1.EventingV1alpha1Client flowsV1alpha1 *flowsv1alpha1.FlowsV1alpha1Client messagingV1alpha1 *messagingv1alpha1.MessagingV1alpha1Client - sourcesV1alpha1 *sourcesv1alpha1.SourcesV1alpha1Client } // EventingV1alpha1 retrieves the EventingV1alpha1Client @@ -61,11 +58,6 @@ func (c *Clientset) MessagingV1alpha1() messagingv1alpha1.MessagingV1alpha1Inter return c.messagingV1alpha1 } -// SourcesV1alpha1 retrieves the SourcesV1alpha1Client -func (c *Clientset) SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface { - return c.sourcesV1alpha1 -} - // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -94,10 +86,6 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } - cs.sourcesV1alpha1, err = sourcesv1alpha1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -113,7 +101,6 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { cs.eventingV1alpha1 = eventingv1alpha1.NewForConfigOrDie(c) cs.flowsV1alpha1 = flowsv1alpha1.NewForConfigOrDie(c) cs.messagingV1alpha1 = messagingv1alpha1.NewForConfigOrDie(c) - cs.sourcesV1alpha1 = sourcesv1alpha1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -125,7 +112,6 @@ func New(c rest.Interface) *Clientset { cs.eventingV1alpha1 = eventingv1alpha1.New(c) cs.flowsV1alpha1 = flowsv1alpha1.New(c) cs.messagingV1alpha1 = messagingv1alpha1.New(c) - cs.sourcesV1alpha1 = sourcesv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 9b1def4c3c6..311e35e562b 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -31,8 +31,6 @@ import ( fakeflowsv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1alpha1/fake" messagingv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1alpha1" fakemessagingv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake" - sourcesv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1" - fakesourcesv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake" ) // NewSimpleClientset returns a clientset that will respond with the provided objects. @@ -96,8 +94,3 @@ func (c *Clientset) FlowsV1alpha1() flowsv1alpha1.FlowsV1alpha1Interface { func (c *Clientset) MessagingV1alpha1() messagingv1alpha1.MessagingV1alpha1Interface { return &fakemessagingv1alpha1.FakeMessagingV1alpha1{Fake: &c.Fake} } - -// SourcesV1alpha1 retrieves the SourcesV1alpha1Client -func (c *Clientset) SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface { - return &fakesourcesv1alpha1.FakeSourcesV1alpha1{Fake: &c.Fake} -} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 0db5432ae03..39d85a5d0a6 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -27,7 +27,6 @@ import ( eventingv1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1" flowsv1alpha1 "knative.dev/eventing/pkg/apis/flows/v1alpha1" messagingv1alpha1 "knative.dev/eventing/pkg/apis/messaging/v1alpha1" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" ) var scheme = runtime.NewScheme() @@ -37,7 +36,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{ eventingv1alpha1.AddToScheme, flowsv1alpha1.AddToScheme, messagingv1alpha1.AddToScheme, - sourcesv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 9c2239c0dd7..30b6229ca98 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -27,7 +27,6 @@ import ( eventingv1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1" flowsv1alpha1 "knative.dev/eventing/pkg/apis/flows/v1alpha1" messagingv1alpha1 "knative.dev/eventing/pkg/apis/messaging/v1alpha1" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" ) var Scheme = runtime.NewScheme() @@ -37,7 +36,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{ eventingv1alpha1.AddToScheme, flowsv1alpha1.AddToScheme, messagingv1alpha1.AddToScheme, - sourcesv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index e476d75ac48..bd49873f90c 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -32,7 +32,6 @@ import ( 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" - sources "knative.dev/eventing/pkg/client/informers/externalversions/sources" ) // SharedInformerOption defines the functional option type for SharedInformerFactory. @@ -178,7 +177,6 @@ type SharedInformerFactory interface { Eventing() eventing.Interface Flows() flows.Interface Messaging() messaging.Interface - Sources() sources.Interface } func (f *sharedInformerFactory) Eventing() eventing.Interface { @@ -192,7 +190,3 @@ func (f *sharedInformerFactory) Flows() flows.Interface { func (f *sharedInformerFactory) Messaging() messaging.Interface { return messaging.New(f, f.namespace, f.tweakListOptions) } - -func (f *sharedInformerFactory) Sources() sources.Interface { - return sources.New(f, f.namespace, f.tweakListOptions) -} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 23e33201a96..b3e88002ee4 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -26,7 +26,6 @@ import ( v1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1" flowsv1alpha1 "knative.dev/eventing/pkg/apis/flows/v1alpha1" messagingv1alpha1 "knative.dev/eventing/pkg/apis/messaging/v1alpha1" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" ) // GenericInformer is type of SharedIndexInformer which will locate and delegate to other @@ -81,16 +80,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case messagingv1alpha1.SchemeGroupVersion.WithResource("subscriptions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Messaging().V1alpha1().Subscriptions().Informer()}, nil - // Group=sources.eventing.knative.dev, Version=v1alpha1 - case sourcesv1alpha1.SchemeGroupVersion.WithResource("apiserversources"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1alpha1().ApiServerSources().Informer()}, nil - case sourcesv1alpha1.SchemeGroupVersion.WithResource("containersources"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1alpha1().ContainerSources().Informer()}, nil - case sourcesv1alpha1.SchemeGroupVersion.WithResource("cronjobsources"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1alpha1().CronJobSources().Informer()}, nil - case sourcesv1alpha1.SchemeGroupVersion.WithResource("sinkbindings"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1alpha1().SinkBindings().Informer()}, nil - } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/legacyclient/clientset/versioned/clientset.go b/pkg/legacyclient/clientset/versioned/clientset.go new file mode 100644 index 00000000000..162a41da1d1 --- /dev/null +++ b/pkg/legacyclient/clientset/versioned/clientset.go @@ -0,0 +1,90 @@ +/* +Copyright 2019 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 client-gen. DO NOT EDIT. + +package versioned + +import ( + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" + sourcesv1alpha1 "knative.dev/eventing/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + sourcesV1alpha1 *sourcesv1alpha1.SourcesV1alpha1Client +} + +// SourcesV1alpha1 retrieves the SourcesV1alpha1Client +func (c *Clientset) SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface { + return c.sourcesV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.sourcesV1alpha1, err = sourcesv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.sourcesV1alpha1 = sourcesv1alpha1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.sourcesV1alpha1 = sourcesv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/pkg/legacyclient/clientset/versioned/doc.go b/pkg/legacyclient/clientset/versioned/doc.go new file mode 100644 index 00000000000..1122e50bfc3 --- /dev/null +++ b/pkg/legacyclient/clientset/versioned/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 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 client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/pkg/legacyclient/clientset/versioned/fake/clientset_generated.go b/pkg/legacyclient/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 00000000000..d8b390f619a --- /dev/null +++ b/pkg/legacyclient/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,82 @@ +/* +Copyright 2019 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 client-gen. DO NOT EDIT. + +package fake + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" + clientset "knative.dev/eventing/pkg/legacyclient/clientset/versioned" + sourcesv1alpha1 "knative.dev/eventing/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1" + fakesourcesv1alpha1 "knative.dev/eventing/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery + tracker testing.ObjectTracker +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +func (c *Clientset) Tracker() testing.ObjectTracker { + return c.tracker +} + +var _ clientset.Interface = &Clientset{} + +// SourcesV1alpha1 retrieves the SourcesV1alpha1Client +func (c *Clientset) SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface { + return &fakesourcesv1alpha1.FakeSourcesV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/legacyclient/clientset/versioned/fake/doc.go b/pkg/legacyclient/clientset/versioned/fake/doc.go new file mode 100644 index 00000000000..87f3c3e0b01 --- /dev/null +++ b/pkg/legacyclient/clientset/versioned/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 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 client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/legacyclient/clientset/versioned/fake/register.go b/pkg/legacyclient/clientset/versioned/fake/register.go new file mode 100644 index 00000000000..fecdc765e07 --- /dev/null +++ b/pkg/legacyclient/clientset/versioned/fake/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2019 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 client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + sourcesv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/pkg/legacyclient/clientset/versioned/scheme/doc.go b/pkg/legacyclient/clientset/versioned/scheme/doc.go new file mode 100644 index 00000000000..7d76538485b --- /dev/null +++ b/pkg/legacyclient/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 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 client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/pkg/legacyclient/clientset/versioned/scheme/register.go b/pkg/legacyclient/clientset/versioned/scheme/register.go new file mode 100644 index 00000000000..cdd39cf4209 --- /dev/null +++ b/pkg/legacyclient/clientset/versioned/scheme/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2019 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 client-gen. DO NOT EDIT. + +package scheme + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + sourcesv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/apiserversource.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/apiserversource.go similarity index 97% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/apiserversource.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/apiserversource.go index d0a6c4ef933..7499e3fc6b3 100644 --- a/pkg/client/clientset/versioned/typed/sources/v1alpha1/apiserversource.go +++ b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/apiserversource.go @@ -25,8 +25,8 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" - scheme "knative.dev/eventing/pkg/client/clientset/versioned/scheme" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" + scheme "knative.dev/eventing/pkg/legacyclient/clientset/versioned/scheme" ) // ApiServerSourcesGetter has a method to return a ApiServerSourceInterface. diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/containersource.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/containersource.go similarity index 97% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/containersource.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/containersource.go index d4b0e5c8101..6c42acce393 100644 --- a/pkg/client/clientset/versioned/typed/sources/v1alpha1/containersource.go +++ b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/containersource.go @@ -25,8 +25,8 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" - scheme "knative.dev/eventing/pkg/client/clientset/versioned/scheme" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" + scheme "knative.dev/eventing/pkg/legacyclient/clientset/versioned/scheme" ) // ContainerSourcesGetter has a method to return a ContainerSourceInterface. diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/cronjobsource.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/cronjobsource.go similarity index 97% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/cronjobsource.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/cronjobsource.go index 1f42256801a..cfa7e75bd53 100644 --- a/pkg/client/clientset/versioned/typed/sources/v1alpha1/cronjobsource.go +++ b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/cronjobsource.go @@ -25,8 +25,8 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" - scheme "knative.dev/eventing/pkg/client/clientset/versioned/scheme" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" + scheme "knative.dev/eventing/pkg/legacyclient/clientset/versioned/scheme" ) // CronJobSourcesGetter has a method to return a CronJobSourceInterface. diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/doc.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/doc.go similarity index 100% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/doc.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/doc.go diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/doc.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/doc.go similarity index 100% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/doc.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/doc.go diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_apiserversource.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_apiserversource.go similarity index 98% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_apiserversource.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_apiserversource.go index 6d30ebe9b90..ebc3823e8b4 100644 --- a/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_apiserversource.go +++ b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_apiserversource.go @@ -25,7 +25,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) // FakeApiServerSources implements ApiServerSourceInterface diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_containersource.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_containersource.go similarity index 98% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_containersource.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_containersource.go index 99c100fa259..2ee0f2a2bfc 100644 --- a/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_containersource.go +++ b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_containersource.go @@ -25,7 +25,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) // FakeContainerSources implements ContainerSourceInterface diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_cronjobsource.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_cronjobsource.go similarity index 98% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_cronjobsource.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_cronjobsource.go index 59a9680b9ce..e105221156f 100644 --- a/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_cronjobsource.go +++ b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_cronjobsource.go @@ -25,7 +25,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) // FakeCronJobSources implements CronJobSourceInterface diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_sources_client.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_legacysources_client.go similarity index 93% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_sources_client.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_legacysources_client.go index a69423c19ab..e4f570a56cb 100644 --- a/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_sources_client.go +++ b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_legacysources_client.go @@ -21,7 +21,7 @@ package fake import ( rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" - v1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1" + v1alpha1 "knative.dev/eventing/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1" ) type FakeSourcesV1alpha1 struct { diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_sinkbinding.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_sinkbinding.go similarity index 98% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_sinkbinding.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_sinkbinding.go index aeb1ad510fc..7f1fde04c43 100644 --- a/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_sinkbinding.go +++ b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake/fake_sinkbinding.go @@ -25,7 +25,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) // FakeSinkBindings implements SinkBindingInterface diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/generated_expansion.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/generated_expansion.go similarity index 100% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/generated_expansion.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/generated_expansion.go diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/sources_client.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/legacysources_client.go similarity index 95% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/sources_client.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/legacysources_client.go index 3c236920312..e2d52009160 100644 --- a/pkg/client/clientset/versioned/typed/sources/v1alpha1/sources_client.go +++ b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/legacysources_client.go @@ -20,8 +20,8 @@ package v1alpha1 import ( rest "k8s.io/client-go/rest" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" - "knative.dev/eventing/pkg/client/clientset/versioned/scheme" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" + "knative.dev/eventing/pkg/legacyclient/clientset/versioned/scheme" ) type SourcesV1alpha1Interface interface { diff --git a/pkg/client/clientset/versioned/typed/sources/v1alpha1/sinkbinding.go b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/sinkbinding.go similarity index 97% rename from pkg/client/clientset/versioned/typed/sources/v1alpha1/sinkbinding.go rename to pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/sinkbinding.go index ebffe551cdf..3a7a520aa4f 100644 --- a/pkg/client/clientset/versioned/typed/sources/v1alpha1/sinkbinding.go +++ b/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/sinkbinding.go @@ -25,8 +25,8 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" - scheme "knative.dev/eventing/pkg/client/clientset/versioned/scheme" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" + scheme "knative.dev/eventing/pkg/legacyclient/clientset/versioned/scheme" ) // SinkBindingsGetter has a method to return a SinkBindingInterface. diff --git a/pkg/legacyclient/informers/externalversions/factory.go b/pkg/legacyclient/informers/externalversions/factory.go new file mode 100644 index 00000000000..87a8d6d5458 --- /dev/null +++ b/pkg/legacyclient/informers/externalversions/factory.go @@ -0,0 +1,180 @@ +/* +Copyright 2019 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/legacyclient/clientset/versioned" + internalinterfaces "knative.dev/eventing/pkg/legacyclient/informers/externalversions/internalinterfaces" + legacysources "knative.dev/eventing/pkg/legacyclient/informers/externalversions/legacysources" +) + +// 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 + + 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 +} + +// 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 + } +} + +// 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 +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +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 +} + +// InternalInformerFor 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) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Sources() legacysources.Interface +} + +func (f *sharedInformerFactory) Sources() legacysources.Interface { + return legacysources.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/legacyclient/informers/externalversions/generic.go b/pkg/legacyclient/informers/externalversions/generic.go new file mode 100644 index 00000000000..2106c59b3ea --- /dev/null +++ b/pkg/legacyclient/informers/externalversions/generic.go @@ -0,0 +1,68 @@ +/* +Copyright 2019 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" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" +) + +// 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=sources.eventing.knative.dev, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("apiserversources"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1alpha1().ApiServerSources().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("containersources"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1alpha1().ContainerSources().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("cronjobsources"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1alpha1().CronJobSources().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("sinkbindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1alpha1().SinkBindings().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/pkg/legacyclient/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/legacyclient/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 00000000000..71dabb25bb0 --- /dev/null +++ b/pkg/legacyclient/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,40 @@ +/* +Copyright 2019 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/legacyclient/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/pkg/client/informers/externalversions/sources/interface.go b/pkg/legacyclient/informers/externalversions/legacysources/interface.go similarity index 87% rename from pkg/client/informers/externalversions/sources/interface.go rename to pkg/legacyclient/informers/externalversions/legacysources/interface.go index 543a0d8a50c..072fbf4567b 100644 --- a/pkg/client/informers/externalversions/sources/interface.go +++ b/pkg/legacyclient/informers/externalversions/legacysources/interface.go @@ -19,8 +19,8 @@ limitations under the License. package sources import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "knative.dev/eventing/pkg/client/informers/externalversions/sources/v1alpha1" + internalinterfaces "knative.dev/eventing/pkg/legacyclient/informers/externalversions/internalinterfaces" + v1alpha1 "knative.dev/eventing/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1" ) // Interface provides access to each of this group's versions. diff --git a/pkg/client/informers/externalversions/sources/v1alpha1/apiserversource.go b/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/apiserversource.go similarity index 87% rename from pkg/client/informers/externalversions/sources/v1alpha1/apiserversource.go rename to pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/apiserversource.go index 789a05ef492..767056e3420 100644 --- a/pkg/client/informers/externalversions/sources/v1alpha1/apiserversource.go +++ b/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/apiserversource.go @@ -25,10 +25,10 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/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/sources/v1alpha1" + legacysourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" + versioned "knative.dev/eventing/pkg/legacyclient/clientset/versioned" + internalinterfaces "knative.dev/eventing/pkg/legacyclient/informers/externalversions/internalinterfaces" + v1alpha1 "knative.dev/eventing/pkg/legacyclient/listers/legacysources/v1alpha1" ) // ApiServerSourceInformer provides access to a shared informer and lister for @@ -70,7 +70,7 @@ func NewFilteredApiServerSourceInformer(client versioned.Interface, namespace st return client.SourcesV1alpha1().ApiServerSources(namespace).Watch(options) }, }, - &sourcesv1alpha1.ApiServerSource{}, + &legacysourcesv1alpha1.ApiServerSource{}, resyncPeriod, indexers, ) @@ -81,7 +81,7 @@ func (f *apiServerSourceInformer) defaultInformer(client versioned.Interface, re } func (f *apiServerSourceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&sourcesv1alpha1.ApiServerSource{}, f.defaultInformer) + return f.factory.InformerFor(&legacysourcesv1alpha1.ApiServerSource{}, f.defaultInformer) } func (f *apiServerSourceInformer) Lister() v1alpha1.ApiServerSourceLister { diff --git a/pkg/client/informers/externalversions/sources/v1alpha1/containersource.go b/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/containersource.go similarity index 87% rename from pkg/client/informers/externalversions/sources/v1alpha1/containersource.go rename to pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/containersource.go index a769af737d7..3aea88f4933 100644 --- a/pkg/client/informers/externalversions/sources/v1alpha1/containersource.go +++ b/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/containersource.go @@ -25,10 +25,10 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/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/sources/v1alpha1" + legacysourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" + versioned "knative.dev/eventing/pkg/legacyclient/clientset/versioned" + internalinterfaces "knative.dev/eventing/pkg/legacyclient/informers/externalversions/internalinterfaces" + v1alpha1 "knative.dev/eventing/pkg/legacyclient/listers/legacysources/v1alpha1" ) // ContainerSourceInformer provides access to a shared informer and lister for @@ -70,7 +70,7 @@ func NewFilteredContainerSourceInformer(client versioned.Interface, namespace st return client.SourcesV1alpha1().ContainerSources(namespace).Watch(options) }, }, - &sourcesv1alpha1.ContainerSource{}, + &legacysourcesv1alpha1.ContainerSource{}, resyncPeriod, indexers, ) @@ -81,7 +81,7 @@ func (f *containerSourceInformer) defaultInformer(client versioned.Interface, re } func (f *containerSourceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&sourcesv1alpha1.ContainerSource{}, f.defaultInformer) + return f.factory.InformerFor(&legacysourcesv1alpha1.ContainerSource{}, f.defaultInformer) } func (f *containerSourceInformer) Lister() v1alpha1.ContainerSourceLister { diff --git a/pkg/client/informers/externalversions/sources/v1alpha1/cronjobsource.go b/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/cronjobsource.go similarity index 87% rename from pkg/client/informers/externalversions/sources/v1alpha1/cronjobsource.go rename to pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/cronjobsource.go index f0bd5cab942..16933b81787 100644 --- a/pkg/client/informers/externalversions/sources/v1alpha1/cronjobsource.go +++ b/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/cronjobsource.go @@ -25,10 +25,10 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/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/sources/v1alpha1" + legacysourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" + versioned "knative.dev/eventing/pkg/legacyclient/clientset/versioned" + internalinterfaces "knative.dev/eventing/pkg/legacyclient/informers/externalversions/internalinterfaces" + v1alpha1 "knative.dev/eventing/pkg/legacyclient/listers/legacysources/v1alpha1" ) // CronJobSourceInformer provides access to a shared informer and lister for @@ -70,7 +70,7 @@ func NewFilteredCronJobSourceInformer(client versioned.Interface, namespace stri return client.SourcesV1alpha1().CronJobSources(namespace).Watch(options) }, }, - &sourcesv1alpha1.CronJobSource{}, + &legacysourcesv1alpha1.CronJobSource{}, resyncPeriod, indexers, ) @@ -81,7 +81,7 @@ func (f *cronJobSourceInformer) defaultInformer(client versioned.Interface, resy } func (f *cronJobSourceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&sourcesv1alpha1.CronJobSource{}, f.defaultInformer) + return f.factory.InformerFor(&legacysourcesv1alpha1.CronJobSource{}, f.defaultInformer) } func (f *cronJobSourceInformer) Lister() v1alpha1.CronJobSourceLister { diff --git a/pkg/client/informers/externalversions/sources/v1alpha1/interface.go b/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/interface.go similarity index 95% rename from pkg/client/informers/externalversions/sources/v1alpha1/interface.go rename to pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/interface.go index 746fa19a67b..5a78c0ff1ff 100644 --- a/pkg/client/informers/externalversions/sources/v1alpha1/interface.go +++ b/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/interface.go @@ -19,7 +19,7 @@ limitations under the License. package v1alpha1 import ( - internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" + internalinterfaces "knative.dev/eventing/pkg/legacyclient/informers/externalversions/internalinterfaces" ) // Interface provides access to all the informers in this group version. diff --git a/pkg/client/informers/externalversions/sources/v1alpha1/sinkbinding.go b/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/sinkbinding.go similarity index 87% rename from pkg/client/informers/externalversions/sources/v1alpha1/sinkbinding.go rename to pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/sinkbinding.go index d2b68bd7c8f..12b4ffd9c16 100644 --- a/pkg/client/informers/externalversions/sources/v1alpha1/sinkbinding.go +++ b/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1/sinkbinding.go @@ -25,10 +25,10 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/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/sources/v1alpha1" + legacysourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" + versioned "knative.dev/eventing/pkg/legacyclient/clientset/versioned" + internalinterfaces "knative.dev/eventing/pkg/legacyclient/informers/externalversions/internalinterfaces" + v1alpha1 "knative.dev/eventing/pkg/legacyclient/listers/legacysources/v1alpha1" ) // SinkBindingInformer provides access to a shared informer and lister for @@ -70,7 +70,7 @@ func NewFilteredSinkBindingInformer(client versioned.Interface, namespace string return client.SourcesV1alpha1().SinkBindings(namespace).Watch(options) }, }, - &sourcesv1alpha1.SinkBinding{}, + &legacysourcesv1alpha1.SinkBinding{}, resyncPeriod, indexers, ) @@ -81,7 +81,7 @@ func (f *sinkBindingInformer) defaultInformer(client versioned.Interface, resync } func (f *sinkBindingInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&sourcesv1alpha1.SinkBinding{}, f.defaultInformer) + return f.factory.InformerFor(&legacysourcesv1alpha1.SinkBinding{}, f.defaultInformer) } func (f *sinkBindingInformer) Lister() v1alpha1.SinkBindingLister { diff --git a/pkg/legacyclient/injection/client/client.go b/pkg/legacyclient/injection/client/client.go new file mode 100644 index 00000000000..d4ac16a4d08 --- /dev/null +++ b/pkg/legacyclient/injection/client/client.go @@ -0,0 +1,49 @@ +/* +Copyright 2019 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 client + +import ( + "context" + + rest "k8s.io/client-go/rest" + versioned "knative.dev/eventing/pkg/legacyclient/clientset/versioned" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterClient(withClient) +} + +// Key is used as the key for associating information with a context.Context. +type Key struct{} + +func withClient(ctx context.Context, cfg *rest.Config) context.Context { + return context.WithValue(ctx, Key{}, versioned.NewForConfigOrDie(cfg)) +} + +// Get extracts the versioned.Interface client from the context. +func Get(ctx context.Context) versioned.Interface { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch knative.dev/eventing/pkg/legacyclient/clientset/versioned.Interface from context.") + } + return untyped.(versioned.Interface) +} diff --git a/pkg/legacyclient/injection/client/fake/fake.go b/pkg/legacyclient/injection/client/fake/fake.go new file mode 100644 index 00000000000..93ed11c512e --- /dev/null +++ b/pkg/legacyclient/injection/client/fake/fake.go @@ -0,0 +1,54 @@ +/* +Copyright 2019 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 fake + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/rest" + fake "knative.dev/eventing/pkg/legacyclient/clientset/versioned/fake" + client "knative.dev/eventing/pkg/legacyclient/injection/client" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Fake.RegisterClient(withClient) +} + +func withClient(ctx context.Context, cfg *rest.Config) context.Context { + ctx, _ = With(ctx) + return ctx +} + +func With(ctx context.Context, objects ...runtime.Object) (context.Context, *fake.Clientset) { + cs := fake.NewSimpleClientset(objects...) + return context.WithValue(ctx, client.Key{}, cs), cs +} + +// Get extracts the Kubernetes client from the context. +func Get(ctx context.Context) *fake.Clientset { + untyped := ctx.Value(client.Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch knative.dev/eventing/pkg/legacyclient/clientset/versioned/fake.Clientset from context.") + } + return untyped.(*fake.Clientset) +} diff --git a/pkg/legacyclient/injection/informers/factory/factory.go b/pkg/legacyclient/injection/informers/factory/factory.go new file mode 100644 index 00000000000..35714a7585d --- /dev/null +++ b/pkg/legacyclient/injection/informers/factory/factory.go @@ -0,0 +1,56 @@ +/* +Copyright 2019 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" + + externalversions "knative.dev/eventing/pkg/legacyclient/informers/externalversions" + client "knative.dev/eventing/pkg/legacyclient/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/legacyclient/informers/externalversions.SharedInformerFactory from context.") + } + return untyped.(externalversions.SharedInformerFactory) +} diff --git a/pkg/legacyclient/injection/informers/factory/fake/fake.go b/pkg/legacyclient/injection/informers/factory/fake/fake.go new file mode 100644 index 00000000000..5036c8d7465 --- /dev/null +++ b/pkg/legacyclient/injection/informers/factory/fake/fake.go @@ -0,0 +1,45 @@ +/* +Copyright 2019 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 fake + +import ( + "context" + + externalversions "knative.dev/eventing/pkg/legacyclient/informers/externalversions" + fake "knative.dev/eventing/pkg/legacyclient/injection/client/fake" + factory "knative.dev/eventing/pkg/legacyclient/injection/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = factory.Get + +func init() { + injection.Fake.RegisterInformerFactory(withInformerFactory) +} + +func withInformerFactory(ctx context.Context) context.Context { + c := fake.Get(ctx) + opts := make([]externalversions.SharedInformerOption, 0, 1) + if injection.HasNamespaceScope(ctx) { + opts = append(opts, externalversions.WithNamespace(injection.GetNamespaceScope(ctx))) + } + return context.WithValue(ctx, factory.Key{}, + externalversions.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), opts...)) +} diff --git a/pkg/client/injection/informers/sources/v1alpha1/apiserversource/apiserversource.go b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/apiserversource/apiserversource.go similarity index 81% rename from pkg/client/injection/informers/sources/v1alpha1/apiserversource/apiserversource.go rename to pkg/legacyclient/injection/informers/legacysources/v1alpha1/apiserversource/apiserversource.go index 91026652b04..a9b61357140 100644 --- a/pkg/client/injection/informers/sources/v1alpha1/apiserversource/apiserversource.go +++ b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/apiserversource/apiserversource.go @@ -21,8 +21,8 @@ package apiserversource import ( "context" - v1alpha1 "knative.dev/eventing/pkg/client/informers/externalversions/sources/v1alpha1" - factory "knative.dev/eventing/pkg/client/injection/informers/factory" + v1alpha1 "knative.dev/eventing/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1" + factory "knative.dev/eventing/pkg/legacyclient/injection/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -46,7 +46,7 @@ func Get(ctx context.Context) v1alpha1.ApiServerSourceInformer { untyped := ctx.Value(Key{}) if untyped == nil { logging.FromContext(ctx).Panic( - "Unable to fetch knative.dev/eventing/pkg/client/informers/externalversions/sources/v1alpha1.ApiServerSourceInformer from context.") + "Unable to fetch knative.dev/eventing/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1.ApiServerSourceInformer from context.") } return untyped.(v1alpha1.ApiServerSourceInformer) } diff --git a/pkg/client/injection/informers/sources/v1alpha1/apiserversource/fake/fake.go b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/apiserversource/fake/fake.go similarity index 84% rename from pkg/client/injection/informers/sources/v1alpha1/apiserversource/fake/fake.go rename to pkg/legacyclient/injection/informers/legacysources/v1alpha1/apiserversource/fake/fake.go index 0dcbbd55c90..130e966435d 100644 --- a/pkg/client/injection/informers/sources/v1alpha1/apiserversource/fake/fake.go +++ b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/apiserversource/fake/fake.go @@ -21,8 +21,8 @@ package fake import ( "context" - fake "knative.dev/eventing/pkg/client/injection/informers/factory/fake" - apiserversource "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/apiserversource" + fake "knative.dev/eventing/pkg/legacyclient/injection/informers/factory/fake" + apiserversource "knative.dev/eventing/pkg/legacyclient/injection/informers/legacysources/v1alpha1/apiserversource" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" ) diff --git a/pkg/client/injection/informers/sources/v1alpha1/containersource/containersource.go b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/containersource/containersource.go similarity index 81% rename from pkg/client/injection/informers/sources/v1alpha1/containersource/containersource.go rename to pkg/legacyclient/injection/informers/legacysources/v1alpha1/containersource/containersource.go index 5433cc6932c..0c0e34a0d51 100644 --- a/pkg/client/injection/informers/sources/v1alpha1/containersource/containersource.go +++ b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/containersource/containersource.go @@ -21,8 +21,8 @@ package containersource import ( "context" - v1alpha1 "knative.dev/eventing/pkg/client/informers/externalversions/sources/v1alpha1" - factory "knative.dev/eventing/pkg/client/injection/informers/factory" + v1alpha1 "knative.dev/eventing/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1" + factory "knative.dev/eventing/pkg/legacyclient/injection/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -46,7 +46,7 @@ func Get(ctx context.Context) v1alpha1.ContainerSourceInformer { untyped := ctx.Value(Key{}) if untyped == nil { logging.FromContext(ctx).Panic( - "Unable to fetch knative.dev/eventing/pkg/client/informers/externalversions/sources/v1alpha1.ContainerSourceInformer from context.") + "Unable to fetch knative.dev/eventing/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1.ContainerSourceInformer from context.") } return untyped.(v1alpha1.ContainerSourceInformer) } diff --git a/pkg/client/injection/informers/sources/v1alpha1/containersource/fake/fake.go b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/containersource/fake/fake.go similarity index 84% rename from pkg/client/injection/informers/sources/v1alpha1/containersource/fake/fake.go rename to pkg/legacyclient/injection/informers/legacysources/v1alpha1/containersource/fake/fake.go index eae06e2ceb7..189d43207e0 100644 --- a/pkg/client/injection/informers/sources/v1alpha1/containersource/fake/fake.go +++ b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/containersource/fake/fake.go @@ -21,8 +21,8 @@ package fake import ( "context" - fake "knative.dev/eventing/pkg/client/injection/informers/factory/fake" - containersource "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/containersource" + fake "knative.dev/eventing/pkg/legacyclient/injection/informers/factory/fake" + containersource "knative.dev/eventing/pkg/legacyclient/injection/informers/legacysources/v1alpha1/containersource" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" ) diff --git a/pkg/client/injection/informers/sources/v1alpha1/cronjobsource/cronjobsource.go b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/cronjobsource/cronjobsource.go similarity index 81% rename from pkg/client/injection/informers/sources/v1alpha1/cronjobsource/cronjobsource.go rename to pkg/legacyclient/injection/informers/legacysources/v1alpha1/cronjobsource/cronjobsource.go index 40604b417ae..cd7ad08c9ea 100644 --- a/pkg/client/injection/informers/sources/v1alpha1/cronjobsource/cronjobsource.go +++ b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/cronjobsource/cronjobsource.go @@ -21,8 +21,8 @@ package cronjobsource import ( "context" - v1alpha1 "knative.dev/eventing/pkg/client/informers/externalversions/sources/v1alpha1" - factory "knative.dev/eventing/pkg/client/injection/informers/factory" + v1alpha1 "knative.dev/eventing/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1" + factory "knative.dev/eventing/pkg/legacyclient/injection/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -46,7 +46,7 @@ func Get(ctx context.Context) v1alpha1.CronJobSourceInformer { untyped := ctx.Value(Key{}) if untyped == nil { logging.FromContext(ctx).Panic( - "Unable to fetch knative.dev/eventing/pkg/client/informers/externalversions/sources/v1alpha1.CronJobSourceInformer from context.") + "Unable to fetch knative.dev/eventing/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1.CronJobSourceInformer from context.") } return untyped.(v1alpha1.CronJobSourceInformer) } diff --git a/pkg/client/injection/informers/sources/v1alpha1/cronjobsource/fake/fake.go b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/cronjobsource/fake/fake.go similarity index 84% rename from pkg/client/injection/informers/sources/v1alpha1/cronjobsource/fake/fake.go rename to pkg/legacyclient/injection/informers/legacysources/v1alpha1/cronjobsource/fake/fake.go index 2fcee7338c7..91a91d0a86d 100644 --- a/pkg/client/injection/informers/sources/v1alpha1/cronjobsource/fake/fake.go +++ b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/cronjobsource/fake/fake.go @@ -21,8 +21,8 @@ package fake import ( "context" - fake "knative.dev/eventing/pkg/client/injection/informers/factory/fake" - cronjobsource "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/cronjobsource" + fake "knative.dev/eventing/pkg/legacyclient/injection/informers/factory/fake" + cronjobsource "knative.dev/eventing/pkg/legacyclient/injection/informers/legacysources/v1alpha1/cronjobsource" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" ) diff --git a/pkg/client/injection/informers/sources/v1alpha1/sinkbinding/fake/fake.go b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/sinkbinding/fake/fake.go similarity index 84% rename from pkg/client/injection/informers/sources/v1alpha1/sinkbinding/fake/fake.go rename to pkg/legacyclient/injection/informers/legacysources/v1alpha1/sinkbinding/fake/fake.go index ed6100db9fb..02399a0797f 100644 --- a/pkg/client/injection/informers/sources/v1alpha1/sinkbinding/fake/fake.go +++ b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/sinkbinding/fake/fake.go @@ -21,8 +21,8 @@ package fake import ( "context" - fake "knative.dev/eventing/pkg/client/injection/informers/factory/fake" - sinkbinding "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/sinkbinding" + fake "knative.dev/eventing/pkg/legacyclient/injection/informers/factory/fake" + sinkbinding "knative.dev/eventing/pkg/legacyclient/injection/informers/legacysources/v1alpha1/sinkbinding" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" ) diff --git a/pkg/client/injection/informers/sources/v1alpha1/sinkbinding/sinkbinding.go b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/sinkbinding/sinkbinding.go similarity index 81% rename from pkg/client/injection/informers/sources/v1alpha1/sinkbinding/sinkbinding.go rename to pkg/legacyclient/injection/informers/legacysources/v1alpha1/sinkbinding/sinkbinding.go index 1dd977c67d2..16ab6f62c6a 100644 --- a/pkg/client/injection/informers/sources/v1alpha1/sinkbinding/sinkbinding.go +++ b/pkg/legacyclient/injection/informers/legacysources/v1alpha1/sinkbinding/sinkbinding.go @@ -21,8 +21,8 @@ package sinkbinding import ( "context" - v1alpha1 "knative.dev/eventing/pkg/client/informers/externalversions/sources/v1alpha1" - factory "knative.dev/eventing/pkg/client/injection/informers/factory" + v1alpha1 "knative.dev/eventing/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1" + factory "knative.dev/eventing/pkg/legacyclient/injection/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -46,7 +46,7 @@ func Get(ctx context.Context) v1alpha1.SinkBindingInformer { untyped := ctx.Value(Key{}) if untyped == nil { logging.FromContext(ctx).Panic( - "Unable to fetch knative.dev/eventing/pkg/client/informers/externalversions/sources/v1alpha1.SinkBindingInformer from context.") + "Unable to fetch knative.dev/eventing/pkg/legacyclient/informers/externalversions/legacysources/v1alpha1.SinkBindingInformer from context.") } return untyped.(v1alpha1.SinkBindingInformer) } diff --git a/pkg/client/listers/sources/v1alpha1/apiserversource.go b/pkg/legacyclient/listers/legacysources/v1alpha1/apiserversource.go similarity index 98% rename from pkg/client/listers/sources/v1alpha1/apiserversource.go rename to pkg/legacyclient/listers/legacysources/v1alpha1/apiserversource.go index 570d031284e..fe11c10ee44 100644 --- a/pkg/client/listers/sources/v1alpha1/apiserversource.go +++ b/pkg/legacyclient/listers/legacysources/v1alpha1/apiserversource.go @@ -22,7 +22,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) // ApiServerSourceLister helps list ApiServerSources. diff --git a/pkg/client/listers/sources/v1alpha1/containersource.go b/pkg/legacyclient/listers/legacysources/v1alpha1/containersource.go similarity index 98% rename from pkg/client/listers/sources/v1alpha1/containersource.go rename to pkg/legacyclient/listers/legacysources/v1alpha1/containersource.go index f32aae8ada9..640bd33da98 100644 --- a/pkg/client/listers/sources/v1alpha1/containersource.go +++ b/pkg/legacyclient/listers/legacysources/v1alpha1/containersource.go @@ -22,7 +22,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) // ContainerSourceLister helps list ContainerSources. diff --git a/pkg/client/listers/sources/v1alpha1/cronjobsource.go b/pkg/legacyclient/listers/legacysources/v1alpha1/cronjobsource.go similarity index 98% rename from pkg/client/listers/sources/v1alpha1/cronjobsource.go rename to pkg/legacyclient/listers/legacysources/v1alpha1/cronjobsource.go index da3735e271b..0882b47399e 100644 --- a/pkg/client/listers/sources/v1alpha1/cronjobsource.go +++ b/pkg/legacyclient/listers/legacysources/v1alpha1/cronjobsource.go @@ -22,7 +22,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) // CronJobSourceLister helps list CronJobSources. diff --git a/pkg/client/listers/sources/v1alpha1/expansion_generated.go b/pkg/legacyclient/listers/legacysources/v1alpha1/expansion_generated.go similarity index 100% rename from pkg/client/listers/sources/v1alpha1/expansion_generated.go rename to pkg/legacyclient/listers/legacysources/v1alpha1/expansion_generated.go diff --git a/pkg/client/listers/sources/v1alpha1/sinkbinding.go b/pkg/legacyclient/listers/legacysources/v1alpha1/sinkbinding.go similarity index 98% rename from pkg/client/listers/sources/v1alpha1/sinkbinding.go rename to pkg/legacyclient/listers/legacysources/v1alpha1/sinkbinding.go index 581171287e5..9f6484b2843 100644 --- a/pkg/client/listers/sources/v1alpha1/sinkbinding.go +++ b/pkg/legacyclient/listers/legacysources/v1alpha1/sinkbinding.go @@ -22,7 +22,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + v1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) // SinkBindingLister helps list SinkBindings. diff --git a/pkg/reconciler/apiserversource/apiserversource.go b/pkg/reconciler/legacyapiserversource/apiserversource.go similarity index 98% rename from pkg/reconciler/apiserversource/apiserversource.go rename to pkg/reconciler/legacyapiserversource/apiserversource.go index 1c6036bacc0..a9c784bb734 100644 --- a/pkg/reconciler/apiserversource/apiserversource.go +++ b/pkg/reconciler/legacyapiserversource/apiserversource.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiserversource +package legacyapiserversource import ( "context" @@ -41,12 +41,12 @@ import ( "knative.dev/pkg/resolver" eventingv1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" eventinglisters "knative.dev/eventing/pkg/client/listers/eventing/v1alpha1" - listers "knative.dev/eventing/pkg/client/listers/sources/v1alpha1" + listers "knative.dev/eventing/pkg/legacyclient/listers/legacysources/v1alpha1" "knative.dev/eventing/pkg/logging" "knative.dev/eventing/pkg/reconciler" - "knative.dev/eventing/pkg/reconciler/apiserversource/resources" + "knative.dev/eventing/pkg/reconciler/legacyapiserversource/resources" ) const ( @@ -409,7 +409,7 @@ func (r *Reconciler) updateStatus(ctx context.Context, desired *v1alpha1.ApiServ existing := apiserversource.DeepCopy() existing.Status = desired.Status - cj, err := r.EventingClientSet.SourcesV1alpha1().ApiServerSources(desired.Namespace).UpdateStatus(existing) + cj, err := r.LegacyClientSet.SourcesV1alpha1().ApiServerSources(desired.Namespace).UpdateStatus(existing) if err == nil && becomesReady { duration := time.Since(cj.ObjectMeta.CreationTimestamp.Time) logging.FromContext(ctx).Info("ApiServerSource became ready after", zap.Duration("duration", duration)) diff --git a/pkg/reconciler/apiserversource/apiserversource_test.go b/pkg/reconciler/legacyapiserversource/apiserversource_test.go similarity index 99% rename from pkg/reconciler/apiserversource/apiserversource_test.go rename to pkg/reconciler/legacyapiserversource/apiserversource_test.go index 96ef5f8eb49..b92c3f63cec 100644 --- a/pkg/reconciler/apiserversource/apiserversource_test.go +++ b/pkg/reconciler/legacyapiserversource/apiserversource_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiserversource +package legacyapiserversource import ( "context" @@ -32,9 +32,9 @@ import ( clientgotesting "k8s.io/client-go/testing" "knative.dev/eventing/pkg/apis/eventing/v1alpha1" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/eventing/pkg/reconciler" - "knative.dev/eventing/pkg/reconciler/apiserversource/resources" + "knative.dev/eventing/pkg/reconciler/legacyapiserversource/resources" "knative.dev/eventing/pkg/utils" "knative.dev/pkg/apis" duckv1alpha1 "knative.dev/pkg/apis/duck/v1alpha1" @@ -863,7 +863,7 @@ func TestReconcile(t *testing.T) { ctx = addressable.WithDuck(ctx) r := &Reconciler{ Base: reconciler.NewBase(ctx, controllerAgentName, cmw), - apiserversourceLister: listers.GetApiServerSourceLister(), + apiserversourceLister: listers.GetLegacyApiServerSourceLister(), deploymentLister: listers.GetDeploymentLister(), eventTypeLister: listers.GetEventTypeLister(), source: source, diff --git a/pkg/reconciler/apiserversource/cfg_host.go b/pkg/reconciler/legacyapiserversource/cfg_host.go similarity index 97% rename from pkg/reconciler/apiserversource/cfg_host.go rename to pkg/reconciler/legacyapiserversource/cfg_host.go index 50ddb201ffb..875305ead16 100644 --- a/pkg/reconciler/apiserversource/cfg_host.go +++ b/pkg/reconciler/legacyapiserversource/cfg_host.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiserversource +package legacyapiserversource import ( "context" diff --git a/pkg/reconciler/apiserversource/controller.go b/pkg/reconciler/legacyapiserversource/controller.go similarity index 94% rename from pkg/reconciler/apiserversource/controller.go rename to pkg/reconciler/legacyapiserversource/controller.go index 54d447d27e8..96a49c8261c 100644 --- a/pkg/reconciler/apiserversource/controller.go +++ b/pkg/reconciler/legacyapiserversource/controller.go @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiserversource +package legacyapiserversource import ( "context" "github.com/kelseyhightower/envconfig" "k8s.io/client-go/tools/cache" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/eventing/pkg/reconciler" "knative.dev/pkg/configmap" "knative.dev/pkg/controller" @@ -29,7 +29,7 @@ import ( "knative.dev/pkg/resolver" eventtypeinformer "knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventtype" - apiserversourceinformer "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/apiserversource" + apiserversourceinformer "knative.dev/eventing/pkg/legacyclient/injection/informers/legacysources/v1alpha1/apiserversource" deploymentinformer "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment" "knative.dev/pkg/logging" diff --git a/pkg/reconciler/apiserversource/controller_test.go b/pkg/reconciler/legacyapiserversource/controller_test.go similarity index 93% rename from pkg/reconciler/apiserversource/controller_test.go rename to pkg/reconciler/legacyapiserversource/controller_test.go index bb4b5272651..b39eefbf5ed 100644 --- a/pkg/reconciler/apiserversource/controller_test.go +++ b/pkg/reconciler/legacyapiserversource/controller_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiserversource +package legacyapiserversource import ( "os" @@ -28,7 +28,7 @@ import ( // Fake injection informers _ "knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventtype/fake" - _ "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/apiserversource/fake" + _ "knative.dev/eventing/pkg/legacyclient/injection/informers/legacysources/v1alpha1/apiserversource/fake" "knative.dev/pkg/client/injection/ducks/duck/v1/addressable" _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" ) diff --git a/pkg/reconciler/apiserversource/doc.go b/pkg/reconciler/legacyapiserversource/doc.go similarity index 95% rename from pkg/reconciler/apiserversource/doc.go rename to pkg/reconciler/legacyapiserversource/doc.go index 02638d2eb7c..48036ded3b5 100644 --- a/pkg/reconciler/apiserversource/doc.go +++ b/pkg/reconciler/legacyapiserversource/doc.go @@ -15,4 +15,4 @@ limitations under the License. */ // Package apiserversource implements the ApiSource controller. -package apiserversource +package legacyapiserversource diff --git a/pkg/reconciler/apiserversource/resources/eventtype.go b/pkg/reconciler/legacyapiserversource/resources/eventtype.go similarity index 96% rename from pkg/reconciler/apiserversource/resources/eventtype.go rename to pkg/reconciler/legacyapiserversource/resources/eventtype.go index 76cecc0c1f9..31b44be85b0 100644 --- a/pkg/reconciler/apiserversource/resources/eventtype.go +++ b/pkg/reconciler/legacyapiserversource/resources/eventtype.go @@ -20,7 +20,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" eventingv1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/eventing/pkg/utils" ) diff --git a/pkg/reconciler/apiserversource/resources/labels.go b/pkg/reconciler/legacyapiserversource/resources/labels.go similarity index 100% rename from pkg/reconciler/apiserversource/resources/labels.go rename to pkg/reconciler/legacyapiserversource/resources/labels.go diff --git a/pkg/reconciler/apiserversource/resources/receive_adapter.go b/pkg/reconciler/legacyapiserversource/resources/receive_adapter.go similarity index 98% rename from pkg/reconciler/apiserversource/resources/receive_adapter.go rename to pkg/reconciler/legacyapiserversource/resources/receive_adapter.go index 30b9888ad72..87148fb006e 100644 --- a/pkg/reconciler/apiserversource/resources/receive_adapter.go +++ b/pkg/reconciler/legacyapiserversource/resources/receive_adapter.go @@ -22,7 +22,7 @@ import ( v1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/eventing/pkg/utils" "knative.dev/pkg/kmeta" ) diff --git a/pkg/reconciler/apiserversource/resources/receive_adapter_test.go b/pkg/reconciler/legacyapiserversource/resources/receive_adapter_test.go similarity index 98% rename from pkg/reconciler/apiserversource/resources/receive_adapter_test.go rename to pkg/reconciler/legacyapiserversource/resources/receive_adapter_test.go index 82403891d0f..fb090357157 100644 --- a/pkg/reconciler/apiserversource/resources/receive_adapter_test.go +++ b/pkg/reconciler/legacyapiserversource/resources/receive_adapter_test.go @@ -24,7 +24,7 @@ import ( v1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" _ "knative.dev/pkg/metrics/testing" ) diff --git a/pkg/reconciler/containersource/containersource.go b/pkg/reconciler/legacycontainersource/containersource.go similarity index 97% rename from pkg/reconciler/containersource/containersource.go rename to pkg/reconciler/legacycontainersource/containersource.go index 7fb7d648eb7..86e9f66a7e6 100644 --- a/pkg/reconciler/containersource/containersource.go +++ b/pkg/reconciler/legacycontainersource/containersource.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package containersource +package legacycontainersource import ( "context" @@ -38,11 +38,11 @@ import ( "knative.dev/pkg/controller" status "knative.dev/eventing/pkg/apis/duck" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" - listers "knative.dev/eventing/pkg/client/listers/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" + listers "knative.dev/eventing/pkg/legacyclient/listers/legacysources/v1alpha1" "knative.dev/eventing/pkg/logging" "knative.dev/eventing/pkg/reconciler" - "knative.dev/eventing/pkg/reconciler/containersource/resources" + "knative.dev/eventing/pkg/reconciler/legacycontainersource/resources" ) const ( @@ -310,7 +310,7 @@ func (r *Reconciler) updateStatus(ctx context.Context, desired *v1alpha1.Contain existing := source.DeepCopy() existing.Status = desired.Status - cj, err := r.EventingClientSet.SourcesV1alpha1().ContainerSources(desired.Namespace).UpdateStatus(existing) + cj, err := r.LegacyClientSet.SourcesV1alpha1().ContainerSources(desired.Namespace).UpdateStatus(existing) if err == nil && becomesReady { duration := time.Since(cj.ObjectMeta.CreationTimestamp.Time) r.Logger.Infof("ContainerSource %q became ready after %v", source.Name, duration) diff --git a/pkg/reconciler/containersource/containersource_test.go b/pkg/reconciler/legacycontainersource/containersource_test.go similarity index 99% rename from pkg/reconciler/containersource/containersource_test.go rename to pkg/reconciler/legacycontainersource/containersource_test.go index 9207d3e5bfd..d850720eb58 100644 --- a/pkg/reconciler/containersource/containersource_test.go +++ b/pkg/reconciler/legacycontainersource/containersource_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package containersource +package legacycontainersource import ( "context" @@ -39,7 +39,7 @@ import ( "knative.dev/pkg/configmap" "knative.dev/pkg/controller" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/eventing/pkg/reconciler" "knative.dev/eventing/pkg/utils" @@ -778,7 +778,7 @@ func TestAllCases(t *testing.T) { ctx = addressable.WithDuck(ctx) r := &Reconciler{ Base: reconciler.NewBase(ctx, controllerAgentName, cmw), - containerSourceLister: listers.GetContainerSourceLister(), + containerSourceLister: listers.GetLegacyContainerSourceLister(), deploymentLister: listers.GetDeploymentLister(), } r.sinkResolver = resolver.NewURIResolver(ctx, func(types.NamespacedName) {}) diff --git a/pkg/reconciler/containersource/controller.go b/pkg/reconciler/legacycontainersource/controller.go similarity index 91% rename from pkg/reconciler/containersource/controller.go rename to pkg/reconciler/legacycontainersource/controller.go index fa6144a60b5..448c0c9adab 100644 --- a/pkg/reconciler/containersource/controller.go +++ b/pkg/reconciler/legacycontainersource/controller.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package containersource +package legacycontainersource import ( "context" @@ -25,12 +25,12 @@ import ( "knative.dev/pkg/configmap" "knative.dev/pkg/controller" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/eventing/pkg/reconciler" deploymentinformer "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment" - containersourceinformer "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/containersource" + containersourceinformer "knative.dev/eventing/pkg/legacyclient/injection/informers/legacysources/v1alpha1/containersource" ) const ( diff --git a/pkg/reconciler/containersource/controller_test.go b/pkg/reconciler/legacycontainersource/controller_test.go similarity index 87% rename from pkg/reconciler/containersource/controller_test.go rename to pkg/reconciler/legacycontainersource/controller_test.go index 35ec7c185b0..dd1f88f9686 100644 --- a/pkg/reconciler/containersource/controller_test.go +++ b/pkg/reconciler/legacycontainersource/controller_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package containersource +package legacycontainersource import ( "testing" @@ -24,7 +24,7 @@ import ( . "knative.dev/pkg/reconciler/testing" // Fake injection informers - _ "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/containersource/fake" + _ "knative.dev/eventing/pkg/legacyclient/injection/informers/legacysources/v1alpha1/containersource/fake" _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" ) diff --git a/pkg/reconciler/containersource/doc.go b/pkg/reconciler/legacycontainersource/doc.go similarity index 95% rename from pkg/reconciler/containersource/doc.go rename to pkg/reconciler/legacycontainersource/doc.go index fa81f4b7843..5fc517a592b 100644 --- a/pkg/reconciler/containersource/doc.go +++ b/pkg/reconciler/legacycontainersource/doc.go @@ -15,4 +15,4 @@ limitations under the License. */ // Package containersource implements the ContainerSource controller. -package containersource +package legacycontainersource diff --git a/pkg/reconciler/containersource/resources/arguments.go b/pkg/reconciler/legacycontainersource/resources/arguments.go similarity index 95% rename from pkg/reconciler/containersource/resources/arguments.go rename to pkg/reconciler/legacycontainersource/resources/arguments.go index 0a3b213a3ef..0084c5197b6 100644 --- a/pkg/reconciler/containersource/resources/arguments.go +++ b/pkg/reconciler/legacycontainersource/resources/arguments.go @@ -18,7 +18,7 @@ package resources import ( corev1 "k8s.io/api/core/v1" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) type ContainerArguments struct { diff --git a/pkg/reconciler/containersource/resources/deployment.go b/pkg/reconciler/legacycontainersource/resources/deployment.go similarity index 100% rename from pkg/reconciler/containersource/resources/deployment.go rename to pkg/reconciler/legacycontainersource/resources/deployment.go diff --git a/pkg/reconciler/containersource/resources/deployment_test.go b/pkg/reconciler/legacycontainersource/resources/deployment_test.go similarity index 99% rename from pkg/reconciler/containersource/resources/deployment_test.go rename to pkg/reconciler/legacycontainersource/resources/deployment_test.go index 0a7f02390c5..68fc4107eed 100644 --- a/pkg/reconciler/containersource/resources/deployment_test.go +++ b/pkg/reconciler/legacycontainersource/resources/deployment_test.go @@ -20,7 +20,7 @@ import ( "fmt" "testing" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "github.com/google/go-cmp/cmp" appsv1 "k8s.io/api/apps/v1" diff --git a/pkg/reconciler/cronjobsource/controller.go b/pkg/reconciler/legacycronjobsource/controller.go similarity index 94% rename from pkg/reconciler/cronjobsource/controller.go rename to pkg/reconciler/legacycronjobsource/controller.go index 007b463a847..4884826c27f 100644 --- a/pkg/reconciler/cronjobsource/controller.go +++ b/pkg/reconciler/legacycronjobsource/controller.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cronjobsource +package legacycronjobsource import ( "context" @@ -29,9 +29,9 @@ import ( "knative.dev/pkg/logging" "knative.dev/pkg/metrics" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" eventtypeinformer "knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventtype" - cronjobsourceinformer "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/cronjobsource" + cronjobsourceinformer "knative.dev/eventing/pkg/legacyclient/injection/informers/legacysources/v1alpha1/cronjobsource" "knative.dev/eventing/pkg/reconciler" ) diff --git a/pkg/reconciler/cronjobsource/controller_test.go b/pkg/reconciler/legacycronjobsource/controller_test.go similarity index 95% rename from pkg/reconciler/cronjobsource/controller_test.go rename to pkg/reconciler/legacycronjobsource/controller_test.go index 1b6f5155551..243c931269c 100644 --- a/pkg/reconciler/cronjobsource/controller_test.go +++ b/pkg/reconciler/legacycronjobsource/controller_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cronjobsource +package legacycronjobsource import ( "os" @@ -27,7 +27,7 @@ import ( // Fake injection informers _ "knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventtype/fake" - _ "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/cronjobsource/fake" + _ "knative.dev/eventing/pkg/legacyclient/injection/informers/legacysources/v1alpha1/cronjobsource/fake" _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" ) diff --git a/pkg/reconciler/cronjobsource/cronjobsource.go b/pkg/reconciler/legacycronjobsource/cronjobsource.go similarity index 97% rename from pkg/reconciler/cronjobsource/cronjobsource.go rename to pkg/reconciler/legacycronjobsource/cronjobsource.go index af77b67023b..0c88dd6eeb8 100644 --- a/pkg/reconciler/cronjobsource/cronjobsource.go +++ b/pkg/reconciler/legacycronjobsource/cronjobsource.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cronjobsource +package legacycronjobsource import ( "context" @@ -39,12 +39,12 @@ import ( "knative.dev/pkg/metrics" eventingv1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" eventinglisters "knative.dev/eventing/pkg/client/listers/eventing/v1alpha1" - listers "knative.dev/eventing/pkg/client/listers/sources/v1alpha1" + listers "knative.dev/eventing/pkg/legacyclient/listers/legacysources/v1alpha1" "knative.dev/eventing/pkg/logging" "knative.dev/eventing/pkg/reconciler" - "knative.dev/eventing/pkg/reconciler/cronjobsource/resources" + "knative.dev/eventing/pkg/reconciler/legacycronjobsource/resources" ) var ( @@ -347,7 +347,7 @@ func (r *Reconciler) updateStatus(ctx context.Context, desired *v1alpha1.CronJob existing := cronjob.DeepCopy() existing.Status = desired.Status - cj, err := r.EventingClientSet.SourcesV1alpha1().CronJobSources(desired.Namespace).UpdateStatus(existing) + cj, err := r.LegacyClientSet.SourcesV1alpha1().CronJobSources(desired.Namespace).UpdateStatus(existing) if err == nil && becomesReady { duration := time.Since(cj.ObjectMeta.CreationTimestamp.Time) logging.FromContext(ctx).Info("CronJobSource became ready after", zap.Duration("duration", duration)) diff --git a/pkg/reconciler/cronjobsource/cronjobsource_test.go b/pkg/reconciler/legacycronjobsource/cronjobsource_test.go similarity index 98% rename from pkg/reconciler/cronjobsource/cronjobsource_test.go rename to pkg/reconciler/legacycronjobsource/cronjobsource_test.go index a4c16ec209d..883f29af1ec 100644 --- a/pkg/reconciler/cronjobsource/cronjobsource_test.go +++ b/pkg/reconciler/legacycronjobsource/cronjobsource_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cronjobsource +package legacycronjobsource import ( "context" @@ -40,9 +40,9 @@ import ( _ "knative.dev/pkg/client/injection/ducks/duck/v1beta1/addressable/fake" "knative.dev/pkg/controller" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/eventing/pkg/reconciler" - "knative.dev/eventing/pkg/reconciler/cronjobsource/resources" + "knative.dev/eventing/pkg/reconciler/legacycronjobsource/resources" "knative.dev/eventing/pkg/utils" logtesting "knative.dev/pkg/logging/testing" @@ -531,7 +531,7 @@ func TestAllCases(t *testing.T) { ctx = addressable.WithDuck(ctx) r := &Reconciler{ Base: reconciler.NewBase(ctx, controllerAgentName, cmw), - cronjobLister: listers.GetCronJobSourceLister(), + cronjobLister: listers.GetLegacyCronJobSourceLister(), deploymentLister: listers.GetDeploymentLister(), eventTypeLister: listers.GetEventTypeLister(), receiveAdapterImage: image, diff --git a/pkg/reconciler/cronjobsource/doc.go b/pkg/reconciler/legacycronjobsource/doc.go similarity index 95% rename from pkg/reconciler/cronjobsource/doc.go rename to pkg/reconciler/legacycronjobsource/doc.go index aa960fc7bad..a07c56d4726 100644 --- a/pkg/reconciler/cronjobsource/doc.go +++ b/pkg/reconciler/legacycronjobsource/doc.go @@ -15,4 +15,4 @@ limitations under the License. */ // Package cronjobsource implements the CronJobSource controller. -package cronjobsource +package legacycronjobsource diff --git a/pkg/reconciler/cronjobsource/resources/eventtype.go b/pkg/reconciler/legacycronjobsource/resources/eventtype.go similarity index 96% rename from pkg/reconciler/cronjobsource/resources/eventtype.go rename to pkg/reconciler/legacycronjobsource/resources/eventtype.go index 911eebcaf8e..261a136b7ea 100644 --- a/pkg/reconciler/cronjobsource/resources/eventtype.go +++ b/pkg/reconciler/legacycronjobsource/resources/eventtype.go @@ -21,7 +21,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" eventingv1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/eventing/pkg/utils" ) diff --git a/pkg/reconciler/cronjobsource/resources/labels.go b/pkg/reconciler/legacycronjobsource/resources/labels.go similarity index 100% rename from pkg/reconciler/cronjobsource/resources/labels.go rename to pkg/reconciler/legacycronjobsource/resources/labels.go diff --git a/pkg/reconciler/cronjobsource/resources/receive_adapter.go b/pkg/reconciler/legacycronjobsource/resources/receive_adapter.go similarity index 98% rename from pkg/reconciler/cronjobsource/resources/receive_adapter.go rename to pkg/reconciler/legacycronjobsource/resources/receive_adapter.go index c6d35d3f4fb..af8006a23c9 100644 --- a/pkg/reconciler/cronjobsource/resources/receive_adapter.go +++ b/pkg/reconciler/legacycronjobsource/resources/receive_adapter.go @@ -23,7 +23,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/eventing/pkg/utils" "knative.dev/pkg/kmeta" ) diff --git a/pkg/reconciler/cronjobsource/resources/receive_adapter_test.go b/pkg/reconciler/legacycronjobsource/resources/receive_adapter_test.go similarity index 98% rename from pkg/reconciler/cronjobsource/resources/receive_adapter_test.go rename to pkg/reconciler/legacycronjobsource/resources/receive_adapter_test.go index 5d0bb0e1626..95c970e28f3 100644 --- a/pkg/reconciler/cronjobsource/resources/receive_adapter_test.go +++ b/pkg/reconciler/legacycronjobsource/resources/receive_adapter_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/pkg/kmp" ) diff --git a/pkg/reconciler/sinkbinding/controller.go b/pkg/reconciler/legacysinkbinding/controller.go similarity index 94% rename from pkg/reconciler/sinkbinding/controller.go rename to pkg/reconciler/legacysinkbinding/controller.go index f4bd4f3a553..5764bdfa03b 100644 --- a/pkg/reconciler/sinkbinding/controller.go +++ b/pkg/reconciler/legacysinkbinding/controller.go @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package sinkbinding +package legacysinkbinding import ( "context" - fbinformer "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/sinkbinding" + fbinformer "knative.dev/eventing/pkg/legacyclient/injection/informers/legacysources/v1alpha1/sinkbinding" "knative.dev/pkg/client/injection/ducks/duck/v1/podspecable" "knative.dev/pkg/resolver" @@ -29,7 +29,7 @@ import ( "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/pkg/apis/duck" "knative.dev/pkg/configmap" "knative.dev/pkg/controller" diff --git a/pkg/reconciler/reconciler.go b/pkg/reconciler/reconciler.go index af719bfcdb0..a627453131c 100644 --- a/pkg/reconciler/reconciler.go +++ b/pkg/reconciler/reconciler.go @@ -30,12 +30,15 @@ import ( "k8s.io/client-go/tools/record" clientset "knative.dev/eventing/pkg/client/clientset/versioned" eventingScheme "knative.dev/eventing/pkg/client/clientset/versioned/scheme" + legacyclientset "knative.dev/eventing/pkg/legacyclient/clientset/versioned" + legacyScheme "knative.dev/eventing/pkg/legacyclient/clientset/versioned/scheme" "knative.dev/pkg/configmap" "knative.dev/pkg/controller" "knative.dev/pkg/logging" "knative.dev/pkg/logging/logkey" eventingclient "knative.dev/eventing/pkg/client/injection/client" + legacyclient "knative.dev/eventing/pkg/legacyclient/injection/client" kubeclient "knative.dev/pkg/client/injection/kube/client" "knative.dev/pkg/injection/clients/dynamicclient" ) @@ -48,6 +51,9 @@ type Base struct { // EventingClientSet allows us to configure Eventing objects EventingClientSet clientset.Interface + // LegacyClientSet allows us to configure Legacy Eventing objects + LegacyClientSet legacyclientset.Interface + // ApiExtensionsClientSet allows us to configure k8s API extension objects. ApiExtensionsClientSet apiextensionsclientset.Interface @@ -115,12 +121,12 @@ func NewBase(ctx context.Context, controllerAgentName string, cmw configmap.Watc base := &Base{ KubeClientSet: kubeClient, EventingClientSet: eventingclient.Get(ctx), - //ApiExtensionsClientSet: apiextclient.Get(ctx), - DynamicClientSet: dynamicclient.Get(ctx), - ConfigMapWatcher: cmw, - Recorder: recorder, - StatsReporter: statsReporter, - Logger: logger, + LegacyClientSet: legacyclient.Get(ctx), + DynamicClientSet: dynamicclient.Get(ctx), + ConfigMapWatcher: cmw, + Recorder: recorder, + StatsReporter: statsReporter, + Logger: logger, } return base @@ -130,4 +136,5 @@ func init() { // Add eventing types to the default Kubernetes Scheme so Events can be // logged for eventing types. eventingScheme.AddToScheme(scheme.Scheme) + legacyScheme.AddToScheme(scheme.Scheme) } diff --git a/pkg/reconciler/testing/apiserversource.go b/pkg/reconciler/testing/apiserversource.go index 5600b6ec33c..b7c846a619d 100644 --- a/pkg/reconciler/testing/apiserversource.go +++ b/pkg/reconciler/testing/apiserversource.go @@ -22,7 +22,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/eventing/pkg/utils" ) diff --git a/pkg/reconciler/testing/containersource.go b/pkg/reconciler/testing/containersource.go index d86c1b10871..92d829e6514 100644 --- a/pkg/reconciler/testing/containersource.go +++ b/pkg/reconciler/testing/containersource.go @@ -23,7 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" duckv1 "knative.dev/pkg/apis/duck/v1" "knative.dev/pkg/tracker" ) diff --git a/pkg/reconciler/testing/cronjobsource.go b/pkg/reconciler/testing/cronjobsource.go index 291aee28a7b..86dabbaa7f1 100644 --- a/pkg/reconciler/testing/cronjobsource.go +++ b/pkg/reconciler/testing/cronjobsource.go @@ -21,7 +21,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" + "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" ) // CronJobSourceOption enables further configuration of a CronJob. diff --git a/pkg/reconciler/testing/factory.go b/pkg/reconciler/testing/factory.go index b7a1372b3f9..76100354ea0 100644 --- a/pkg/reconciler/testing/factory.go +++ b/pkg/reconciler/testing/factory.go @@ -35,6 +35,7 @@ import ( "knative.dev/pkg/controller" fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake" + fakelegacyclient "knative.dev/eventing/pkg/legacyclient/injection/client/fake" fakekubeclient "knative.dev/pkg/client/injection/kube/client/fake" fakedynamicclient "knative.dev/pkg/injection/clients/dynamicclient/fake" @@ -60,6 +61,7 @@ func MakeFactory(ctor Ctor, unstructured bool, logger *zap.SugaredLogger) Factor ctx, kubeClient := fakekubeclient.With(ctx, ls.GetKubeObjects()...) ctx, client := fakeeventingclient.With(ctx, ls.GetEventingObjects()...) + ctx, legacy := fakelegacyclient.With(ctx, ls.GetLegacyObjects()...) ctx, dynamicClient := fakedynamicclient.With(ctx, NewScheme(), ToUnstructured(t, r.Objects)...) @@ -87,10 +89,11 @@ func MakeFactory(ctor Ctor, unstructured bool, logger *zap.SugaredLogger) Factor for _, reactor := range r.WithReactors { kubeClient.PrependReactor("*", "*", reactor) client.PrependReactor("*", "*", reactor) + legacy.PrependReactor("*", "*", reactor) dynamicClient.PrependReactor("*", "*", reactor) } - // Validate all Create operations through the serving client. + // Validate all Create operations through the eventing client. client.PrependReactor("create", "*", func(action ktesting.Action) (handled bool, ret runtime.Object, err error) { return ValidateCreates(ctx, action) }) @@ -98,7 +101,15 @@ func MakeFactory(ctor Ctor, unstructured bool, logger *zap.SugaredLogger) Factor return ValidateUpdates(ctx, action) }) - actionRecorderList := ActionRecorderList{dynamicClient, client, kubeClient} + // Validate all Create operations through the legacy client. + legacy.PrependReactor("create", "*", func(action ktesting.Action) (handled bool, ret runtime.Object, err error) { + return ValidateCreates(ctx, action) + }) + legacy.PrependReactor("update", "*", func(action ktesting.Action) (handled bool, ret runtime.Object, err error) { + return ValidateUpdates(ctx, action) + }) + + actionRecorderList := ActionRecorderList{dynamicClient, client, kubeClient, legacy} eventList := EventList{Recorder: eventRecorder} return c, actionRecorderList, eventList, statsReporter diff --git a/pkg/reconciler/testing/listers.go b/pkg/reconciler/testing/listers.go index 9e1c8d9a42b..173747eeff2 100644 --- a/pkg/reconciler/testing/listers.go +++ b/pkg/reconciler/testing/listers.go @@ -33,13 +33,14 @@ import ( "k8s.io/client-go/tools/cache" eventingv1alpha1 "knative.dev/eventing/pkg/apis/eventing/v1alpha1" flowsv1alpha1 "knative.dev/eventing/pkg/apis/flows/v1alpha1" + legacysourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" messagingv1alpha1 "knative.dev/eventing/pkg/apis/messaging/v1alpha1" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" fakeeventingclientset "knative.dev/eventing/pkg/client/clientset/versioned/fake" eventinglisters "knative.dev/eventing/pkg/client/listers/eventing/v1alpha1" flowslisters "knative.dev/eventing/pkg/client/listers/flows/v1alpha1" messaginglisters "knative.dev/eventing/pkg/client/listers/messaging/v1alpha1" - sourcelisters "knative.dev/eventing/pkg/client/listers/sources/v1alpha1" + fakelegacyclientset "knative.dev/eventing/pkg/legacyclient/clientset/versioned/fake" + legacysourcelisters "knative.dev/eventing/pkg/legacyclient/listers/legacysources/v1alpha1" "knative.dev/pkg/reconciler/testing" ) @@ -51,6 +52,7 @@ var subscriberAddToScheme = func(scheme *runtime.Scheme) error { var clientSetSchemes = []func(*runtime.Scheme) error{ fakekubeclientset.AddToScheme, fakeeventingclientset.AddToScheme, + fakelegacyclientset.AddToScheme, fakeapiextensionsclientset.AddToScheme, subscriberAddToScheme, } @@ -96,6 +98,10 @@ func (l *Listers) GetEventingObjects() []runtime.Object { return l.sorter.ObjectsForSchemeFunc(fakeeventingclientset.AddToScheme) } +func (l *Listers) GetLegacyObjects() []runtime.Object { + return l.sorter.ObjectsForSchemeFunc(fakelegacyclientset.AddToScheme) +} + func (l *Listers) GetSubscriberObjects() []runtime.Object { return l.sorter.ObjectsForSchemeFunc(subscriberAddToScheme) } @@ -103,6 +109,7 @@ func (l *Listers) GetSubscriberObjects() []runtime.Object { func (l *Listers) GetAllObjects() []runtime.Object { all := l.GetSubscriberObjects() all = append(all, l.GetEventingObjects()...) + all = append(all, l.GetLegacyObjects()...) all = append(all, l.GetKubeObjects()...) return all } @@ -147,16 +154,16 @@ func (l *Listers) GetFlowsParallelLister() flowslisters.ParallelLister { return flowslisters.NewParallelLister(l.indexerFor(&flowsv1alpha1.Parallel{})) } -func (l *Listers) GetCronJobSourceLister() sourcelisters.CronJobSourceLister { - return sourcelisters.NewCronJobSourceLister(l.indexerFor(&sourcesv1alpha1.CronJobSource{})) +func (l *Listers) GetLegacyCronJobSourceLister() legacysourcelisters.CronJobSourceLister { + return legacysourcelisters.NewCronJobSourceLister(l.indexerFor(&legacysourcesv1alpha1.CronJobSource{})) } -func (l *Listers) GetApiServerSourceLister() sourcelisters.ApiServerSourceLister { - return sourcelisters.NewApiServerSourceLister(l.indexerFor(&sourcesv1alpha1.ApiServerSource{})) +func (l *Listers) GetLegacyApiServerSourceLister() legacysourcelisters.ApiServerSourceLister { + return legacysourcelisters.NewApiServerSourceLister(l.indexerFor(&legacysourcesv1alpha1.ApiServerSource{})) } -func (l *Listers) GetContainerSourceLister() sourcelisters.ContainerSourceLister { - return sourcelisters.NewContainerSourceLister(l.indexerFor(&sourcesv1alpha1.ContainerSource{})) +func (l *Listers) GetLegacyContainerSourceLister() legacysourcelisters.ContainerSourceLister { + return legacysourcelisters.NewContainerSourceLister(l.indexerFor(&legacysourcesv1alpha1.ContainerSource{})) } func (l *Listers) GetDeploymentLister() appsv1listers.DeploymentLister { diff --git a/pkg/reconciler/trigger/trigger_test.go b/pkg/reconciler/trigger/trigger_test.go index baec196d529..70f98769e95 100644 --- a/pkg/reconciler/trigger/trigger_test.go +++ b/pkg/reconciler/trigger/trigger_test.go @@ -43,8 +43,8 @@ import ( "knative.dev/pkg/tracker" "knative.dev/eventing/pkg/apis/eventing/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" messagingv1alpha1 "knative.dev/eventing/pkg/apis/messaging/v1alpha1" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" "knative.dev/eventing/pkg/reconciler" brokerresources "knative.dev/eventing/pkg/reconciler/broker/resources" reconciletesting "knative.dev/eventing/pkg/reconciler/testing" diff --git a/test/common/client.go b/test/common/client.go index 34733cf66ac..cc01f00b12f 100644 --- a/test/common/client.go +++ b/test/common/client.go @@ -25,6 +25,7 @@ import ( "k8s.io/client-go/dynamic" "k8s.io/client-go/rest" eventing "knative.dev/eventing/pkg/client/clientset/versioned" + legacy "knative.dev/eventing/pkg/legacyclient/clientset/versioned" "knative.dev/pkg/test" ) @@ -32,6 +33,7 @@ import ( type Client struct { Kube *test.KubeClient Eventing *eventing.Clientset + Legacy *legacy.Clientset Dynamic dynamic.Interface Config *rest.Config @@ -62,6 +64,11 @@ func NewClient(configPath string, clusterName string, namespace string, t *testi return nil, err } + client.Legacy, err = legacy.NewForConfig(client.Config) + if err != nil { + return nil, err + } + client.Dynamic, err = dynamic.NewForConfig(client.Config) if err != nil { return nil, err diff --git a/test/common/creation.go b/test/common/creation.go index 31e873a83c4..4847778a759 100644 --- a/test/common/creation.go +++ b/test/common/creation.go @@ -27,8 +27,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/eventing/pkg/apis/eventing/v1alpha1" flowsv1alpha1 "knative.dev/eventing/pkg/apis/flows/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" messagingv1alpha1 "knative.dev/eventing/pkg/apis/messaging/v1alpha1" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" "knative.dev/eventing/pkg/utils" "knative.dev/eventing/test/base" "knative.dev/eventing/test/base/resources" @@ -179,9 +179,9 @@ func (client *Client) CreateFlowsParallelOrFail(parallel *flowsv1alpha1.Parallel client.Tracker.AddObj(parallel) } -// CreateCronJobSourceOrFail will create a CronJobSource or fail the test if there is an error. -func (client *Client) CreateCronJobSourceOrFail(cronJobSource *sourcesv1alpha1.CronJobSource) { - cronJobSourceInterface := client.Eventing.SourcesV1alpha1().CronJobSources(client.Namespace) +// CreateLegacyCronJobSourceOrFail will create a CronJobSource or fail the test if there is an error. +func (client *Client) CreateLegacyCronJobSourceOrFail(cronJobSource *sourcesv1alpha1.CronJobSource) { + cronJobSourceInterface := client.Legacy.SourcesV1alpha1().CronJobSources(client.Namespace) _, err := cronJobSourceInterface.Create(cronJobSource) if err != nil { client.T.Fatalf("Failed to create cronjobsource %q: %v", cronJobSource.Name, err) @@ -189,9 +189,9 @@ func (client *Client) CreateCronJobSourceOrFail(cronJobSource *sourcesv1alpha1.C client.Tracker.AddObj(cronJobSource) } -// CreateContainerSourceOrFail will create a ContainerSource or fail the test if there is an error. -func (client *Client) CreateContainerSourceOrFail(containerSource *sourcesv1alpha1.ContainerSource) { - containerSourceInterface := client.Eventing.SourcesV1alpha1().ContainerSources(client.Namespace) +// CreateLegacyContainerSourceOrFail will create a ContainerSource or fail the test if there is an error. +func (client *Client) CreateLegacyContainerSourceOrFail(containerSource *sourcesv1alpha1.ContainerSource) { + containerSourceInterface := client.Legacy.SourcesV1alpha1().ContainerSources(client.Namespace) _, err := containerSourceInterface.Create(containerSource) if err != nil { client.T.Fatalf("Failed to create containersource %q: %v", containerSource.Name, err) @@ -199,9 +199,9 @@ func (client *Client) CreateContainerSourceOrFail(containerSource *sourcesv1alph client.Tracker.AddObj(containerSource) } -// CreateSinkBindingOrFail will create a SinkBinding or fail the test if there is an error. -func (client *Client) CreateSinkBindingOrFail(containerSource *sourcesv1alpha1.SinkBinding) { - containerSourceInterface := client.Eventing.SourcesV1alpha1().SinkBindings(client.Namespace) +// CreateLegacySinkBindingOrFail will create a SinkBinding or fail the test if there is an error. +func (client *Client) CreateLegacySinkBindingOrFail(containerSource *sourcesv1alpha1.SinkBinding) { + containerSourceInterface := client.Legacy.SourcesV1alpha1().SinkBindings(client.Namespace) _, err := containerSourceInterface.Create(containerSource) if err != nil { client.T.Fatalf("Failed to create containersource %q: %v", containerSource.Name, err) @@ -209,9 +209,9 @@ func (client *Client) CreateSinkBindingOrFail(containerSource *sourcesv1alpha1.S client.Tracker.AddObj(containerSource) } -// CreateApiServerSourceOrFail will create an ApiServerSource -func (client *Client) CreateApiServerSourceOrFail(apiServerSource *sourcesv1alpha1.ApiServerSource) { - apiServerInterface := client.Eventing.SourcesV1alpha1().ApiServerSources(client.Namespace) +// CreateLegacyApiServerSourceOrFail will create an ApiServerSource +func (client *Client) CreateLegacyApiServerSourceOrFail(apiServerSource *sourcesv1alpha1.ApiServerSource) { + apiServerInterface := client.Legacy.SourcesV1alpha1().ApiServerSources(client.Namespace) _, err := apiServerInterface.Create(apiServerSource) if err != nil { client.T.Fatalf("Failed to create apiserversource %q: %v", apiServerSource.Name, err) diff --git a/test/e2e/sinkbinding_test.go b/test/e2e/sinkbinding_test.go index 8ffff673159..4d813c85854 100644 --- a/test/e2e/sinkbinding_test.go +++ b/test/e2e/sinkbinding_test.go @@ -65,7 +65,7 @@ func TestSinkBindingDeployment(t *testing.T) { Name: deploymentName, }), ) - client.CreateSinkBindingOrFail(sinkBinding) + client.CreateLegacySinkBindingOrFail(sinkBinding) data := fmt.Sprintf("TestSinkBindingDeployment%s", uuid.NewUUID()) client.CreateDeploymentOrFail(&appsv1.Deployment{ @@ -149,7 +149,7 @@ func TestSinkBindingCronJob(t *testing.T) { }, }), ) - client.CreateSinkBindingOrFail(sinkBinding) + client.CreateLegacySinkBindingOrFail(sinkBinding) data := fmt.Sprintf("TestSinkBindingCronJob%s", uuid.NewUUID()) client.CreateCronJobOrFail(&batchv1beta1.CronJob{ diff --git a/test/e2e/source_api_server_test.go b/test/e2e/source_api_server_test.go index 617a851ac89..dc18400eeba 100644 --- a/test/e2e/source_api_server_test.go +++ b/test/e2e/source_api_server_test.go @@ -25,7 +25,7 @@ import ( corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" "knative.dev/eventing/test/base/resources" "knative.dev/eventing/test/common" duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" @@ -158,7 +158,7 @@ func TestApiServerSource(t *testing.T) { eventingtesting.WithApiServerSourceSpec(tc.spec), ) - client.CreateApiServerSourceOrFail(apiServerSource) + client.CreateLegacyApiServerSourceOrFail(apiServerSource) // wait for all test resources to be ready if err := client.WaitForAllTestResourcesReady(); err != nil { diff --git a/test/e2e/source_container_test.go b/test/e2e/source_container_test.go index de95e739153..c93f71d4cd4 100644 --- a/test/e2e/source_container_test.go +++ b/test/e2e/source_container_test.go @@ -25,7 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/uuid" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" eventingtesting "knative.dev/eventing/pkg/reconciler/testing" "knative.dev/eventing/test/base/resources" "knative.dev/eventing/test/common" @@ -83,7 +83,7 @@ func TestContainerSource(t *testing.T) { Sink: &duckv1beta1.Destination{Ref: resources.ServiceRef(loggerPodName)}, }), ) - client.CreateContainerSourceOrFail(containerSource) + client.CreateLegacyContainerSourceOrFail(containerSource) // wait for all test resources to be ready if err := client.WaitForAllTestResourcesReady(); err != nil { diff --git a/test/e2e/source_cron_job_test.go b/test/e2e/source_cron_job_test.go index 7f68fc9ff44..26c14f3e46d 100644 --- a/test/e2e/source_cron_job_test.go +++ b/test/e2e/source_cron_job_test.go @@ -24,7 +24,7 @@ import ( "k8s.io/apimachinery/pkg/util/uuid" duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" - sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" + sourcesv1alpha1 "knative.dev/eventing/pkg/apis/legacysources/v1alpha1" eventingtesting "knative.dev/eventing/pkg/reconciler/testing" "knative.dev/eventing/test/base/resources" "knative.dev/eventing/test/common" @@ -57,7 +57,7 @@ func TestCronJobSource(t *testing.T) { Sink: &duckv1beta1.Destination{Ref: resources.ServiceRef(loggerPodName)}, }), ) - client.CreateCronJobSourceOrFail(cronJobSource) + client.CreateLegacyCronJobSourceOrFail(cronJobSource) // wait for all test resources to be ready if err := client.WaitForAllTestResourcesReady(); err != nil {