Skip to content

Commit

Permalink
Remove vendor dependency on serving and build (#319)
Browse files Browse the repository at this point in the history
* Remove vendor dependency on serving and build

The istio client has moved to knative/pkg, we can depend on that without
needing to vendor the remainder of knative/serving. The knative/build
dependency was effectively unused.

Refs: knative/pkg#1

* Update to a proper knative/pkg refspec

Also updated names of istio* to shared* where appropriate.

* Fix nil pointer dereference
  • Loading branch information
scothis authored and knative-prow-robot committed Aug 6, 2018
1 parent d53a612 commit 8043ed8
Show file tree
Hide file tree
Showing 96 changed files with 234 additions and 7,476 deletions.
331 changes: 43 additions & 288 deletions Gopkg.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ required = [
revision = "90f2606161ee6a14efe2ca79fc05ac2b8efe250b"

[[constraint]]
name = "github.com/knative/serving"
# HEAD as of 2018-07-16
revision = "2326173b13899c32896caf526a318a8b30033b3e"
name = "github.com/knative/pkg"
# HEAD as of 2018-08-03
revision = "a088fee6227f7c6842ce7f7406cb75af8a6e0643"

[[override]]
name = "github.com/Shopify/sarama"
Expand Down
6 changes: 1 addition & 5 deletions cmd/controller-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"flag"
"log"

buildv1alpha1 "github.com/knative/build/pkg/apis/build/v1alpha1"
channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1"
feedsv1alpha1 "github.com/knative/eventing/pkg/apis/feeds/v1alpha1"
flowsv1alpha1 "github.com/knative/eventing/pkg/apis/flows/v1alpha1"
Expand All @@ -31,8 +30,7 @@ import (
"github.com/knative/pkg/logging"
"github.com/knative/pkg/logging/logkey"

istiov1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3"
servingv1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1"
istiov1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3"
"go.uber.org/zap"

"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -103,12 +101,10 @@ func main() {

// Add custom types to this array to get them into the manager's scheme.
schemeFuncs := []SchemeFunc{
buildv1alpha1.AddToScheme,
channelsv1alpha1.AddToScheme,
feedsv1alpha1.AddToScheme,
flowsv1alpha1.AddToScheme,
istiov1alpha3.AddToScheme,
servingv1alpha1.AddToScheme,
}
for _, schemeFunc := range schemeFuncs {
schemeFunc(mrg.GetScheme())
Expand Down
18 changes: 9 additions & 9 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ 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"

servingclientset "github.com/knative/serving/pkg/client/clientset/versioned"
servinginformers "github.com/knative/serving/pkg/client/informers/externalversions"

clientset "github.com/knative/eventing/pkg/client/clientset/versioned"
informers "github.com/knative/eventing/pkg/client/informers/externalversions"
"github.com/knative/eventing/pkg/controller"
"github.com/knative/eventing/pkg/controller/bus"
"github.com/knative/eventing/pkg/controller/channel"
"github.com/knative/eventing/pkg/controller/clusterbus"
"github.com/knative/eventing/pkg/signals"
sharedclientset "github.com/knative/pkg/client/clientset/versioned"
sharedinformers "github.com/knative/pkg/client/informers/externalversions"

"log"

"github.com/knative/eventing/pkg/logconfig"
"github.com/knative/eventing/pkg/system"
Expand All @@ -47,7 +48,6 @@ import (
"github.com/knative/pkg/logging/logkey"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.uber.org/zap"
"log"
)

const (
Expand Down Expand Up @@ -97,9 +97,9 @@ func main() {
logger.Fatalf("Error building clientset: %s", err.Error())
}

servingClient, err := servingclientset.NewForConfig(cfg)
sharedClient, err := sharedclientset.NewForConfig(cfg)
if err != nil {
logger.Fatalf("Error building serving clientset: %s", err.Error())
logger.Fatalf("Error building shared clientset: %s", err.Error())
}

// TODO: Rip this out from all the controllers since we can get it
Expand All @@ -113,7 +113,7 @@ func main() {

kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClient, time.Second*30)
informerFactory := informers.NewSharedInformerFactory(client, time.Second*30)
servingInformerFactory := servinginformers.NewSharedInformerFactory(servingClient, time.Second*30)
sharedInformerFactory := sharedinformers.NewSharedInformerFactory(sharedClient, time.Second*30)

// Watch the logging config map and dynamically update logging levels.
configMapWatcher := configmap.NewDefaultWatcher(kubeClient, system.Namespace)
Expand All @@ -134,12 +134,12 @@ func main() {
controllers := make([]controller.Interface, 0, len(ctors))
for _, ctor := range ctors {
controllers = append(controllers,
ctor(kubeClient, client, servingClient, restConfig, kubeInformerFactory, informerFactory, servingInformerFactory))
ctor(kubeClient, client, sharedClient, restConfig, kubeInformerFactory, informerFactory, sharedInformerFactory))
}

go kubeInformerFactory.Start(stopCh)
go informerFactory.Start(stopCh)
go servingInformerFactory.Start(stopCh)
go sharedInformerFactory.Start(stopCh)

// Start all of the controllers.
for _, ctrlr := range controllers {
Expand Down
9 changes: 4 additions & 5 deletions pkg/controller/bus/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ import (
channelscheme "github.com/knative/eventing/pkg/client/clientset/versioned/scheme"
informers "github.com/knative/eventing/pkg/client/informers/externalversions"
listers "github.com/knative/eventing/pkg/client/listers/channels/v1alpha1"

servingclientset "github.com/knative/serving/pkg/client/clientset/versioned"
servinginformers "github.com/knative/serving/pkg/client/informers/externalversions"
sharedclientset "github.com/knative/pkg/client/clientset/versioned"
sharedinformers "github.com/knative/pkg/client/informers/externalversions"

channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1"
"github.com/knative/eventing/pkg/controller/util"
Expand Down Expand Up @@ -117,11 +116,11 @@ type Controller struct {
func NewController(
kubeclientset kubernetes.Interface,
busclientset clientset.Interface,
servingclientset servingclientset.Interface,
sharedclientset sharedclientset.Interface,
restConfig *rest.Config,
kubeInformerFactory kubeinformers.SharedInformerFactory,
busInformerFactory informers.SharedInformerFactory,
routeInformerFactory servinginformers.SharedInformerFactory) controller.Interface {
istioInformerFactory sharedinformers.SharedInformerFactory) controller.Interface {

// obtain references to shared index informers for the Bus, Deployment and Service
// types.
Expand Down
22 changes: 11 additions & 11 deletions pkg/controller/channel/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/golang/glog"
"github.com/knative/eventing/pkg/controller"
istiolisters "github.com/knative/serving/pkg/client/listers/istio/v1alpha3"
istiolisters "github.com/knative/pkg/client/listers/istio/v1alpha3"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -44,12 +44,12 @@ import (
informers "github.com/knative/eventing/pkg/client/informers/externalversions"
listers "github.com/knative/eventing/pkg/client/listers/channels/v1alpha1"
"github.com/knative/eventing/pkg/system"
servingclientset "github.com/knative/serving/pkg/client/clientset/versioned"
servinginformers "github.com/knative/serving/pkg/client/informers/externalversions"
sharedclientset "github.com/knative/pkg/client/clientset/versioned"
sharedinformers "github.com/knative/pkg/client/informers/externalversions"

channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1"
"github.com/knative/eventing/pkg/controller/util"
istiov1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3"
istiov1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3"
)

const controllerAgentName = "channel-controller"
Expand Down Expand Up @@ -91,8 +91,8 @@ type Controller struct {
kubeclientset kubernetes.Interface
// channelclientset is a clientset for our own API group
channelclientset clientset.Interface
// servingclientset is a clientset for serving API groups
servingclientset servingclientset.Interface
// sharedclientset is a clientset for shared API groups
sharedclientset sharedclientset.Interface

virtualservicesLister istiolisters.VirtualServiceLister
virtualservicesSynced cache.InformerSynced
Expand All @@ -116,14 +116,14 @@ type Controller struct {
func NewController(
kubeclientset kubernetes.Interface,
channelclientset clientset.Interface,
servingclientset servingclientset.Interface,
sharedclientset sharedclientset.Interface,
restConfig *rest.Config,
kubeInformerFactory kubeinformers.SharedInformerFactory,
channelInformerFactory informers.SharedInformerFactory,
servingInformerFactory servinginformers.SharedInformerFactory) controller.Interface {
sharedInformerFactory sharedinformers.SharedInformerFactory) controller.Interface {

// obtain references to shared index informers for the Service and Channel types.
virtualserviceInformer := servingInformerFactory.Networking().V1alpha3().VirtualServices()
virtualserviceInformer := sharedInformerFactory.Networking().V1alpha3().VirtualServices()
serviceInformer := kubeInformerFactory.Core().V1().Services()
channelInformer := channelInformerFactory.Channels().V1alpha1().Channels()

Expand All @@ -140,7 +140,7 @@ func NewController(
controller := &Controller{
kubeclientset: kubeclientset,
channelclientset: channelclientset,
servingclientset: servingclientset,
sharedclientset: sharedclientset,
virtualservicesLister: virtualserviceInformer.Lister(),
virtualservicesSynced: virtualserviceInformer.Informer().HasSynced,
servicesLister: serviceInformer.Lister(),
Expand Down Expand Up @@ -361,7 +361,7 @@ func (c *Controller) syncChannelVirtualService(channel *channelsv1alpha1.Channel

// If the resource doesn't exist, we'll create it
if errors.IsNotFound(err) {
virtualservice, err = c.servingclientset.NetworkingV1alpha3().VirtualServices(channel.Namespace).Create(newVirtualService(channel))
virtualservice, err = c.sharedclientset.NetworkingV1alpha3().VirtualServices(channel.Namespace).Create(newVirtualService(channel))
}

// If an error occurs during Get/Create, we'll requeue the item so we can
Expand Down
14 changes: 6 additions & 8 deletions pkg/controller/clusterbus/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,14 @@ import (
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue"

"github.com/knative/eventing/pkg/system"
channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1"
clientset "github.com/knative/eventing/pkg/client/clientset/versioned"
channelscheme "github.com/knative/eventing/pkg/client/clientset/versioned/scheme"
informers "github.com/knative/eventing/pkg/client/informers/externalversions"
listers "github.com/knative/eventing/pkg/client/listers/channels/v1alpha1"

servingclientset "github.com/knative/serving/pkg/client/clientset/versioned"
servinginformers "github.com/knative/serving/pkg/client/informers/externalversions"

channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1"
"github.com/knative/eventing/pkg/system"
sharedclientset "github.com/knative/pkg/client/clientset/versioned"
sharedinformers "github.com/knative/pkg/client/informers/externalversions"
)

const (
Expand Down Expand Up @@ -103,11 +101,11 @@ type Controller struct {
func NewController(
kubeclientset kubernetes.Interface,
clusterbusclientset clientset.Interface,
servingclientset servingclientset.Interface,
sharedclientset sharedclientset.Interface,
restConfig *rest.Config,
kubeInformerFactory kubeinformers.SharedInformerFactory,
clusterBusInformerFactory informers.SharedInformerFactory,
routeInformerFactory servinginformers.SharedInformerFactory) controller.Interface {
sharedInformerFactory sharedinformers.SharedInformerFactory) controller.Interface {

// obtain references to shared index informers for the ClusterBus, Deployment and Service
// types.
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"

servingclientset "github.com/knative/serving/pkg/client/clientset/versioned"
servinginformers "github.com/knative/serving/pkg/client/informers/externalversions"
sharedclientset "github.com/knative/pkg/client/clientset/versioned"
sharedinformers "github.com/knative/pkg/client/informers/externalversions"

clientset "github.com/knative/eventing/pkg/client/clientset/versioned"
informers "github.com/knative/eventing/pkg/client/informers/externalversions"
Expand All @@ -35,9 +35,9 @@ type Interface interface {
type Constructor func(
kubernetes.Interface,
clientset.Interface,
servingclientset.Interface,
sharedclientset.Interface,
*rest.Config,
kubeinformers.SharedInformerFactory,
informers.SharedInformerFactory,
servinginformers.SharedInformerFactory,
sharedinformers.SharedInformerFactory,
) Interface
2 changes: 0 additions & 2 deletions pkg/controller/feed/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/knative/eventing/pkg/controller/feed/resources"
controllertesting "github.com/knative/eventing/pkg/controller/testing"
"github.com/knative/eventing/pkg/sources"
servingv1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -56,7 +55,6 @@ const (
func init() {
// Add types to scheme
feedsv1alpha1.AddToScheme(scheme.Scheme)
servingv1alpha1.AddToScheme(scheme.Scheme)
}

var testCases = []controllertesting.TestCase{
Expand Down
2 changes: 0 additions & 2 deletions pkg/controller/flow/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
feedsv1alpha1 "github.com/knative/eventing/pkg/apis/feeds/v1alpha1"
flowsv1alpha1 "github.com/knative/eventing/pkg/apis/flows/v1alpha1"
controllertesting "github.com/knative/eventing/pkg/controller/testing"
servingv1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
Expand Down Expand Up @@ -54,7 +53,6 @@ func init() {
// Add types to scheme
feedsv1alpha1.AddToScheme(scheme.Scheme)
flowsv1alpha1.AddToScheme(scheme.Scheme)
servingv1alpha1.AddToScheme(scheme.Scheme)
channelsv1alpha1.AddToScheme(scheme.Scheme)
}

Expand Down
Loading

0 comments on commit 8043ed8

Please sign in to comment.