Skip to content

Commit

Permalink
Migrate current sources to legacy (#2336)
Browse files Browse the repository at this point in the history
  • Loading branch information
n3wscott authored and knative-prow-robot committed Dec 20, 2019
1 parent 5631d77 commit d4433cd
Show file tree
Hide file tree
Showing 142 changed files with 1,065 additions and 227 deletions.
12 changes: 6 additions & 6 deletions cmd/sources_controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
10 changes: 5 additions & 5 deletions cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,

Expand All @@ -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,
Expand All @@ -180,6 +180,6 @@ func main() {
NewDefaultingAdmissionController,

// For each binding we have a controller and a binding webhook.
sinkbinding.NewController, NewSinkBindingWebhook,
legacysinkbinding.NewController, NewSinkBindingWebhook,
)
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 14 additions & 2 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/apiserver/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/apiserver/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/apiserver/ref_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/apiserver/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/cronjobevents/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ 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"
"k8s.io/apimachinery/pkg/runtime/schema"
)

// 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 {
Expand Down
File renamed without changes.
14 changes: 0 additions & 14 deletions pkg/client/clientset/versioned/clientset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions pkg/client/clientset/versioned/fake/clientset_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/client/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions pkg/client/informers/externalversions/factory.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions pkg/client/informers/externalversions/generic.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d4433cd

Please sign in to comment.