diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index db7fe3c0db4..8541c31bbb5 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -47,6 +47,30 @@ fork](https://help.github.com/articles/syncing-a-fork/)._ Once you reach this point you are ready to do a full build and deploy as follows. +### Configure Istio per namespace + + Clusters not using Istio may skip this step. + + Each namespace that contains a Channel needs to be configured so that Istio will bridge the service mesh for a Channel to the Bus hosting that channel. The following snippet will need to be applied to each namespace that will use a Channel. Replace $NAMESPACE both in the metadata struct and the service hosts. + + ```yaml + apiVersion: networking.istio.io/v1alpha3 + kind: ServiceEntry + metadata: + name: knative-channels + namespace: $NAMESPACE + spec: + hosts: + - '*-channel.$NAMESPACE.svc.cluster.local' + location: MESH_INTERNAL + ports: + - name: http + number: 80 + protocol: HTTP + ``` + + This ServiceEntry extends the Istio mesh to include Channels. + ## Starting Eventing Controller Once you've [setup your development environment](#getting-started), stand up diff --git a/Gopkg.lock b/Gopkg.lock index 958d97db59a..fd812f4b74b 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -268,20 +268,10 @@ revision = "5c1d8c8469d1ed34b2aecf4c2305b3a57fff2ee3" [[projects]] - digest = "1:75099ce780b47b2c612be5b4581a8779d749208423eb783c5073c158fbfadb7d" + digest = "1:433e603dd22d1d3725ca2a3ad38caf41cda3a271cede87f39fcaf0c76cb4f963" name = "github.com/knative/pkg" packages = [ "apis", - "apis/istio", - "apis/istio/v1alpha3", - "client/clientset/versioned", - "client/clientset/versioned/scheme", - "client/clientset/versioned/typed/istio/v1alpha3", - "client/informers/externalversions", - "client/informers/externalversions/internalinterfaces", - "client/informers/externalversions/istio", - "client/informers/externalversions/istio/v1alpha3", - "client/listers/istio/v1alpha3", "configmap", "logging", "logging/logkey", @@ -310,7 +300,7 @@ [[projects]] branch = "master" - digest = "1:36968d4eb1d52090841ae868d7125d8ff10afabdea0d6b622c1f4a662f94be58" + digest = "1:849fc53918b4658b896a43881305d60afc0d6a51d87c0d5b065afd631415f1d4" name = "github.com/knative/test-infra" packages = ["."] pruneopts = "T" @@ -1030,10 +1020,6 @@ "github.com/google/go-github/github", "github.com/google/uuid", "github.com/knative/pkg/apis", - "github.com/knative/pkg/apis/istio/v1alpha3", - "github.com/knative/pkg/client/clientset/versioned", - "github.com/knative/pkg/client/informers/externalversions", - "github.com/knative/pkg/client/listers/istio/v1alpha3", "github.com/knative/pkg/configmap", "github.com/knative/pkg/logging", "github.com/knative/pkg/logging/logkey", @@ -1041,8 +1027,10 @@ "github.com/knative/pkg/webhook", "github.com/knative/serving/pkg/apis/serving/v1alpha1", "github.com/knative/serving/pkg/client/clientset/versioned", + "github.com/knative/test-infra", "github.com/prometheus/client_golang/prometheus/promhttp", "go.uber.org/zap", + "go.uber.org/zap/zapcore", "golang.org/x/net/context", "golang.org/x/oauth2", "google.golang.org/grpc/codes", @@ -1079,7 +1067,6 @@ "k8s.io/client-go/kubernetes/typed/core/v1", "k8s.io/client-go/listers/apps/v1", "k8s.io/client-go/listers/core/v1", - "k8s.io/client-go/listers/rbac/v1beta1", "k8s.io/client-go/plugin/pkg/client/auth/gcp", "k8s.io/client-go/rest", "k8s.io/client-go/testing", diff --git a/cmd/controller/controller-runtime-main.go b/cmd/controller/controller-runtime-main.go index 60bfa94e668..bd2d79014d0 100644 --- a/cmd/controller/controller-runtime-main.go +++ b/cmd/controller/controller-runtime-main.go @@ -22,8 +22,6 @@ import ( "github.com/knative/eventing/pkg/controller/feed" "github.com/knative/eventing/pkg/controller/flow" - istiov1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" - "github.com/knative/eventing/pkg/controller/eventtype" "k8s.io/apimachinery/pkg/runtime" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" @@ -57,7 +55,6 @@ func controllerRuntimeStart() error { channelsv1alpha1.AddToScheme, feedsv1alpha1.AddToScheme, flowsv1alpha1.AddToScheme, - istiov1alpha3.AddToScheme, } for _, schemeFunc := range schemeFuncs { schemeFunc(mrg.GetScheme()) diff --git a/cmd/controller/main.go b/cmd/controller/main.go index d69876c60ad..d69b033c5a9 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -27,6 +27,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" + // 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" @@ -36,8 +37,6 @@ import ( "github.com/knative/eventing/pkg/controller/bus" "github.com/knative/eventing/pkg/controller/channel" "github.com/knative/eventing/pkg/controller/clusterbus" - sharedclientset "github.com/knative/pkg/client/clientset/versioned" - sharedinformers "github.com/knative/pkg/client/informers/externalversions" "github.com/knative/pkg/signals" "github.com/knative/eventing/pkg/logconfig" @@ -96,11 +95,6 @@ func main() { logger.Fatalf("Error building clientset: %v", err) } - sharedClient, err := sharedclientset.NewForConfig(cfg) - if err != nil { - logger.Fatalf("Error building shared clientset: %v", err) - } - // TODO: Rip this out from all the controllers since we can get it // from provider. // Build a rest.Config from configuration injected into the Pod by @@ -112,7 +106,6 @@ func main() { kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClient, time.Second*30) informerFactory := informers.NewSharedInformerFactory(client, 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) @@ -134,12 +127,11 @@ func main() { controllers := make([]controller.Interface, 0, len(ctors)) for _, ctor := range ctors { controllers = append(controllers, - ctor(kubeClient, client, sharedClient, restConfig, kubeInformerFactory, informerFactory, sharedInformerFactory)) + ctor(kubeClient, client, restConfig, kubeInformerFactory, informerFactory)) } go kubeInformerFactory.Start(stopCh) go informerFactory.Start(stopCh) - go sharedInformerFactory.Start(stopCh) // Start all of the controllers. for _, ctrlr := range controllers { diff --git a/pkg/apis/channels/v1alpha1/channel_types.go b/pkg/apis/channels/v1alpha1/channel_types.go index 150243f2771..58b98008ddf 100644 --- a/pkg/apis/channels/v1alpha1/channel_types.go +++ b/pkg/apis/channels/v1alpha1/channel_types.go @@ -85,10 +85,6 @@ const ( // Serviceable means the service addressing the channel exists. ChannelServiceable ChannelConditionType = "Serviceable" - // Routable means the virtual service forwarding traffic from the channel service to the - // bus is created. - ChannelRoutable ChannelConditionType = "Routeable" - // Provisioned means the channel backing construct on the bus middleware has been set up. ChannelProvisioned ChannelConditionType = "Provisioned" ) @@ -114,9 +110,6 @@ type ChannelStatus struct { // A reference to the k8s Service backing this channel, if successfully synced. Service *v1.LocalObjectReference `json:"service,omitempty"` - // A reference to the istio VirtualService backing this channel, if successfully synced. - VirtualService *v1.LocalObjectReference `json:"virtualService,omitempty"` - // Represents the latest available observations of a channel's current state. // +patchMergeKey=type // +patchStrategy=merge diff --git a/pkg/apis/channels/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/channels/v1alpha1/zz_generated.deepcopy.go index e876226a49a..032a5b5bf58 100644 --- a/pkg/apis/channels/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/channels/v1alpha1/zz_generated.deepcopy.go @@ -368,15 +368,6 @@ func (in *ChannelStatus) DeepCopyInto(out *ChannelStatus) { **out = **in } } - if in.VirtualService != nil { - in, out := &in.VirtualService, &out.VirtualService - if *in == nil { - *out = nil - } else { - *out = new(v1.LocalObjectReference) - **out = **in - } - } if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make([]ChannelCondition, len(*in)) diff --git a/pkg/apis/flows/v1alpha1/flow_types.go b/pkg/apis/flows/v1alpha1/flow_types.go index bbb6882ac18..6e2ae6c3391 100644 --- a/pkg/apis/flows/v1alpha1/flow_types.go +++ b/pkg/apis/flows/v1alpha1/flow_types.go @@ -21,6 +21,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "encoding/json" + channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" feedsv1alpha1 "github.com/knative/eventing/pkg/apis/feeds/v1alpha1" "github.com/knative/pkg/apis" @@ -72,8 +73,9 @@ type FlowSpec struct { // provide the resolved target of the action. Currently we inspect // the objects Status and see if there's a predefined Status field // that we will then use to give to Feed object as the target. Currently -// must resolve to a k8s service or Istio virtual service. Note that by -// in the future we should try to utilize subresources (/resolve ?) to +// must resolve to a k8s service. +// +// In the future we should try to utilize subresources (/resolve ?) to // utilize this, but CRDs do not support subresources yet, so we need // to rely on a specified Status field today. By relying on this behaviour // we can utilize a dynamic client instead of having to understand all diff --git a/pkg/buses/bus.go b/pkg/buses/bus.go index cda926757ec..289857c28ee 100644 --- a/pkg/buses/bus.go +++ b/pkg/buses/bus.go @@ -140,8 +140,8 @@ func NewBusDispatcher(ref BusReference, handlerFuncs EventHandlerFuncs, opts *Bu opts.MessageDispatcher = NewMessageDispatcher(opts.Logger.Named(dispatcherLoggingComponent)) } if opts.MessageReceiver == nil { - opts.MessageReceiver = NewMessageReceiver(func(channel ChannelReference, message *Message) error { - return b.receiveMessage(channel, message) + opts.MessageReceiver = NewMessageReceiver(ref, func(host ChannelHostReference, message *Message) error { + return b.receiveMessage(host, message) }, opts.Logger.Named(receiverLoggingComponent)) } @@ -171,12 +171,13 @@ func (b bus) Run(threadiness int, stopCh <-chan struct{}) { <-stopCh } -func (b *bus) receiveMessage(channel ChannelReference, message *Message) error { - _, err := b.cache.Channel(channel) +func (b *bus) receiveMessage(host ChannelHostReference, message *Message) error { + channel, err := b.cache.ChannelHost(host) if err != nil { return ErrUnknownChannel } - return b.handlerFuncs.onReceiveMessage(channel, message) + ref := NewChannelReference(channel) + return b.handlerFuncs.onReceiveMessage(ref, message) } // DispatchMessage sends a message to a subscriber. This function is only diff --git a/pkg/buses/cache.go b/pkg/buses/cache.go index 430e209e5ad..91df0f96e56 100644 --- a/pkg/buses/cache.go +++ b/pkg/buses/cache.go @@ -27,6 +27,7 @@ import ( func NewCache() *Cache { return &Cache{ channels: make(map[ChannelReference]*channelsv1alpha1.Channel), + channelHosts: make(map[ChannelHostReference]ChannelReference), subscriptions: make(map[SubscriptionReference]*channelsv1alpha1.Subscription), } } @@ -36,6 +37,7 @@ func NewCache() *Cache { // provisioned and comparing updated resources to the provisioned version. type Cache struct { channels map[ChannelReference]*channelsv1alpha1.Channel + channelHosts map[ChannelHostReference]ChannelReference subscriptions map[SubscriptionReference]*channelsv1alpha1.Subscription } @@ -49,6 +51,16 @@ func (c *Cache) Channel(ref ChannelReference) (*channelsv1alpha1.Channel, error) return channel, nil } +// ChannelHost returns a cached channel for a provided channel host reference +// or an error if the channel host is not in the cache. +func (c *Cache) ChannelHost(host ChannelHostReference) (*channelsv1alpha1.Channel, error) { + ref, ok := c.channelHosts[host] + if !ok { + return nil, fmt.Errorf("unknown channel host %q", host.String()) + } + return c.Channel(ref) +} + // Subscription returns a cached subscription for provided reference or an // error if the subscription is not in the cache. func (c *Cache) Subscription(ref SubscriptionReference) (*channelsv1alpha1.Subscription, error) { @@ -67,6 +79,10 @@ func (c *Cache) AddChannel(channel *channelsv1alpha1.Channel) { } ref := NewChannelReference(channel) c.channels[ref] = channel + if host, err := NewChannelHostReferenceFromChannel(channel); err == nil { + // an error is expected if the channel is not serviceable yet + c.channelHosts[host] = ref + } } // RemoveChannel removes the provided channel from the cache. @@ -76,6 +92,11 @@ func (c *Cache) RemoveChannel(channel *channelsv1alpha1.Channel) { } ref := NewChannelReference(channel) delete(c.channels, ref) + if host, err := NewChannelHostReferenceFromChannel(channel); err != nil { + // it's ok if key is abandoned in the channelHost cache after being + // removed from the channel cache, but we should try to clean it up. + delete(c.channelHosts, host) + } } // AddSubscription adds, or updates, the provided subscription to the cache for diff --git a/pkg/buses/cache_test.go b/pkg/buses/cache_test.go index 5b2f8cee9e0..c560611a24e 100644 --- a/pkg/buses/cache_test.go +++ b/pkg/buses/cache_test.go @@ -17,6 +17,7 @@ limitations under the License. package buses_test import ( + "fmt" "testing" channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" @@ -27,6 +28,7 @@ import ( const ( cacheDefaultNamespace = "default" cacheTestChannel = "test-channel" + cacheTestChannelHost = "test-channel-host" cacheTestSubscription = "test-subscription" ) @@ -39,7 +41,7 @@ func TestCacheErrsForUnknownChannel(t *testing.T) { t.Errorf("%s expected: %+v got: %+v", "Error", "", err) } if expected != actual { - t.Errorf("%s expected: %+v got: %+v", "Unexpected channel", nil, actual) + t.Errorf("%s expected: %+v got: %+v", "Channel", expected, actual) } } @@ -80,6 +82,64 @@ func TestCacheNilChannel(t *testing.T) { cache.RemoveChannel(channel) } +func TestCacheErrsForUnknownChannelHost(t *testing.T) { + cache := buses.NewCache() + ref := buses.NewChannelHostReferenceFromNames(cacheTestChannelHost, cacheDefaultNamespace) + var expected *channelsv1alpha1.Channel + actual, err := cache.ChannelHost(ref) + if err == nil { + t.Errorf("%s expected: %+v got: %+v", "Error", "", err) + } + if expected != actual { + t.Errorf("%s expected: %+v got: %+v", "Channel", expected, actual) + } +} + +func TestCacheRetrievesKnownChannelHost(t *testing.T) { + cache := buses.NewCache() + ref := buses.NewChannelHostReferenceFromNames(cacheTestChannelHost, cacheDefaultNamespace) + expected := makeChannelForHost(ref) + cache.AddChannel(expected) + actual, err := cache.ChannelHost(ref) + if err != nil { + t.Errorf("%s expected: %+v got: %+v", "Unexpected error", nil, err) + } + if expected != actual { + t.Errorf("%s expected: %+v got: %+v", "Channel", expected, actual) + } +} + +func TestCacheErrsForUnserviceableChannel(t *testing.T) { + cache := buses.NewCache() + ref := buses.NewChannelHostReferenceFromNames(cacheTestChannelHost, cacheDefaultNamespace) + channel := makeChannel(buses.NewChannelReferenceFromNames(cacheTestChannel, cacheDefaultNamespace)) + cache.AddChannel(channel) + var expected *channelsv1alpha1.Channel + actual, err := cache.ChannelHost(ref) + if err == nil { + t.Errorf("%s expected: %+v got: %+v", "Error", "", err) + } + if expected != actual { + t.Errorf("%s expected: %+v got: %+v", "Channel", expected, actual) + } +} + +func TestCacheRemovesKnownChannelHost(t *testing.T) { + cache := buses.NewCache() + ref := buses.NewChannelHostReferenceFromNames(cacheTestChannel, cacheDefaultNamespace) + channel := makeChannelForHost(ref) + cache.AddChannel(channel) + cache.RemoveChannel(channel) + var expected *channelsv1alpha1.Channel + actual, err := cache.ChannelHost(ref) + if err == nil { + t.Errorf("%s expected: %+v got: %+v", "Unexpected error", nil, err) + } + if expected != actual { + t.Errorf("%s expected: %+v got: %+v", "Channel", expected, actual) + } +} + func TestCacheErrsForUnknownSubscription(t *testing.T) { cache := buses.NewCache() ref := buses.NewSubscriptionReferenceFromNames(cacheTestSubscription, cacheDefaultNamespace) @@ -139,6 +199,18 @@ func makeChannel(ref buses.ChannelReference) *channelsv1alpha1.Channel { } } +func makeChannelForHost(ref buses.ChannelHostReference) *channelsv1alpha1.Channel { + return &channelsv1alpha1.Channel{ + ObjectMeta: metav1.ObjectMeta{ + Name: cacheTestChannel, + Namespace: cacheDefaultNamespace, + }, + Status: channelsv1alpha1.ChannelStatus{ + DomainInternal: fmt.Sprintf("%s.%s.svc.cluster.local", ref.Name, ref.Namespace), + }, + } +} + func makeSubscription(ref buses.SubscriptionReference) *channelsv1alpha1.Subscription { return &channelsv1alpha1.Subscription{ ObjectMeta: metav1.ObjectMeta{ diff --git a/pkg/buses/message_receiver.go b/pkg/buses/message_receiver.go index 7639a7aec51..2a9630dacb0 100644 --- a/pkg/buses/message_receiver.go +++ b/pkg/buses/message_receiver.go @@ -27,7 +27,8 @@ import ( // MessageReceiver starts a server to receive new messages for the bus. The new // message is emitted via the receiver function. type MessageReceiver struct { - receiverFunc func(ChannelReference, *Message) error + bus BusReference + receiverFunc func(ChannelHostReference, *Message) error forwardHeaders map[string]bool forwardPrefixes []string @@ -36,8 +37,9 @@ type MessageReceiver struct { // NewMessageReceiver creates a message receiver passing new messages to the // receiverFunc. -func NewMessageReceiver(receiverFunc func(ChannelReference, *Message) error, logger *zap.SugaredLogger) *MessageReceiver { +func NewMessageReceiver(bus BusReference, receiverFunc func(ChannelHostReference, *Message) error, logger *zap.SugaredLogger) *MessageReceiver { receiver := &MessageReceiver{ + bus: bus, receiverFunc: receiverFunc, forwardHeaders: headerSet(forwardHeaders), forwardPrefixes: forwardPrefixes, @@ -103,7 +105,7 @@ func (r *MessageReceiver) stop(srv *http.Server) { func (r *MessageReceiver) HandleRequest(res http.ResponseWriter, req *http.Request) { host := req.Host r.logger.Infof("Received request for %s", host) - channel := r.parseChannel(host) + ref := NewChannelHostReference(host, r.bus.Namespace) message, err := r.fromRequest(req) if err != nil { @@ -111,7 +113,7 @@ func (r *MessageReceiver) HandleRequest(res http.ResponseWriter, req *http.Reque return } - err = r.receiverFunc(channel, message) + err = r.receiverFunc(ref, message) if err != nil { if err == ErrUnknownChannel { res.WriteHeader(http.StatusNotFound) @@ -162,13 +164,3 @@ func (r *MessageReceiver) fromHTTPHeaders(headers http.Header) map[string]string return safe } - -// parseChannel converts the channel's hostname into a channel -// reference. -func (r *MessageReceiver) parseChannel(host string) ChannelReference { - chunks := strings.Split(host, ".") - return ChannelReference{ - Name: chunks[0], - Namespace: chunks[1], - } -} diff --git a/pkg/buses/references.go b/pkg/buses/references.go index 0f4029ed8a3..4abbae930e7 100644 --- a/pkg/buses/references.go +++ b/pkg/buses/references.go @@ -18,6 +18,7 @@ package buses import ( "fmt" + "strings" channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" ) @@ -84,6 +85,46 @@ func (r *ChannelReference) String() string { return fmt.Sprintf("%s/%s", r.Namespace, r.Name) } +// ChannelHostReference references a hostname for a Channel. +type ChannelHostReference struct { + Namespace string + Name string +} + +// NewChannelHostReference creates a ChannelHostReference from a hostname. If +// the hostname does not contain the namespace, the default value is used. +func NewChannelHostReference(hostname, defaultNamespace string) ChannelHostReference { + chunks := strings.Split(hostname, ".") + if len(chunks) == 1 { + return NewChannelHostReferenceFromNames(chunks[0], defaultNamespace) + } + return NewChannelHostReferenceFromNames(chunks[0], chunks[1]) +} + +// NewChannelHostReferenceFromChannel creates a ChannelHostReference from a +// provisioned Channel. +func NewChannelHostReferenceFromChannel(channel *channelsv1alpha1.Channel) (ChannelHostReference, error) { + domainInternal := channel.Status.DomainInternal + if domainInternal == "" { + ref := NewChannelReference(channel) + return ChannelHostReference{}, fmt.Errorf("channel %q is not serviceable", ref.String()) + } + return NewChannelHostReference(domainInternal, channel.Namespace), nil +} + +// NewChannelHostReferenceFromNames creates a ChannelHostReference for a name +// and namespace. +func NewChannelHostReferenceFromNames(name, namespace string) ChannelHostReference { + return ChannelHostReference{ + Namespace: namespace, + Name: name, + } +} + +func (r *ChannelHostReference) String() string { + return fmt.Sprintf("%s.%s", r.Name, r.Namespace) +} + // SubscriptionReference references a Subscription within the cluster by name // and namespace. type SubscriptionReference struct { diff --git a/pkg/buses/references_test.go b/pkg/buses/references_test.go index 84854f2adec..432f937d0df 100644 --- a/pkg/buses/references_test.go +++ b/pkg/buses/references_test.go @@ -30,6 +30,7 @@ const ( referencesTestBusName = "test-bus" referencesTestClusterBusName = "test-clusterbus" referencesTestChannelName = "test-channel" + referencesTestChannelHostName = "test-channel-host" referencesTestSubscriptionName = "test-subscription" ) @@ -169,6 +170,108 @@ func TestChannelReference_String(t *testing.T) { } } +func TestNewChannelHostReference_FullyQualified(t *testing.T) { + hostname := fmt.Sprintf("%s.%s.svc.cluster.local", referencesTestChannelHostName, referencesTestNamespace) + expected := buses.ChannelHostReference{ + Name: referencesTestChannelHostName, + Namespace: referencesTestNamespace, + } + actual := buses.NewChannelHostReference(hostname, "bogus") + if expected != actual { + t.Errorf("%s expected: %+v got: %+v", "ChannelHostReference", expected, actual) + } +} + +func TestNewChannelHostReference_Namespaced(t *testing.T) { + hostname := fmt.Sprintf("%s.%s", referencesTestChannelHostName, referencesTestNamespace) + expected := buses.ChannelHostReference{ + Name: referencesTestChannelHostName, + Namespace: referencesTestNamespace, + } + actual := buses.NewChannelHostReference(hostname, "bogus") + if expected != actual { + t.Errorf("%s expected: %+v got: %+v", "ChannelHostReference", expected, actual) + } +} + +func TestNewChannelHostReference_Shortname(t *testing.T) { + hostname := referencesTestChannelHostName + expected := buses.ChannelHostReference{ + Name: referencesTestChannelHostName, + Namespace: referencesTestNamespace, + } + actual := buses.NewChannelHostReference(hostname, referencesTestNamespace) + if expected != actual { + t.Errorf("%s expected: %+v got: %+v", "ChannelHostReference", expected, actual) + } +} + +func TestNewChannelHostReferenceFromChannel(t *testing.T) { + channel := &channelsv1alpha1.Channel{ + ObjectMeta: metav1.ObjectMeta{ + Name: referencesTestChannelName, + Namespace: referencesTestNamespace, + }, + Status: channelsv1alpha1.ChannelStatus{ + DomainInternal: fmt.Sprintf("%s.%s.svc.cluster.local", referencesTestChannelHostName, referencesTestNamespace), + }, + } + expected := buses.ChannelHostReference{ + Name: referencesTestChannelHostName, + Namespace: referencesTestNamespace, + } + actual, err := buses.NewChannelHostReferenceFromChannel(channel) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + if expected != actual { + t.Errorf("%s expected: %+v got: %+v", "ChannelHostReference", expected, actual) + } +} + +func TestNewChannelHostReferenceFromChannel_NotServiceable(t *testing.T) { + channel := &channelsv1alpha1.Channel{ + ObjectMeta: metav1.ObjectMeta{ + Name: referencesTestChannelName, + Namespace: referencesTestNamespace, + }, + } + expected := buses.ChannelHostReference{} + expectedErr := fmt.Sprintf("channel \"%s/%s\" is not serviceable", referencesTestNamespace, referencesTestChannelName) + actual, actualErr := buses.NewChannelHostReferenceFromChannel(channel) + if actualErr == nil { + t.Errorf("error expected: %v", actualErr) + } else if actualErr.Error() != expectedErr { + t.Errorf("%s expected: %+v got: %+v", "ChannelHostReference Error", expectedErr, actualErr) + } + if expected != actual { + t.Errorf("%s expected: %+v got: %+v", "ChannelHostReference", expected, actual) + } +} + +func TestNewChannelHostReferenceFromNames(t *testing.T) { + expected := buses.ChannelHostReference{ + Name: referencesTestChannelHostName, + Namespace: referencesTestNamespace, + } + actual := buses.NewChannelHostReferenceFromNames(referencesTestChannelHostName, referencesTestNamespace) + if expected != actual { + t.Errorf("%s expected: %+v got: %+v", "ChannelHostReference", expected, actual) + } +} + +func TestChannelHostReference_String(t *testing.T) { + channelHostRef := buses.ChannelHostReference{ + Name: referencesTestChannelHostName, + Namespace: referencesTestNamespace, + } + expected := fmt.Sprintf("%s.%s", referencesTestChannelHostName, referencesTestNamespace) + actual := channelHostRef.String() + if expected != actual { + t.Errorf("%s expected: %+v got: %+v", "ChannelHostReference", expected, actual) + } +} + func TestNewSubscriptionReference(t *testing.T) { subscription := &channelsv1alpha1.Subscription{ ObjectMeta: metav1.ObjectMeta{ diff --git a/pkg/controller/bus/controller.go b/pkg/controller/bus/controller.go index 88cae16d3b4..01c9e4850f8 100644 --- a/pkg/controller/bus/controller.go +++ b/pkg/controller/bus/controller.go @@ -39,7 +39,6 @@ import ( typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" appslisters "k8s.io/client-go/listers/apps/v1" corelisters "k8s.io/client-go/listers/core/v1" - rbaclisters "k8s.io/client-go/listers/rbac/v1beta1" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" @@ -49,8 +48,6 @@ 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" - 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" @@ -94,16 +91,12 @@ type Controller struct { // busclientset is a clientset for our own API group busclientset clientset.Interface - deploymentsLister appslisters.DeploymentLister - deploymentsSynced cache.InformerSynced - servicesLister corelisters.ServiceLister - servicesSynced cache.InformerSynced - serviceAccountsLister corelisters.ServiceAccountLister - serviceAccountsSynced cache.InformerSynced - clusterRoleBindingsLister rbaclisters.ClusterRoleBindingLister - clusterRoleBindingsSynced cache.InformerSynced - busesLister listers.BusLister - busesSynced cache.InformerSynced + deploymentsLister appslisters.DeploymentLister + deploymentsSynced cache.InformerSynced + servicesLister corelisters.ServiceLister + servicesSynced cache.InformerSynced + busesLister listers.BusLister + busesSynced cache.InformerSynced // workqueue is a rate limited work queue. This is used to queue work to be // processed instead of performing it as soon as a change happens. This @@ -120,11 +113,9 @@ type Controller struct { func NewController( kubeclientset kubernetes.Interface, busclientset clientset.Interface, - sharedclientset sharedclientset.Interface, restConfig *rest.Config, kubeInformerFactory kubeinformers.SharedInformerFactory, busInformerFactory informers.SharedInformerFactory, - istioInformerFactory sharedinformers.SharedInformerFactory, ) controller.Interface { // obtain references to shared index informers for the Bus, Deployment and Service @@ -132,8 +123,6 @@ func NewController( busInformer := busInformerFactory.Channels().V1alpha1().Buses() deploymentInformer := kubeInformerFactory.Apps().V1().Deployments() serviceInformer := kubeInformerFactory.Core().V1().Services() - serviceAccountInformer := kubeInformerFactory.Core().V1().ServiceAccounts() - clusterRoleBindingInformer := kubeInformerFactory.Rbac().V1beta1().ClusterRoleBindings() // Create event broadcaster // Add bus-controller types to the default Kubernetes Scheme so Events can be @@ -146,20 +135,16 @@ func NewController( recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerAgentName}) controller := &Controller{ - kubeclientset: kubeclientset, - busclientset: busclientset, - deploymentsLister: deploymentInformer.Lister(), - deploymentsSynced: deploymentInformer.Informer().HasSynced, - servicesLister: serviceInformer.Lister(), - servicesSynced: serviceInformer.Informer().HasSynced, - serviceAccountsLister: serviceAccountInformer.Lister(), - serviceAccountsSynced: serviceAccountInformer.Informer().HasSynced, - clusterRoleBindingsLister: clusterRoleBindingInformer.Lister(), - clusterRoleBindingsSynced: clusterRoleBindingInformer.Informer().HasSynced, - busesLister: busInformer.Lister(), - busesSynced: busInformer.Informer().HasSynced, - workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "Buses"), - recorder: recorder, + kubeclientset: kubeclientset, + busclientset: busclientset, + deploymentsLister: deploymentInformer.Lister(), + deploymentsSynced: deploymentInformer.Informer().HasSynced, + servicesLister: serviceInformer.Lister(), + servicesSynced: serviceInformer.Informer().HasSynced, + busesLister: busInformer.Lister(), + busesSynced: busInformer.Informer().HasSynced, + workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "Buses"), + recorder: recorder, } glog.Info("Setting up event handlers") diff --git a/pkg/controller/channel/controller.go b/pkg/controller/channel/controller.go index 158059927ef..9c3dad43348 100644 --- a/pkg/controller/channel/controller.go +++ b/pkg/controller/channel/controller.go @@ -22,7 +22,7 @@ import ( "github.com/golang/glog" "github.com/knative/eventing/pkg/controller" - istiolisters "github.com/knative/pkg/client/listers/istio/v1alpha3" + "github.com/knative/eventing/pkg/system" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" @@ -44,13 +44,9 @@ 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" - "github.com/knative/eventing/pkg/system" - 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/pkg/apis/istio/v1alpha3" ) const controllerAgentName = "channel-controller" @@ -75,15 +71,9 @@ const ( ServiceSynced = "ServiceSynced" // ServiceError is used as part of the condition reason when the channel (k8s) service creation failed. ServiceError = "ServiceError" - // VirtualServiceSynced is used as part of the condition reason when the channel istio virtual service is successfully created. - VirtualServiceSynced = "VirtualServiceSynced" - // VirtualServiceError is used as part of the condition reason when the channel istio virtual service creation failed. - VirtualServiceError = "VirtualServiceError" -) -const ( - PortNumber = 80 - PortName = "http" + portNumber = 80 + portName = "http" ) // Controller is the controller implementation for Channel resources @@ -92,15 +82,11 @@ type Controller struct { kubeclientset kubernetes.Interface // channelclientset is a clientset for our own API group channelclientset clientset.Interface - // sharedclientset is a clientset for shared API groups - sharedclientset sharedclientset.Interface - virtualservicesLister istiolisters.VirtualServiceLister - virtualservicesSynced cache.InformerSynced - servicesLister corelisters.ServiceLister - servicesSynced cache.InformerSynced - channelsLister listers.ChannelLister - channelsSynced cache.InformerSynced + servicesLister corelisters.ServiceLister + servicesSynced cache.InformerSynced + channelsLister listers.ChannelLister + channelsSynced cache.InformerSynced // workqueue is a rate limited work queue. This is used to queue work to be // processed instead of performing it as soon as a change happens. This @@ -117,15 +103,12 @@ type Controller struct { func NewController( kubeclientset kubernetes.Interface, channelclientset clientset.Interface, - sharedclientset sharedclientset.Interface, restConfig *rest.Config, kubeInformerFactory kubeinformers.SharedInformerFactory, channelInformerFactory informers.SharedInformerFactory, - sharedInformerFactory sharedinformers.SharedInformerFactory, ) controller.Interface { // obtain references to shared index informers for the Service and Channel types. - virtualserviceInformer := sharedInformerFactory.Networking().V1alpha3().VirtualServices() serviceInformer := kubeInformerFactory.Core().V1().Services() channelInformer := channelInformerFactory.Channels().V1alpha1().Channels() @@ -140,17 +123,14 @@ func NewController( recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerAgentName}) controller := &Controller{ - kubeclientset: kubeclientset, - channelclientset: channelclientset, - sharedclientset: sharedclientset, - virtualservicesLister: virtualserviceInformer.Lister(), - virtualservicesSynced: virtualserviceInformer.Informer().HasSynced, - servicesLister: serviceInformer.Lister(), - servicesSynced: serviceInformer.Informer().HasSynced, - channelsLister: channelInformer.Lister(), - channelsSynced: channelInformer.Informer().HasSynced, - workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "Channels"), - recorder: recorder, + kubeclientset: kubeclientset, + channelclientset: channelclientset, + servicesLister: serviceInformer.Lister(), + servicesSynced: serviceInformer.Informer().HasSynced, + channelsLister: channelInformer.Lister(), + channelsSynced: channelInformer.Informer().HasSynced, + workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "Channels"), + recorder: recorder, } glog.Info("Setting up event handlers") @@ -301,26 +281,19 @@ func (c *Controller) syncHandler(key string) error { } var service *corev1.Service - var virtualService *istiov1alpha3.VirtualService - var serviceErr, virtualServiceErr error + var serviceErr error // Sync Service derived from the Channel service, serviceErr = c.syncChannelService(channel) + if serviceErr != nil { - c.updateChannelStatus(channel, service, serviceErr, virtualService, virtualServiceErr) + c.updateChannelStatus(channel, service, serviceErr) return serviceErr } - // Sync VirtualService derived from a Channel - virtualService, virtualServiceErr = c.syncChannelVirtualService(channel) - if virtualServiceErr != nil { - c.updateChannelStatus(channel, service, serviceErr, virtualService, virtualServiceErr) - return virtualServiceErr - } - // Finally, we update the status block of the Channel resource to reflect the // current state of the world - err = c.updateChannelStatus(channel, service, serviceErr, virtualService, virtualServiceErr) + err = c.updateChannelStatus(channel, service, serviceErr) if err != nil { return err } @@ -333,6 +306,7 @@ func (c *Controller) syncChannelService(channel *channelsv1alpha1.Channel) (*cor // Get the service with the specified service name serviceName := controller.ChannelServiceName(channel.ObjectMeta.Name) service, err := c.servicesLister.Services(channel.Namespace).Get(serviceName) + // If the resource doesn't exist, we'll create it if errors.IsNotFound(err) { service, err = c.kubeclientset.CoreV1().Services(channel.Namespace).Create(newService(channel)) @@ -356,37 +330,7 @@ func (c *Controller) syncChannelService(channel *channelsv1alpha1.Channel) (*cor return service, nil } -func (c *Controller) syncChannelVirtualService(channel *channelsv1alpha1.Channel) (*istiov1alpha3.VirtualService, error) { - // Get the VirtualService with the specified Channel name - virtualserviceName := controller.ChannelVirtualServiceName(channel.ObjectMeta.Name) - virtualservice, err := c.virtualservicesLister.VirtualServices(channel.Namespace).Get(virtualserviceName) - - // If the resource doesn't exist, we'll create it - if errors.IsNotFound(err) { - 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 - // attempt processing again later. This could have been caused by a - // temporary network failure, or any other transient reason. - if err != nil { - return nil, err - } - - // If the Service is not controlled by this Channel resource, we should log - // a warning to the event recorder and return - if !metav1.IsControlledBy(virtualservice, channel) { - msg := fmt.Sprintf(MessageResourceExists, virtualservice.Name) - c.recorder.Event(channel, corev1.EventTypeWarning, ErrResourceExists, msg) - return nil, fmt.Errorf(msg) - } - - return virtualservice, nil -} - -func (c *Controller) updateChannelStatus(channel *channelsv1alpha1.Channel, - service *corev1.Service, serviceError error, - virtualService *istiov1alpha3.VirtualService, virtualServiceError error) error { +func (c *Controller) updateChannelStatus(channel *channelsv1alpha1.Channel, service *corev1.Service, serviceError error) error { // NEVER modify objects from the store. It's a read-only, local cache. // You can use DeepCopy() to make a deep copy of original object and modify this copy // Or create a copy manually for better performance @@ -404,16 +348,6 @@ func (c *Controller) updateChannelStatus(channel *channelsv1alpha1.Channel, util.SetChannelCondition(&channelCopy.Status, *serviceCondition) } - if virtualService != nil { - channelCopy.Status.VirtualService = &corev1.LocalObjectReference{Name: virtualService.Name} - serviceCondition := util.NewChannelCondition(channelsv1alpha1.ChannelRoutable, corev1.ConditionTrue, VirtualServiceSynced, "virtual service successfully synced") - util.SetChannelCondition(&channelCopy.Status, *serviceCondition) - } else { - channelCopy.Status.VirtualService = nil - serviceCondition := util.NewChannelCondition(channelsv1alpha1.ChannelRoutable, corev1.ConditionFalse, VirtualServiceError, virtualServiceError.Error()) - util.SetChannelCondition(&channelCopy.Status, *serviceCondition) - } - util.ConsolidateChannelCondition(&channelCopy.Status) channelCopy.Status.DomainInternal = controller.ServiceHostName(service.Name, service.Namespace) @@ -490,46 +424,17 @@ func newService(channel *channelsv1alpha1.Channel) *corev1.Service { labels := map[string]string{ "channel": channel.Name, } - return &corev1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: controller.ChannelServiceName(channel.ObjectMeta.Name), - Namespace: channel.Namespace, - Labels: labels, - OwnerReferences: []metav1.OwnerReference{ - *metav1.NewControllerRef(channel, schema.GroupVersionKind{ - Group: channelsv1alpha1.SchemeGroupVersion.Group, - Version: channelsv1alpha1.SchemeGroupVersion.Version, - Kind: "Channel", - }), - }, - }, - Spec: corev1.ServiceSpec{ - Ports: []corev1.ServicePort{ - {Name: PortName, Port: PortNumber}, - }, - }, - } -} - -// newVirtualService creates a new VirtualService for a Channel resource. It also sets -// the appropriate OwnerReferences on the resource so handleObject can discover -// the Channel resource that 'owns' it. -func newVirtualService(channel *channelsv1alpha1.Channel) *istiov1alpha3.VirtualService { - labels := map[string]string{ - "channel": channel.Name, - } - var destinationHost string + var dispatcherServiceHostName string if channel.Spec.Bus != "" { labels["bus"] = channel.Spec.Bus - destinationHost = controller.ServiceHostName(controller.BusDispatcherServiceName(channel.Spec.Bus, channel.Namespace), system.Namespace) - } - if channel.Spec.ClusterBus != "" { + dispatcherServiceHostName = controller.ServiceHostName(controller.BusDispatcherServiceName(channel.Spec.Bus, channel.Namespace), system.Namespace) + } else { labels["clusterBus"] = channel.Spec.ClusterBus - destinationHost = controller.ServiceHostName(controller.ClusterBusDispatcherServiceName(channel.Spec.ClusterBus), system.Namespace) + dispatcherServiceHostName = controller.ServiceHostName(controller.ClusterBusDispatcherServiceName(channel.Spec.ClusterBus), system.Namespace) } - return &istiov1alpha3.VirtualService{ + return &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: controller.ChannelVirtualServiceName(channel.Name), + Name: controller.ChannelServiceName(channel.Name), Namespace: channel.Namespace, Labels: labels, OwnerReferences: []metav1.OwnerReference{ @@ -540,24 +445,9 @@ func newVirtualService(channel *channelsv1alpha1.Channel) *istiov1alpha3.Virtual }), }, }, - Spec: istiov1alpha3.VirtualServiceSpec{ - Hosts: []string{ - controller.ServiceHostName(controller.ChannelServiceName(channel.Name), channel.Namespace), - controller.ChannelHostName(channel.Name, channel.Namespace), - }, - Http: []istiov1alpha3.HTTPRoute{{ - Rewrite: &istiov1alpha3.HTTPRewrite{ - Authority: controller.ChannelHostName(channel.Name, channel.Namespace), - }, - Route: []istiov1alpha3.DestinationWeight{{ - Destination: istiov1alpha3.Destination{ - Host: destinationHost, - Port: istiov1alpha3.PortSelector{ - Number: PortNumber, - }, - }}, - }}, - }, + Spec: corev1.ServiceSpec{ + Type: corev1.ServiceTypeExternalName, + ExternalName: dispatcherServiceHostName, }, } } diff --git a/pkg/controller/clusterbus/controller.go b/pkg/controller/clusterbus/controller.go index 8d0fe2cba34..90353a45886 100644 --- a/pkg/controller/clusterbus/controller.go +++ b/pkg/controller/clusterbus/controller.go @@ -49,8 +49,6 @@ 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" - sharedclientset "github.com/knative/pkg/client/clientset/versioned" - sharedinformers "github.com/knative/pkg/client/informers/externalversions" ) const ( @@ -102,11 +100,9 @@ type Controller struct { func NewController( kubeclientset kubernetes.Interface, clusterbusclientset clientset.Interface, - sharedclientset sharedclientset.Interface, restConfig *rest.Config, kubeInformerFactory kubeinformers.SharedInformerFactory, clusterBusInformerFactory informers.SharedInformerFactory, - sharedInformerFactory sharedinformers.SharedInformerFactory, ) controller.Interface { // obtain references to shared index informers for the ClusterBus, Deployment and Service diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index f7228920a4b..84af4e41a49 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -17,15 +17,11 @@ limitations under the License. package controller import ( + clientset "github.com/knative/eventing/pkg/client/clientset/versioned" + informers "github.com/knative/eventing/pkg/client/informers/externalversions" kubeinformers "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" - - 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" ) type Interface interface { @@ -35,9 +31,7 @@ type Interface interface { type Constructor func( kubernetes.Interface, clientset.Interface, - sharedclientset.Interface, *rest.Config, kubeinformers.SharedInformerFactory, informers.SharedInformerFactory, - sharedinformers.SharedInformerFactory, ) Interface diff --git a/pkg/controller/names.go b/pkg/controller/names.go index 852481adc73..bbed895cc94 100644 --- a/pkg/controller/names.go +++ b/pkg/controller/names.go @@ -42,18 +42,10 @@ func ClusterBusDispatcherServiceName(clusterBusName string) string { return fmt.Sprintf("%s-clusterbus", clusterBusName) } -func ChannelVirtualServiceName(channelName string) string { - return fmt.Sprintf("%s-channel", channelName) -} - func ChannelServiceName(channelName string) string { return fmt.Sprintf("%s-channel", channelName) } -func ChannelHostName(channelName, namespace string) string { - return fmt.Sprintf("%s.%s.channels.cluster.local", channelName, namespace) -} - func ServiceHostName(serviceName, namespace string) string { return fmt.Sprintf("%s.%s.svc.cluster.local", serviceName, namespace) } diff --git a/pkg/controller/util/channel_util.go b/pkg/controller/util/channel_util.go index 2fbce0caca0..b9db67ff3a6 100644 --- a/pkg/controller/util/channel_util.go +++ b/pkg/controller/util/channel_util.go @@ -70,7 +70,6 @@ func RemoveChannelCondition(status *v1alpha1.ChannelStatus, condType v1alpha1.Ch func ConsolidateChannelCondition(status *v1alpha1.ChannelStatus) { subConditionsTypes := []v1alpha1.ChannelConditionType{ v1alpha1.ChannelProvisioned, - v1alpha1.ChannelRoutable, v1alpha1.ChannelServiceable, } cond := NewChannelCondition(v1alpha1.ChannelReady, v1.ConditionTrue, "", "") diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index 915f0a65ad7..66125f281bc 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -147,6 +147,10 @@ function run_k8s_events_test() { # Install stub bus echo "Installing stub bus" ko apply -f test/e2e/k8sevents/stub.yaml || return 1 + + # Install istio serviceentry for channels + echo "Installing istio serviceentry for channels" + ko apply -f test/e2e/k8sevents/serviceentry.yaml || return 1 # Install k8s events as an event source echo "Installing k8s events as an event source" diff --git a/test/e2e/k8sevents/serviceentry.yaml b/test/e2e/k8sevents/serviceentry.yaml new file mode 100644 index 00000000000..c92c2081471 --- /dev/null +++ b/test/e2e/k8sevents/serviceentry.yaml @@ -0,0 +1,13 @@ +apiVersion: networking.istio.io/v1alpha3 +kind: ServiceEntry +metadata: + name: knative-channels + namespace: e2etestfn +spec: + hosts: + - '*-channel.e2etestfn.svc.cluster.local' + location: MESH_INTERNAL + ports: + - name: http + number: 80 + protocol: HTTP diff --git a/vendor/github.com/knative/pkg/apis/istio/register.go b/vendor/github.com/knative/pkg/apis/istio/register.go deleted file mode 100644 index 647eb38a0e1..00000000000 --- a/vendor/github.com/knative/pkg/apis/istio/register.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package istio - -const ( - GroupName = "networking.istio.io" -) diff --git a/vendor/github.com/knative/pkg/apis/istio/v1alpha3/doc.go b/vendor/github.com/knative/pkg/apis/istio/v1alpha3/doc.go deleted file mode 100644 index 47ec83daedf..00000000000 --- a/vendor/github.com/knative/pkg/apis/istio/v1alpha3/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2018 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. -*/ - -// Api versions allow the api contract for a resource to be changed while keeping -// backward compatibility by support multiple concurrent versions -// of the same resource - -// +k8s:deepcopy-gen=package -// +groupName=networking.istio.io -package v1alpha3 diff --git a/vendor/github.com/knative/pkg/apis/istio/v1alpha3/gateway_types.go b/vendor/github.com/knative/pkg/apis/istio/v1alpha3/gateway_types.go deleted file mode 100644 index 0822a5e3b4e..00000000000 --- a/vendor/github.com/knative/pkg/apis/istio/v1alpha3/gateway_types.go +++ /dev/null @@ -1,318 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha3 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Gateway describes a load balancer operating at the edge of the mesh -// receiving incoming or outgoing HTTP/TCP connections. The specification -// describes a set of ports that should be exposed, the type of protocol to -// use, SNI configuration for the load balancer, etc. -// -// For example, the following gateway spec sets up a proxy to act as a load -// balancer exposing port 80 and 9080 (http), 443 (https), and port 2379 -// (TCP) for ingress. The gateway will be applied to the proxy running on -// a pod with labels "app: my-gateway-controller". While Istio will configure the -// proxy to listen on these ports, it is the responsibility of the user to -// ensure that external traffic to these ports are allowed into the mesh. -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: Gateway -// metadata: -// name: my-gateway -// spec: -// selector: -// app: my-gatweway-controller -// servers: -// - port: -// number: 80 -// name: http -// protocol: HTTP -// hosts: -// - uk.bookinfo.com -// - eu.bookinfo.com -// tls: -// httpsRedirect: true # sends 302 redirect for http requests -// - port: -// number: 443 -// name: https -// protocol: HTTPS -// hosts: -// - uk.bookinfo.com -// - eu.bookinfo.com -// tls: -// mode: SIMPLE #enables HTTPS on this port -// serverCertificate: /etc/certs/servercert.pem -// privateKey: /etc/certs/privatekey.pem -// - port: -// number: 9080 -// name: http-wildcard -// protocol: HTTP -// # no hosts implies wildcard match -// - port: -// number: 2379 #to expose internal service via external port 2379 -// name: mongo -// protocol: MONGO -// -// The gateway specification above describes the L4-L6 properties of a load -// balancer. A VirtualService can then be bound to a gateway to control -// the forwarding of traffic arriving at a particular host or gateway port. -// -// For example, the following VirtualService splits traffic for -// https://uk.bookinfo.com/reviews, https://eu.bookinfo.com/reviews, -// http://uk.bookinfo.com:9080/reviews, http://eu.bookinfo.com:9080/reviews -// into two versions (prod and qa) of an internal reviews service on port -// 9080. In addition, requests containing the cookie user: dev-123 will be -// sent to special port 7777 in the qa version. The same rule is also -// applicable inside the mesh for requests to the reviews.prod -// service. This rule is applicable across ports 443, 9080. Note that -// http://uk.bookinfo.com gets redirected to https://uk.bookinfo.com -// (i.e. 80 redirects to 443). -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: bookinfo-rule -// spec: -// hosts: -// - reviews.prod -// - uk.bookinfo.com -// - eu.bookinfo.com -// gateways: -// - my-gateway -// - mesh # applies to all the sidecars in the mesh -// http: -// - match: -// - headers: -// cookie: -// user: dev-123 -// route: -// - destination: -// port: -// number: 7777 -// name: reviews.qa -// - match: -// uri: -// prefix: /reviews/ -// route: -// - destination: -// port: -// number: 9080 # can be omitted if its the only port for reviews -// name: reviews.prod -// weight: 80 -// - destination: -// name: reviews.qa -// weight: 20 -// -// The following VirtualService forwards traffic arriving at (external) port -// 2379 from 172.17.16.0/24 subnet to internal Mongo server on port 5555. This -// rule is not applicable internally in the mesh as the gateway list omits -// the reserved name "mesh". -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: bookinfo-Mongo -// spec: -// hosts: -// - mongosvr #name of Mongo service -// gateways: -// - my-gateway -// tcp: -// - match: -// - port: -// number: 2379 -// sourceSubnet: "172.17.16.0/24" -// route: -// - destination: -// name: mongo.prod -// -type Gateway struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec GatewaySpec `json:"spec"` -} - -type GatewaySpec struct { - // REQUIRED: A list of server specifications. - Servers []Server `json:"servers"` - - // One or more labels that indicate a specific set of pods/VMs - // on which this gateway configuration should be applied. - // If no selectors are provided, the gateway will be implemented by - // the default istio-ingress controller. - Selector map[string]string `json:"selector,omitempty"` -} - -// Server describes the properties of the proxy on a given load balancer port. -// For example, -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: Gateway -// metadata: -// name: my-ingress -// spec: -// selector: -// app: my-ingress-controller -// servers: -// - port: -// number: 80 -// name: http2 -// protocol: HTTP2 -// -// Another example -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: Gateway -// metadata: -// name: my-tcp-ingress -// spec: -// selector: -// app: my-tcp-ingress-controller -// servers: -// - port: -// number: 27018 -// name: mongo -// protocol: MONGO -// -// The following is an example of TLS configuration for port 443 -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: Gateway -// metadata: -// name: my-tls-ingress -// spec: -// selector: -// app: my-tls-ingress-controller -// servers: -// - port: -// number: 443 -// name: https -// protocol: HTTPS -// tls: -// mode: SIMPLE -// serverCertificate: /etc/certs/server.pem -// privateKey: /etc/certs/privatekey.pem -// -type Server struct { - // REQUIRED: The Port on which the proxy should listen for incoming - // connections - Port Port `json:"port"` - - // A list of hosts exposed by this gateway. While - // typically applicable to HTTP services, it can also be used for TCP - // services using TLS with SNI. Standard DNS wildcard prefix syntax - // is permitted. - // - // A VirtualService that is bound to a gateway must having a matching host - // in its default destination. Specifically one of the VirtualService - // destination hosts is a strict suffix of a gateway host or - // a gateway host is a suffix of one of the VirtualService hosts. - Hosts []string `json:"hosts,omitempty"` - - // Set of TLS related options that govern the server's behavior. Use - // these options to control if all http requests should be redirected to - // https, and the TLS modes to use. - TLS *TLSOptions `json:"tls,omitempty"` -} - -type TLSOptions struct { - // If set to true, the load balancer will send a 302 redirect for all - // http connections, asking the clients to use HTTPS. - HttpsRedirect bool `json:"httpsRedirect"` - - // Optional: Indicates whether connections to this port should be - // secured using TLS. The value of this field determines how TLS is - // enforced. - Mode TLSMode `json:"mode,omitempty"` - - // REQUIRED if mode is "SIMPLE" or "MUTUAL". The path to the file - // holding the server-side TLS certificate to use. - ServerCertificate string `json:"serverCertificate"` - - // REQUIRED if mode is "SIMPLE" or "MUTUAL". The path to the file - // holding the server's private key. - PrivateKey string `json:"privateKey"` - - // REQUIRED if mode is "MUTUAL". The path to a file containing - // certificate authority certificates to use in verifying a presented - // client side certificate. - CaCertificates string `json:"caCertificates"` - - // A list of alternate names to verify the subject identity in the - // certificate presented by the client. - SubjectAltNames []string `json:"subjectAltNames"` -} - -// TLS modes enforced by the proxy -type TLSMode string - -const ( - // If set to "PASSTHROUGH", the proxy will forward the connection - // to the upstream server selected based on the SNI string presented - // by the client. - TLSModePassThrough TLSMode = "PASSTHROUGH" - - // If set to "SIMPLE", the proxy will secure connections with - // standard TLS semantics. - TLSModeSimple TLSMode = "SIMPLE" - - // If set to "MUTUAL", the proxy will secure connections to the - // upstream using mutual TLS by presenting client certificates for - // authentication. - TLSModeMutual TLSMode = "MUTUAL" -) - -// Port describes the properties of a specific port of a service. -type Port struct { - // REQUIRED: A valid non-negative integer port number. - Number int `json:"number"` - - // REQUIRED: The protocol exposed on the port. - // MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP. - Protocol PortProtocol `json:"protocol"` - - // Label assigned to the port. - Name string `json:"name,omitempty"` -} - -type PortProtocol string - -const ( - ProtocolHTTP PortProtocol = "HTTP" - ProtocolHTTPS PortProtocol = "HTTPS" - ProtocolGRPC PortProtocol = "GRPC" - ProtocolHTTP2 PortProtocol = "HTTP2" - ProtocolMongo PortProtocol = "Mongo" - ProtocolTCP PortProtocol = "TCP" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// GatewayList is a list of Gateway resources -type GatewayList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []Gateway `json:"items"` -} diff --git a/vendor/github.com/knative/pkg/apis/istio/v1alpha3/register.go b/vendor/github.com/knative/pkg/apis/istio/v1alpha3/register.go deleted file mode 100644 index 9ea16a53333..00000000000 --- a/vendor/github.com/knative/pkg/apis/istio/v1alpha3/register.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha3 - -import ( - "github.com/knative/pkg/apis/istio" - 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: istio.GroupName, Version: "v1alpha3"} - -// Kind takes an unqualified kind and returns back a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &VirtualService{}, - &Gateway{}, - &VirtualServiceList{}, - &GatewayList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/vendor/github.com/knative/pkg/apis/istio/v1alpha3/virtualservice_types.go b/vendor/github.com/knative/pkg/apis/istio/v1alpha3/virtualservice_types.go deleted file mode 100644 index 87e2f9815ef..00000000000 --- a/vendor/github.com/knative/pkg/apis/istio/v1alpha3/virtualservice_types.go +++ /dev/null @@ -1,783 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha3 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VirtualService -type VirtualService struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec VirtualServiceSpec `json:"spec"` -} - -// A VirtualService defines a set of traffic routing rules to apply when a host is -// addressed. Each routing rule defines matching criteria for traffic of a specific -// protocol. If the traffic is matched, then it is sent to a named destination service -// (or subset/version of it) defined in the registry. -// -// The source of traffic can also be matched in a routing rule. This allows routing -// to be customized for specific client contexts. -// -// The following example routes all HTTP traffic by default to -// pods of the reviews service with label "version: v1". In addition, -// HTTP requests containing /wpcatalog/, /consumercatalog/ url prefixes will -// be rewritten to /newcatalog and sent to pods with label "version: v2". The -// rules will be applied at the gateway named "bookinfo" as well as at all -// the sidecars in the mesh (indicated by the reserved gateway name -// "mesh"). -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: reviews-route -// spec: -// hosts: -// - reviews -// gateways: # if omitted, defaults to "mesh" -// - bookinfo -// - mesh -// http: -// - match: -// - uri: -// prefix: "/wpcatalog" -// - uri: -// prefix: "/consumercatalog" -// rewrite: -// uri: "/newcatalog" -// route: -// - destination: -// host: reviews -// subset: v2 -// - route: -// - destination: -// host: reviews -// subset: v1 -// -// A subset/version of a route destination is identified with a reference -// to a named service subset which must be declared in a corresponding -// DestinationRule. -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: DestinationRule -// metadata: -// name: reviews-destination -// spec: -// host: reviews -// subsets: -// - name: v1 -// labels: -// version: v1 -// - name: v2 -// labels: -// version: v2 -// -// A host name can be defined by only one VirtualService. A single -// VirtualService can be used to describe traffic properties for multiple -// HTTP and TCP ports. -type VirtualServiceSpec struct { - // REQUIRED. The destination address for traffic captured by this virtual - // service. Could be a DNS name with wildcard prefix or a CIDR - // prefix. Depending on the platform, short-names can also be used - // instead of a FQDN (i.e. has no dots in the name). In such a scenario, - // the FQDN of the host would be derived based on the underlying - // platform. - // - // For example on Kubernetes, when hosts contains a short name, Istio will - // interpret the short name based on the namespace of the rule. Thus, when a - // client namespace applies a rule in the "default" namespace containing a name - // "reviews, Istio will setup routes to the "reviews.default.svc.cluster.local" - // service. However, if a different name such as "reviews.sales.svc.cluster.local" - // is used, it would be treated as a FQDN during virtual host matching. - // In Consul, a plain service name would be resolved to the FQDN - // "reviews.service.consul". - // - // Note that the hosts field applies to both HTTP and TCP - // services. Service inside the mesh, i.e., those found in the service - // registry, must always be referred to using their alphanumeric - // names. IP addresses or CIDR prefixes are allowed only for services - // defined via the Gateway. - Hosts []string `json:"hosts"` - - // The names of gateways and sidecars that should apply these routes. A - // single VirtualService is used for sidecars inside the mesh as well - // as for one or more gateways. The selection condition imposed by this field - // can be overridden using the source field in the match conditions of HTTP/TCP - // routes. The reserved word "mesh" is used to imply all the sidecars in - // the mesh. When this field is omitted, the default gateway ("mesh") - // will be used, which would apply the rule to all sidecars in the - // mesh. If a list of gateway names is provided, the rules will apply - // only to the gateways. To apply the rules to both gateways and sidecars, - // specify "mesh" as one of the gateway names. - Gateways []string `json:"gateways,omitempty"` - - // An ordered list of route rules for HTTP traffic. - // The first rule matching an incoming request is used. - Http []HTTPRoute `json:"http,omitempty"` - - // An ordered list of route rules for TCP traffic. - // The first rule matching an incoming request is used. - Tcp []TCPRoute `json:"tcp,omitempty"` -} - -// Describes match conditions and actions for routing HTTP/1.1, HTTP2, and -// gRPC traffic. See VirtualService for usage examples. -type HTTPRoute struct { - // Match conditions to be satisfied for the rule to be - // activated. All conditions inside a single match block have AND - // semantics, while the list of match blocks have OR semantics. The rule - // is matched if any one of the match blocks succeed. - Match []HTTPMatchRequest `json:"match,omitempty"` - - // A http rule can either redirect or forward (default) traffic. The - // forwarding target can be one of several versions of a service (see - // glossary in beginning of document). Weights associated with the - // service version determine the proportion of traffic it receives. - Route []DestinationWeight `json:"route,omitempty"` - - // A http rule can either redirect or forward (default) traffic. If - // traffic passthrough option is specified in the rule, - // route/redirect will be ignored. The redirect primitive can be used to - // send a HTTP 302 redirect to a different URI or Authority. - Redirect *HTTPRedirect `json:"redirect,omitempty"` - - // Rewrite HTTP URIs and Authority headers. Rewrite cannot be used with - // Redirect primitive. Rewrite will be performed before forwarding. - Rewrite *HTTPRewrite `json:"rewrite,omitempty"` - - // Indicates that a HTTP/1.1 client connection to this particular route - // should be allowed (and expected) to upgrade to a WebSocket connection. - // The default is false. Istio's reference sidecar implementation (Envoy) - // expects the first request to this route to contain the WebSocket - // upgrade headers. Otherwise, the request will be rejected. Note that - // Websocket allows secondary protocol negotiation which may then be - // subject to further routing rules based on the protocol selected. - WebsocketUpgrade bool `json:"websocketUpgrade,omitempty"` - - // Timeout for HTTP requests. - Timeout string `json:"timeout,omitempty"` - - // Retry policy for HTTP requests. - Retries *HTTPRetry `json:"retries,omitempty"` - - // Fault injection policy to apply on HTTP traffic. - Fault *HTTPFaultInjection `json:"fault,omitempty"` - - // Mirror HTTP traffic to a another destination in addition to forwarding - // the requests to the intended destination. Mirrored traffic is on a - // best effort basis where the sidecar/gateway will not wait for the - // mirrored cluster to respond before returning the response from the - // original destination. Statistics will be generated for the mirrored - // destination. - Mirror *Destination `json:"mirror,omitempty"` - - // Additional HTTP headers to add before forwarding a request to the - // destination service. - AppendHeaders map[string]string `json:"appendHeaders,omitempty"` - - // Http headers to remove before returning the response to the caller - RemoveResponseHeaders map[string]string `json:"removeResponseHeaders,omitempty"` -} - -// HttpMatchRequest specifies a set of criterion to be met in order for the -// rule to be applied to the HTTP request. For example, the following -// restricts the rule to match only requests where the URL path -// starts with /ratings/v2/ and the request contains a "cookie" with value -// "user=jason". -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: ratings-route -// spec: -// hosts: -// - ratings -// http: -// - match: -// - headers: -// cookie: -// regex: "^(.*?;)?(user=jason)(;.*)?" -// uri: -// prefix: "/ratings/v2/" -// route: -// - destination: -// host: ratings -// -// HTTPMatchRequest CANNOT be empty. -type HTTPMatchRequest struct { - // URI to match - // values are case-sensitive and formatted as follows: - // - // - `exact: "value"` for exact string match - // - // - `prefix: "value"` for prefix-based match - // - // - `regex: "value"` for ECMAscript style regex-based match - // - Uri *StringMatch `json:"uri,omitempty"` - - // URI Scheme - // values are case-sensitive and formatted as follows: - // - // - `exact: "value"` for exact string match - // - // - `prefix: "value"` for prefix-based match - // - // - `regex: "value"` for ECMAscript style regex-based match - // - Scheme *StringMatch `json:"scheme,omitempty"` - - // HTTP Method - // values are case-sensitive and formatted as follows: - // - // - `exact: "value"` for exact string match - // - // - `prefix: "value"` for prefix-based match - // - // - `regex: "value"` for ECMAscript style regex-based match - // - Method *StringMatch `json:"method,omitempty"` - - // HTTP Authority - // values are case-sensitive and formatted as follows: - // - // - `exact: "value"` for exact string match - // - // - `prefix: "value"` for prefix-based match - // - // - `regex: "value"` for ECMAscript style regex-based match - // - Authority *StringMatch `json:"authority,omitempty"` - - // The header keys must be lowercase and use hyphen as the separator, - // e.g. _x-request-id_. - // - // Header values are case-sensitive and formatted as follows: - // - // - `exact: "value"` for exact string match - // - // - `prefix: "value"` for prefix-based match - // - // - `regex: "value"` for ECMAscript style regex-based match - // - // **Note:** The keys `uri`, `scheme`, `method`, and `authority` will be ignored. - Headers map[string]StringMatch `json:"headers,omitempty"` -} - -// Describes how to match a given string in HTTP headers. Match is -// case-sensitive. -type StringMatch struct { - // Specified exactly one of the fields below. - - // exact string match - Exact string `json:"exact,omitempty"` - - // prefix-based match - Prefix string `json:"prefix,omitempty"` - - // ECMAscript style regex-based match - Regex string `json:"regex,omitempty"` -} - -type DestinationWeight struct { - // REQUIRED. Destination uniquely identifies the instances of a service - // to which the request/connection should be forwarded to. - Destination Destination `json:"destination"` - - // REQUIRED. The proportion of traffic to be forwarded to the service - // version. (0-100). Sum of weights across destinations SHOULD BE == 100. - // If there is only destination in a rule, the weight value is assumed to - // be 100. - Weight int `json:"weight"` -} - -// Destination indicates the network addressable service to which the -// request/connection will be sent after processing a routing rule. The -// destination.name should unambiguously refer to a service in the service -// registry. It can be a short name or a fully qualified domain name from -// the service registry, a resolvable DNS name, an IP address or a service -// name from the service registry and a subset name. The order of inference -// is as follows: -// -// 1. Service registry lookup. The entire name is looked up in the service -// registry. If the lookup succeeds, the search terminates. The requests -// will be routed to any instance of the service in the mesh. When the -// service name consists of a single word, the FQDN will be constructed in -// a platform specific manner. For example, in Kubernetes, the namespace -// associated with the routing rule will be used to identify the service as -// .. However, if the service name contains -// multiple words separated by a dot (e.g., reviews.prod), the name in its -// entirety would be looked up in the service registry. -// -// 2. Runtime DNS lookup by the proxy. If step 1 fails, and the name is not -// an IP address, it will be considered as a DNS name that is not in the -// service registry (e.g., wikipedia.org). The sidecar/gateway will resolve -// the DNS and load balance requests appropriately. See Envoy's strict_dns -// for details. -// -// The following example routes all traffic by default to pods of the -// reviews service with label "version: v1" (i.e., subset v1), and some -// to subset v2, in a kubernetes environment. -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: reviews-route -// spec: -// hosts: -// - reviews # namespace is same as the client/caller's namespace -// http: -// - match: -// - uri: -// prefix: "/wpcatalog" -// - uri: -// prefix: "/consumercatalog" -// rewrite: -// uri: "/newcatalog" -// route: -// - destination: -// host: reviews -// subset: v2 -// - route: -// - destination: -// host: reviews -// subset: v1 -// -// And the associated DestinationRule -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: DestinationRule -// metadata: -// name: reviews-destination -// spec: -// host: reviews -// subsets: -// - name: v1 -// labels: -// version: v1 -// - name: v2 -// labels: -// version: v2 -// -// The following VirtualService sets a timeout of 5s for all calls to -// productpage.prod service. Notice that there are no subsets defined in -// this rule. Istio will fetch all instances of productpage.prod service -// from the service registry and populate the sidecar's load balancing -// pool. -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: my-productpage-rule -// spec: -// hosts: -// - productpage.prod # in kubernetes, this applies only to prod namespace -// http: -// - timeout: 5s -// route: -// - destination: -// host: productpage.prod -// -// The following sets a timeout of 5s for all calls to the external -// service wikipedia.org, as there is no internal service of that name. -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: my-wiki-rule -// spec: -// hosts: -// - wikipedia.org -// http: -// - timeout: 5s -// route: -// - destination: -// host: wikipedia.org -// -type Destination struct { - // REQUIRED. The name of a service from the service registry. Service - // names are looked up from the platform's service registry (e.g., - // Kubernetes services, Consul services, etc.) and from the hosts - // declared by [ServiceEntry](#ServiceEntry). Traffic forwarded to - // destinations that are not found in either of the two, will be dropped. - // - // *Note for Kubernetes users*: When short names are used (e.g. "reviews" - // instead of "reviews.default.svc.cluster.local"), Istio will interpret - // the short name based on the namespace of the rule, not the service. A - // rule in the "default" namespace containing a host "reviews will be - // interpreted as "reviews.default.svc.cluster.local", irrespective of - // the actual namespace associated with the reviews service. _To avoid - // potential misconfigurations, it is recommended to always use fully - // qualified domain names over short names._ - Host string `json:"host"` - - // The name of a subset within the service. Applicable only to services - // within the mesh. The subset must be defined in a corresponding - // DestinationRule. - Subset string `json:"subset,omitempty"` - - // Specifies the port on the host that is being addressed. If a service - // exposes only a single port it is not required to explicitly select the - // port. - Port PortSelector `json:"port,omitempty"` -} - -// PortSelector specifies the number of a port to be used for -// matching or selection for final routing. -type PortSelector struct { - // Choose one of the fields below. - - // Valid port number - Number uint32 `json:"number,omitempty"` - - // Valid port name - Name string `json:"name,omitempty"` -} - -// Describes match conditions and actions for routing TCP traffic. The -// following routing rule forwards traffic arriving at port 27017 for -// mongo.prod.svc.cluster.local from 172.17.16.* subnet to another Mongo -// server on port 5555. -// -// ```yaml -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: bookinfo-Mongo -// spec: -// hosts: -// - mongo.prod.svc.cluster.local -// tcp: -// - match: -// - port: 27017 -// sourceSubnet: "172.17.16.0/24" -// route: -// - destination: -// host: mongo.backup.svc.cluster.local -// port: -// number: 5555 -// ``` -type TCPRoute struct { - // Match conditions to be satisfied for the rule to be - // activated. All conditions inside a single match block have AND - // semantics, while the list of match blocks have OR semantics. The rule - // is matched if any one of the match blocks succeed. - Match []L4MatchAttributes `json:"match"` - - // The destination to which the connection should be forwarded to. - // Currently, only one destination is allowed for TCP services. When TCP - // weighted routing support is introduced in Envoy, multiple destinations - // with weights can be specified. - Route DestinationWeight `json:"route"` -} - -// L4 connection match attributes. Note that L4 connection matching support -// is incomplete. -type L4MatchAttributes struct { - // IPv4 or IPv6 ip address of destination with optional subnet. E.g., - // a.b.c.d/xx form or just a.b.c.d. This is only valid when the - // destination service has several IPs and the application explicitly - // specifies a particular IP. - DestinationSubnet string `json:"destinationSubnet,omitempty"` - - // Specifies the port on the host that is being addressed. Many services - // only expose a single port or label ports with the protocols they support, - // in these cases it is not required to explicitly select the port. - Port int `json:"port,omitempty"` - - // IPv4 or IPv6 ip address of source with optional subnet. E.g., a.b.c.d/xx - // form or just a.b.c.d - SourceSubnet string `json:"sourceSubnet,omitempty"` - - // One or more labels that constrain the applicability of a rule to - // workloads with the given labels. If the VirtualService has a list of - // gateways specified at the top, it should include the reserved gateway - // `mesh` in order for this field to be applicable. - SourceLabel map[string]string `json:"sourceLabel,omitempty"` - - // Names of gateways where the rule should be applied to. Gateway names - // at the top of the VirtualService (if any) are overridden. The gateway match is - // independent of sourceLabels. - Gateways []string `json:"gateways,omitempty"` -} - -// HTTPRedirect can be used to send a 302 redirect response to the caller, -// where the Authority/Host and the URI in the response can be swapped with -// the specified values. For example, the following rule redirects -// requests for /v1/getProductRatings API on the ratings service to -// /v1/bookRatings provided by the bookratings service. -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: ratings-route -// spec: -// hosts: -// - ratings -// http: -// - match: -// - uri: -// exact: /v1/getProductRatings -// redirect: -// uri: /v1/bookRatings -// authority: bookratings.default.svc.cluster.local -// ... -// -type HTTPRedirect struct { - // On a redirect, overwrite the Path portion of the URL with this - // value. Note that the entire path will be replaced, irrespective of the - // request URI being matched as an exact path or prefix. - Uri string `json:"uri,omitempty"` - - // On a redirect, overwrite the Authority/Host portion of the URL with - // this value. - Authority string `json:"authority,omitempty"` -} - -// HTTPRewrite can be used to rewrite specific parts of a HTTP request -// before forwarding the request to the destination. Rewrite primitive can -// be used only with the DestinationWeights. The following example -// demonstrates how to rewrite the URL prefix for api call (/ratings) to -// ratings service before making the actual API call. -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: ratings-route -// spec: -// hosts: -// - ratings -// http: -// - match: -// - uri: -// prefix: /ratings -// rewrite: -// uri: /v1/bookRatings -// route: -// - destination: -// host: ratings -// subset: v1 -// -type HTTPRewrite struct { - // rewrite the path (or the prefix) portion of the URI with this - // value. If the original URI was matched based on prefix, the value - // provided in this field will replace the corresponding matched prefix. - Uri string `json:"uri,omitempty"` - - // rewrite the Authority/Host header with this value. - Authority string `json:"authority,omitempty"` -} - -// Describes the retry policy to use when a HTTP request fails. For -// example, the following rule sets the maximum number of retries to 3 when -// calling ratings:v1 service, with a 2s timeout per retry attempt. -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: ratings-route -// spec: -// hosts: -// - ratings -// http: -// - route: -// - destination: -// host: ratings -// subset: v1 -// retries: -// attempts: 3 -// perTryTimeout: 2s -// -type HTTPRetry struct { - // REQUIRED. Number of retries for a given request. The interval - // between retries will be determined automatically (25ms+). Actual - // number of retries attempted depends on the httpReqTimeout. - Attempts int `json:"attempts"` - - // Timeout per retry attempt for a given request. format: 1h/1m/1s/1ms. MUST BE >=1ms. - PerTryTimeout string `json:"perTryTimeout"` -} - -// Describes the Cross-Origin Resource Sharing (CORS) policy, for a given -// service. Refer to -// https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS -// for further details about cross origin resource sharing. For example, -// the following rule restricts cross origin requests to those originating -// from example.com domain using HTTP POST/GET, and sets the -// Access-Control-Allow-Credentials header to false. In addition, it only -// exposes X-Foo-bar header and sets an expiry period of 1 day. -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: ratings-route -// spec: -// hosts: -// - ratings -// http: -// - route: -// - destination: -// host: ratings -// subset: v1 -// corsPolicy: -// allowOrigin: -// - example.com -// allowMethods: -// - POST -// - GET -// allowCredentials: false -// allowHeaders: -// - X-Foo-Bar -// maxAge: "1d" -// -type CorsPolicy struct { - // The list of origins that are allowed to perform CORS requests. The - // content will be serialized into the Access-Control-Allow-Origin - // header. Wildcard * will allow all origins. - AllowOrigin []string `json:"allowOrigin,omitempty"` - - // List of HTTP methods allowed to access the resource. The content will - // be serialized into the Access-Control-Allow-Methods header. - AllowMethods []string `json:"allowMethods,omitempty"` - - // List of HTTP headers that can be used when requesting the - // resource. Serialized to Access-Control-Allow-Methods header. - AllowHeaders []string `json:"allowHeaders,omitempty"` - - // A white list of HTTP headers that the browsers are allowed to - // access. Serialized into Access-Control-Expose-Headers header. - ExposeHeaders []string `json:"exposeHeaders,omitempty"` - - // Specifies how long the the results of a preflight request can be - // cached. Translates to the Access-Control-Max-Age header. - MaxAge string `json:"maxAge,omitempty"` - - // Indicates whether the caller is allowed to send the actual request - // (not the preflight) using credentials. Translates to - // Access-Control-Allow-Credentials header. - AllowCredentials bool `json:"allowCredentials,omitempty"` -} - -// HTTPFaultInjection can be used to specify one or more faults to inject -// while forwarding http requests to the destination specified in a route. -// Fault specification is part of a VirtualService rule. Faults include -// aborting the Http request from downstream service, and/or delaying -// proxying of requests. A fault rule MUST HAVE delay or abort or both. -// -// *Note:* Delay and abort faults are independent of one another, even if -// both are specified simultaneously. -type HTTPFaultInjection struct { - // Delay requests before forwarding, emulating various failures such as - // network issues, overloaded upstream service, etc. - Delay *InjectDelay `json:"delay,omitempty"` - - // Abort Http request attempts and return error codes back to downstream - // service, giving the impression that the upstream service is faulty. - Abort *InjectAbort `json:"abort,omitempty"` -} - -// Delay specification is used to inject latency into the request -// forwarding path. The following example will introduce a 5 second delay -// in 10% of the requests to the "v1" version of the "reviews" -// service from all pods with label env: prod -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: reviews-route -// spec: -// hosts: -// - reviews -// http: -// - match: -// - sourceLabels: -// env: prod -// route: -// - destination: -// host: reviews -// subset: v1 -// fault: -// delay: -// percent: 10 -// fixedDelay: 5s -// -// The _fixedDelay_ field is used to indicate the amount of delay in -// seconds. An optional _percent_ field, a value between 0 and 100, can -// be used to only delay a certain percentage of requests. If left -// unspecified, all request will be delayed. -type InjectDelay struct { - // Percentage of requests on which the delay will be injected (0-100). - Percent int `json:"percent,omitempty"` - - // REQUIRED. Add a fixed delay before forwarding the request. Format: - // 1h/1m/1s/1ms. MUST be >=1ms. - FixedDelay string `json:"fixedDelay"` - - // (-- Add a delay (based on an exponential function) before forwarding - // the request. mean delay needed to derive the exponential delay - // values --) - ExponentialDelay string `json:"exponentialDelay,omitempty"` -} - -// Abort specification is used to prematurely abort a request with a -// pre-specified error code. The following example will return an HTTP -// 400 error code for 10% of the requests to the "ratings" service "v1". -// -// apiVersion: networking.istio.io/v1alpha3 -// kind: VirtualService -// metadata: -// name: ratings-route -// spec: -// hosts: -// - ratings -// http: -// - route: -// - destination: -// host: ratings -// subset: v1 -// fault: -// abort: -// percent: 10 -// httpStatus: 400 -// -// The _httpStatus_ field is used to indicate the HTTP status code to -// return to the caller. The optional _percent_ field, a value between 0 -// and 100, is used to only abort a certain percentage of requests. If -// not specified, all requests are aborted. -type InjectAbort struct { - // Percentage of requests to be aborted with the error code provided (0-100). - Perecent int `json:"percent,omitempty"` - - // REQUIRED. HTTP status code to use to abort the Http request. - HttpStatus int `json:"httpStatus"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VirtualServiceList is a list of VirtualService resources -type VirtualServiceList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []VirtualService `json:"items"` -} diff --git a/vendor/github.com/knative/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go b/vendor/github.com/knative/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go deleted file mode 100644 index 8e323c689a2..00000000000 --- a/vendor/github.com/knative/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go +++ /dev/null @@ -1,649 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 2018 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 deepcopy-gen. DO NOT EDIT. - -package v1alpha3 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CorsPolicy) DeepCopyInto(out *CorsPolicy) { - *out = *in - if in.AllowOrigin != nil { - in, out := &in.AllowOrigin, &out.AllowOrigin - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.AllowMethods != nil { - in, out := &in.AllowMethods, &out.AllowMethods - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.AllowHeaders != nil { - in, out := &in.AllowHeaders, &out.AllowHeaders - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.ExposeHeaders != nil { - in, out := &in.ExposeHeaders, &out.ExposeHeaders - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CorsPolicy. -func (in *CorsPolicy) DeepCopy() *CorsPolicy { - if in == nil { - return nil - } - out := new(CorsPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Destination) DeepCopyInto(out *Destination) { - *out = *in - out.Port = in.Port - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Destination. -func (in *Destination) DeepCopy() *Destination { - if in == nil { - return nil - } - out := new(Destination) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DestinationWeight) DeepCopyInto(out *DestinationWeight) { - *out = *in - out.Destination = in.Destination - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DestinationWeight. -func (in *DestinationWeight) DeepCopy() *DestinationWeight { - if in == nil { - return nil - } - out := new(DestinationWeight) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Gateway) DeepCopyInto(out *Gateway) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Gateway. -func (in *Gateway) DeepCopy() *Gateway { - if in == nil { - return nil - } - out := new(Gateway) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Gateway) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GatewayList) DeepCopyInto(out *GatewayList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Gateway, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayList. -func (in *GatewayList) DeepCopy() *GatewayList { - if in == nil { - return nil - } - out := new(GatewayList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GatewayList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GatewaySpec) DeepCopyInto(out *GatewaySpec) { - *out = *in - if in.Servers != nil { - in, out := &in.Servers, &out.Servers - *out = make([]Server, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewaySpec. -func (in *GatewaySpec) DeepCopy() *GatewaySpec { - if in == nil { - return nil - } - out := new(GatewaySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPFaultInjection) DeepCopyInto(out *HTTPFaultInjection) { - *out = *in - if in.Delay != nil { - in, out := &in.Delay, &out.Delay - *out = new(InjectDelay) - **out = **in - } - if in.Abort != nil { - in, out := &in.Abort, &out.Abort - *out = new(InjectAbort) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPFaultInjection. -func (in *HTTPFaultInjection) DeepCopy() *HTTPFaultInjection { - if in == nil { - return nil - } - out := new(HTTPFaultInjection) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPMatchRequest) DeepCopyInto(out *HTTPMatchRequest) { - *out = *in - if in.Uri != nil { - in, out := &in.Uri, &out.Uri - *out = new(StringMatch) - **out = **in - } - if in.Scheme != nil { - in, out := &in.Scheme, &out.Scheme - *out = new(StringMatch) - **out = **in - } - if in.Method != nil { - in, out := &in.Method, &out.Method - *out = new(StringMatch) - **out = **in - } - if in.Authority != nil { - in, out := &in.Authority, &out.Authority - *out = new(StringMatch) - **out = **in - } - if in.Headers != nil { - in, out := &in.Headers, &out.Headers - *out = make(map[string]StringMatch, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPMatchRequest. -func (in *HTTPMatchRequest) DeepCopy() *HTTPMatchRequest { - if in == nil { - return nil - } - out := new(HTTPMatchRequest) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRedirect) DeepCopyInto(out *HTTPRedirect) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRedirect. -func (in *HTTPRedirect) DeepCopy() *HTTPRedirect { - if in == nil { - return nil - } - out := new(HTTPRedirect) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRetry) DeepCopyInto(out *HTTPRetry) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRetry. -func (in *HTTPRetry) DeepCopy() *HTTPRetry { - if in == nil { - return nil - } - out := new(HTTPRetry) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRewrite) DeepCopyInto(out *HTTPRewrite) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRewrite. -func (in *HTTPRewrite) DeepCopy() *HTTPRewrite { - if in == nil { - return nil - } - out := new(HTTPRewrite) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRoute) DeepCopyInto(out *HTTPRoute) { - *out = *in - if in.Match != nil { - in, out := &in.Match, &out.Match - *out = make([]HTTPMatchRequest, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Route != nil { - in, out := &in.Route, &out.Route - *out = make([]DestinationWeight, len(*in)) - copy(*out, *in) - } - if in.Redirect != nil { - in, out := &in.Redirect, &out.Redirect - *out = new(HTTPRedirect) - **out = **in - } - if in.Rewrite != nil { - in, out := &in.Rewrite, &out.Rewrite - *out = new(HTTPRewrite) - **out = **in - } - if in.Retries != nil { - in, out := &in.Retries, &out.Retries - *out = new(HTTPRetry) - **out = **in - } - if in.Fault != nil { - in, out := &in.Fault, &out.Fault - *out = new(HTTPFaultInjection) - (*in).DeepCopyInto(*out) - } - if in.Mirror != nil { - in, out := &in.Mirror, &out.Mirror - *out = new(Destination) - **out = **in - } - if in.AppendHeaders != nil { - in, out := &in.AppendHeaders, &out.AppendHeaders - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.RemoveResponseHeaders != nil { - in, out := &in.RemoveResponseHeaders, &out.RemoveResponseHeaders - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRoute. -func (in *HTTPRoute) DeepCopy() *HTTPRoute { - if in == nil { - return nil - } - out := new(HTTPRoute) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InjectAbort) DeepCopyInto(out *InjectAbort) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InjectAbort. -func (in *InjectAbort) DeepCopy() *InjectAbort { - if in == nil { - return nil - } - out := new(InjectAbort) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InjectDelay) DeepCopyInto(out *InjectDelay) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InjectDelay. -func (in *InjectDelay) DeepCopy() *InjectDelay { - if in == nil { - return nil - } - out := new(InjectDelay) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *L4MatchAttributes) DeepCopyInto(out *L4MatchAttributes) { - *out = *in - if in.SourceLabel != nil { - in, out := &in.SourceLabel, &out.SourceLabel - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Gateways != nil { - in, out := &in.Gateways, &out.Gateways - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L4MatchAttributes. -func (in *L4MatchAttributes) DeepCopy() *L4MatchAttributes { - if in == nil { - return nil - } - out := new(L4MatchAttributes) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Port) DeepCopyInto(out *Port) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Port. -func (in *Port) DeepCopy() *Port { - if in == nil { - return nil - } - out := new(Port) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PortSelector) DeepCopyInto(out *PortSelector) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortSelector. -func (in *PortSelector) DeepCopy() *PortSelector { - if in == nil { - return nil - } - out := new(PortSelector) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Server) DeepCopyInto(out *Server) { - *out = *in - out.Port = in.Port - if in.Hosts != nil { - in, out := &in.Hosts, &out.Hosts - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.TLS != nil { - in, out := &in.TLS, &out.TLS - *out = new(TLSOptions) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Server. -func (in *Server) DeepCopy() *Server { - if in == nil { - return nil - } - out := new(Server) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *StringMatch) DeepCopyInto(out *StringMatch) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StringMatch. -func (in *StringMatch) DeepCopy() *StringMatch { - if in == nil { - return nil - } - out := new(StringMatch) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TCPRoute) DeepCopyInto(out *TCPRoute) { - *out = *in - if in.Match != nil { - in, out := &in.Match, &out.Match - *out = make([]L4MatchAttributes, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - out.Route = in.Route - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPRoute. -func (in *TCPRoute) DeepCopy() *TCPRoute { - if in == nil { - return nil - } - out := new(TCPRoute) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSOptions) DeepCopyInto(out *TLSOptions) { - *out = *in - if in.SubjectAltNames != nil { - in, out := &in.SubjectAltNames, &out.SubjectAltNames - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSOptions. -func (in *TLSOptions) DeepCopy() *TLSOptions { - if in == nil { - return nil - } - out := new(TLSOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualService) DeepCopyInto(out *VirtualService) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualService. -func (in *VirtualService) DeepCopy() *VirtualService { - if in == nil { - return nil - } - out := new(VirtualService) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VirtualService) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualServiceList) DeepCopyInto(out *VirtualServiceList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VirtualService, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualServiceList. -func (in *VirtualServiceList) DeepCopy() *VirtualServiceList { - if in == nil { - return nil - } - out := new(VirtualServiceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VirtualServiceList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualServiceSpec) DeepCopyInto(out *VirtualServiceSpec) { - *out = *in - if in.Hosts != nil { - in, out := &in.Hosts, &out.Hosts - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Gateways != nil { - in, out := &in.Gateways, &out.Gateways - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Http != nil { - in, out := &in.Http, &out.Http - *out = make([]HTTPRoute, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Tcp != nil { - in, out := &in.Tcp, &out.Tcp - *out = make([]TCPRoute, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualServiceSpec. -func (in *VirtualServiceSpec) DeepCopy() *VirtualServiceSpec { - if in == nil { - return nil - } - out := new(VirtualServiceSpec) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/knative/pkg/client/clientset/versioned/clientset.go b/vendor/github.com/knative/pkg/client/clientset/versioned/clientset.go deleted file mode 100644 index b5e5fa42f5e..00000000000 --- a/vendor/github.com/knative/pkg/client/clientset/versioned/clientset.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2018 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 ( - networkingv1alpha3 "github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface - // Deprecated: please explicitly pick a version if possible. - Networking() networkingv1alpha3.NetworkingV1alpha3Interface -} - -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. -type Clientset struct { - *discovery.DiscoveryClient - networkingV1alpha3 *networkingv1alpha3.NetworkingV1alpha3Client -} - -// NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client -func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface { - return c.networkingV1alpha3 -} - -// Deprecated: Networking retrieves the default version of NetworkingClient. -// Please explicitly pick a version. -func (c *Clientset) Networking() networkingv1alpha3.NetworkingV1alpha3Interface { - return c.networkingV1alpha3 -} - -// 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.networkingV1alpha3, err = networkingv1alpha3.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.networkingV1alpha3 = networkingv1alpha3.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.networkingV1alpha3 = networkingv1alpha3.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/vendor/github.com/knative/pkg/client/clientset/versioned/doc.go b/vendor/github.com/knative/pkg/client/clientset/versioned/doc.go deleted file mode 100644 index 3fe4685848a..00000000000 --- a/vendor/github.com/knative/pkg/client/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 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/vendor/github.com/knative/pkg/client/clientset/versioned/scheme/doc.go b/vendor/github.com/knative/pkg/client/clientset/versioned/scheme/doc.go deleted file mode 100644 index 60ea8ba90eb..00000000000 --- a/vendor/github.com/knative/pkg/client/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 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/vendor/github.com/knative/pkg/client/clientset/versioned/scheme/register.go b/vendor/github.com/knative/pkg/client/clientset/versioned/scheme/register.go deleted file mode 100644 index 8058d5256b6..00000000000 --- a/vendor/github.com/knative/pkg/client/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 2018 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 ( - networkingv1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" - 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" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - AddToScheme(Scheme) -} - -// 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. -func AddToScheme(scheme *runtime.Scheme) { - networkingv1alpha3.AddToScheme(scheme) -} diff --git a/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go b/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go deleted file mode 100644 index acea591f3a3..00000000000 --- a/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 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 typed clients. -package v1alpha3 diff --git a/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go b/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go deleted file mode 100644 index 61ede4c14a7..00000000000 --- a/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go +++ /dev/null @@ -1,157 +0,0 @@ -/* -Copyright 2018 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 v1alpha3 - -import ( - v1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" - scheme "github.com/knative/pkg/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// GatewaysGetter has a method to return a GatewayInterface. -// A group's client should implement this interface. -type GatewaysGetter interface { - Gateways(namespace string) GatewayInterface -} - -// GatewayInterface has methods to work with Gateway resources. -type GatewayInterface interface { - Create(*v1alpha3.Gateway) (*v1alpha3.Gateway, error) - Update(*v1alpha3.Gateway) (*v1alpha3.Gateway, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha3.Gateway, error) - List(opts v1.ListOptions) (*v1alpha3.GatewayList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Gateway, err error) - GatewayExpansion -} - -// gateways implements GatewayInterface -type gateways struct { - client rest.Interface - ns string -} - -// newGateways returns a Gateways -func newGateways(c *NetworkingV1alpha3Client, namespace string) *gateways { - return &gateways{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the gateway, and returns the corresponding gateway object, and an error if there is any. -func (c *gateways) Get(name string, options v1.GetOptions) (result *v1alpha3.Gateway, err error) { - result = &v1alpha3.Gateway{} - err = c.client.Get(). - Namespace(c.ns). - Resource("gateways"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Gateways that match those selectors. -func (c *gateways) List(opts v1.ListOptions) (result *v1alpha3.GatewayList, err error) { - result = &v1alpha3.GatewayList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("gateways"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested gateways. -func (c *gateways) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("gateways"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a gateway and creates it. Returns the server's representation of the gateway, and an error, if there is any. -func (c *gateways) Create(gateway *v1alpha3.Gateway) (result *v1alpha3.Gateway, err error) { - result = &v1alpha3.Gateway{} - err = c.client.Post(). - Namespace(c.ns). - Resource("gateways"). - Body(gateway). - Do(). - Into(result) - return -} - -// Update takes the representation of a gateway and updates it. Returns the server's representation of the gateway, and an error, if there is any. -func (c *gateways) Update(gateway *v1alpha3.Gateway) (result *v1alpha3.Gateway, err error) { - result = &v1alpha3.Gateway{} - err = c.client.Put(). - Namespace(c.ns). - Resource("gateways"). - Name(gateway.Name). - Body(gateway). - Do(). - Into(result) - return -} - -// Delete takes name of the gateway and deletes it. Returns an error if one occurs. -func (c *gateways) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("gateways"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *gateways) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("gateways"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched gateway. -func (c *gateways) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Gateway, err error) { - result = &v1alpha3.Gateway{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("gateways"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go b/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go deleted file mode 100644 index 1e2062d8084..00000000000 --- a/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2018 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 v1alpha3 - -type GatewayExpansion interface{} - -type VirtualServiceExpansion interface{} diff --git a/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go b/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go deleted file mode 100644 index 3fa31904264..00000000000 --- a/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go +++ /dev/null @@ -1,95 +0,0 @@ -/* -Copyright 2018 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 v1alpha3 - -import ( - v1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" - "github.com/knative/pkg/client/clientset/versioned/scheme" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - rest "k8s.io/client-go/rest" -) - -type NetworkingV1alpha3Interface interface { - RESTClient() rest.Interface - GatewaysGetter - VirtualServicesGetter -} - -// NetworkingV1alpha3Client is used to interact with features provided by the networking.istio.io group. -type NetworkingV1alpha3Client struct { - restClient rest.Interface -} - -func (c *NetworkingV1alpha3Client) Gateways(namespace string) GatewayInterface { - return newGateways(c, namespace) -} - -func (c *NetworkingV1alpha3Client) VirtualServices(namespace string) VirtualServiceInterface { - return newVirtualServices(c, namespace) -} - -// NewForConfig creates a new NetworkingV1alpha3Client for the given config. -func NewForConfig(c *rest.Config) (*NetworkingV1alpha3Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &NetworkingV1alpha3Client{client}, nil -} - -// NewForConfigOrDie creates a new NetworkingV1alpha3Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *NetworkingV1alpha3Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new NetworkingV1alpha3Client for the given RESTClient. -func New(c rest.Interface) *NetworkingV1alpha3Client { - return &NetworkingV1alpha3Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha3.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *NetworkingV1alpha3Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go b/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go deleted file mode 100644 index 7c23bbc3a82..00000000000 --- a/vendor/github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go +++ /dev/null @@ -1,157 +0,0 @@ -/* -Copyright 2018 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 v1alpha3 - -import ( - v1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" - scheme "github.com/knative/pkg/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VirtualServicesGetter has a method to return a VirtualServiceInterface. -// A group's client should implement this interface. -type VirtualServicesGetter interface { - VirtualServices(namespace string) VirtualServiceInterface -} - -// VirtualServiceInterface has methods to work with VirtualService resources. -type VirtualServiceInterface interface { - Create(*v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) - Update(*v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha3.VirtualService, error) - List(opts v1.ListOptions) (*v1alpha3.VirtualServiceList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.VirtualService, err error) - VirtualServiceExpansion -} - -// virtualServices implements VirtualServiceInterface -type virtualServices struct { - client rest.Interface - ns string -} - -// newVirtualServices returns a VirtualServices -func newVirtualServices(c *NetworkingV1alpha3Client, namespace string) *virtualServices { - return &virtualServices{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the virtualService, and returns the corresponding virtualService object, and an error if there is any. -func (c *virtualServices) Get(name string, options v1.GetOptions) (result *v1alpha3.VirtualService, err error) { - result = &v1alpha3.VirtualService{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualServices that match those selectors. -func (c *virtualServices) List(opts v1.ListOptions) (result *v1alpha3.VirtualServiceList, err error) { - result = &v1alpha3.VirtualServiceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualServices. -func (c *virtualServices) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a virtualService and creates it. Returns the server's representation of the virtualService, and an error, if there is any. -func (c *virtualServices) Create(virtualService *v1alpha3.VirtualService) (result *v1alpha3.VirtualService, err error) { - result = &v1alpha3.VirtualService{} - err = c.client.Post(). - Namespace(c.ns). - Resource("virtualservices"). - Body(virtualService). - Do(). - Into(result) - return -} - -// Update takes the representation of a virtualService and updates it. Returns the server's representation of the virtualService, and an error, if there is any. -func (c *virtualServices) Update(virtualService *v1alpha3.VirtualService) (result *v1alpha3.VirtualService, err error) { - result = &v1alpha3.VirtualService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualservices"). - Name(virtualService.Name). - Body(virtualService). - Do(). - Into(result) - return -} - -// Delete takes name of the virtualService and deletes it. Returns an error if one occurs. -func (c *virtualServices) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualservices"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualServices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched virtualService. -func (c *virtualServices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.VirtualService, err error) { - result = &v1alpha3.VirtualService{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("virtualservices"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/vendor/github.com/knative/pkg/client/informers/externalversions/factory.go b/vendor/github.com/knative/pkg/client/informers/externalversions/factory.go deleted file mode 100644 index 1489c5ee7ad..00000000000 --- a/vendor/github.com/knative/pkg/client/informers/externalversions/factory.go +++ /dev/null @@ -1,180 +0,0 @@ -/* -Copyright 2018 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" - - versioned "github.com/knative/pkg/client/clientset/versioned" - internalinterfaces "github.com/knative/pkg/client/informers/externalversions/internalinterfaces" - istio "github.com/knative/pkg/client/informers/externalversions/istio" - 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" -) - -// 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 - - Networking() istio.Interface -} - -func (f *sharedInformerFactory) Networking() istio.Interface { - return istio.New(f, f.namespace, f.tweakListOptions) -} diff --git a/vendor/github.com/knative/pkg/client/informers/externalversions/generic.go b/vendor/github.com/knative/pkg/client/informers/externalversions/generic.go deleted file mode 100644 index ba6a2531c73..00000000000 --- a/vendor/github.com/knative/pkg/client/informers/externalversions/generic.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2018 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" - - v1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" -) - -// 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=networking.istio.io, Version=v1alpha3 - case v1alpha3.SchemeGroupVersion.WithResource("gateways"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().Gateways().Informer()}, nil - case v1alpha3.SchemeGroupVersion.WithResource("virtualservices"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().VirtualServices().Informer()}, nil - - } - - return nil, fmt.Errorf("no informer found for %v", resource) -} diff --git a/vendor/github.com/knative/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/vendor/github.com/knative/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go deleted file mode 100644 index 2d488c90744..00000000000 --- a/vendor/github.com/knative/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright 2018 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" - - versioned "github.com/knative/pkg/client/clientset/versioned" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - cache "k8s.io/client-go/tools/cache" -) - -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 -} - -type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/github.com/knative/pkg/client/informers/externalversions/istio/interface.go b/vendor/github.com/knative/pkg/client/informers/externalversions/istio/interface.go deleted file mode 100644 index dd053c21ae4..00000000000 --- a/vendor/github.com/knative/pkg/client/informers/externalversions/istio/interface.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2018 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 networking - -import ( - internalinterfaces "github.com/knative/pkg/client/informers/externalversions/internalinterfaces" - v1alpha3 "github.com/knative/pkg/client/informers/externalversions/istio/v1alpha3" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha3 provides access to shared informers for resources in V1alpha3. - V1alpha3() v1alpha3.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1alpha3 returns a new v1alpha3.Interface. -func (g *group) V1alpha3() v1alpha3.Interface { - return v1alpha3.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/vendor/github.com/knative/pkg/client/informers/externalversions/istio/v1alpha3/gateway.go b/vendor/github.com/knative/pkg/client/informers/externalversions/istio/v1alpha3/gateway.go deleted file mode 100644 index f77a186654a..00000000000 --- a/vendor/github.com/knative/pkg/client/informers/externalversions/istio/v1alpha3/gateway.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2018 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 v1alpha3 - -import ( - time "time" - - istiov1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" - versioned "github.com/knative/pkg/client/clientset/versioned" - internalinterfaces "github.com/knative/pkg/client/informers/externalversions/internalinterfaces" - v1alpha3 "github.com/knative/pkg/client/listers/istio/v1alpha3" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// GatewayInformer provides access to a shared informer and lister for -// Gateways. -type GatewayInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha3.GatewayLister -} - -type gatewayInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewGatewayInformer constructs a new informer for Gateway type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewGatewayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredGatewayInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredGatewayInformer constructs a new informer for Gateway type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredGatewayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NetworkingV1alpha3().Gateways(namespace).List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NetworkingV1alpha3().Gateways(namespace).Watch(options) - }, - }, - &istiov1alpha3.Gateway{}, - resyncPeriod, - indexers, - ) -} - -func (f *gatewayInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredGatewayInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *gatewayInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&istiov1alpha3.Gateway{}, f.defaultInformer) -} - -func (f *gatewayInformer) Lister() v1alpha3.GatewayLister { - return v1alpha3.NewGatewayLister(f.Informer().GetIndexer()) -} diff --git a/vendor/github.com/knative/pkg/client/informers/externalversions/istio/v1alpha3/interface.go b/vendor/github.com/knative/pkg/client/informers/externalversions/istio/v1alpha3/interface.go deleted file mode 100644 index 6bda46ee80d..00000000000 --- a/vendor/github.com/knative/pkg/client/informers/externalversions/istio/v1alpha3/interface.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2018 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 v1alpha3 - -import ( - internalinterfaces "github.com/knative/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // Gateways returns a GatewayInformer. - Gateways() GatewayInformer - // VirtualServices returns a VirtualServiceInformer. - VirtualServices() VirtualServiceInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// Gateways returns a GatewayInformer. -func (v *version) Gateways() GatewayInformer { - return &gatewayInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// VirtualServices returns a VirtualServiceInformer. -func (v *version) VirtualServices() VirtualServiceInformer { - return &virtualServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/github.com/knative/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go b/vendor/github.com/knative/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go deleted file mode 100644 index 8c46a6df028..00000000000 --- a/vendor/github.com/knative/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2018 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 v1alpha3 - -import ( - time "time" - - istiov1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" - versioned "github.com/knative/pkg/client/clientset/versioned" - internalinterfaces "github.com/knative/pkg/client/informers/externalversions/internalinterfaces" - v1alpha3 "github.com/knative/pkg/client/listers/istio/v1alpha3" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VirtualServiceInformer provides access to a shared informer and lister for -// VirtualServices. -type VirtualServiceInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha3.VirtualServiceLister -} - -type virtualServiceInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVirtualServiceInformer constructs a new informer for VirtualService type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVirtualServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVirtualServiceInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVirtualServiceInformer constructs a new informer for VirtualService type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVirtualServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NetworkingV1alpha3().VirtualServices(namespace).List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NetworkingV1alpha3().VirtualServices(namespace).Watch(options) - }, - }, - &istiov1alpha3.VirtualService{}, - resyncPeriod, - indexers, - ) -} - -func (f *virtualServiceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVirtualServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *virtualServiceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&istiov1alpha3.VirtualService{}, f.defaultInformer) -} - -func (f *virtualServiceInformer) Lister() v1alpha3.VirtualServiceLister { - return v1alpha3.NewVirtualServiceLister(f.Informer().GetIndexer()) -} diff --git a/vendor/github.com/knative/pkg/client/listers/istio/v1alpha3/expansion_generated.go b/vendor/github.com/knative/pkg/client/listers/istio/v1alpha3/expansion_generated.go deleted file mode 100644 index 3e06aa85bb6..00000000000 --- a/vendor/github.com/knative/pkg/client/listers/istio/v1alpha3/expansion_generated.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha3 - -// GatewayListerExpansion allows custom methods to be added to -// GatewayLister. -type GatewayListerExpansion interface{} - -// GatewayNamespaceListerExpansion allows custom methods to be added to -// GatewayNamespaceLister. -type GatewayNamespaceListerExpansion interface{} - -// VirtualServiceListerExpansion allows custom methods to be added to -// VirtualServiceLister. -type VirtualServiceListerExpansion interface{} - -// VirtualServiceNamespaceListerExpansion allows custom methods to be added to -// VirtualServiceNamespaceLister. -type VirtualServiceNamespaceListerExpansion interface{} diff --git a/vendor/github.com/knative/pkg/client/listers/istio/v1alpha3/gateway.go b/vendor/github.com/knative/pkg/client/listers/istio/v1alpha3/gateway.go deleted file mode 100644 index 6e76c109815..00000000000 --- a/vendor/github.com/knative/pkg/client/listers/istio/v1alpha3/gateway.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha3 - -import ( - v1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// GatewayLister helps list Gateways. -type GatewayLister interface { - // List lists all Gateways in the indexer. - List(selector labels.Selector) (ret []*v1alpha3.Gateway, err error) - // Gateways returns an object that can list and get Gateways. - Gateways(namespace string) GatewayNamespaceLister - GatewayListerExpansion -} - -// gatewayLister implements the GatewayLister interface. -type gatewayLister struct { - indexer cache.Indexer -} - -// NewGatewayLister returns a new GatewayLister. -func NewGatewayLister(indexer cache.Indexer) GatewayLister { - return &gatewayLister{indexer: indexer} -} - -// List lists all Gateways in the indexer. -func (s *gatewayLister) List(selector labels.Selector) (ret []*v1alpha3.Gateway, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha3.Gateway)) - }) - return ret, err -} - -// Gateways returns an object that can list and get Gateways. -func (s *gatewayLister) Gateways(namespace string) GatewayNamespaceLister { - return gatewayNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// GatewayNamespaceLister helps list and get Gateways. -type GatewayNamespaceLister interface { - // List lists all Gateways in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha3.Gateway, err error) - // Get retrieves the Gateway from the indexer for a given namespace and name. - Get(name string) (*v1alpha3.Gateway, error) - GatewayNamespaceListerExpansion -} - -// gatewayNamespaceLister implements the GatewayNamespaceLister -// interface. -type gatewayNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Gateways in the indexer for a given namespace. -func (s gatewayNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.Gateway, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha3.Gateway)) - }) - return ret, err -} - -// Get retrieves the Gateway from the indexer for a given namespace and name. -func (s gatewayNamespaceLister) Get(name string) (*v1alpha3.Gateway, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha3.Resource("gateway"), name) - } - return obj.(*v1alpha3.Gateway), nil -} diff --git a/vendor/github.com/knative/pkg/client/listers/istio/v1alpha3/virtualservice.go b/vendor/github.com/knative/pkg/client/listers/istio/v1alpha3/virtualservice.go deleted file mode 100644 index df7b350c2fd..00000000000 --- a/vendor/github.com/knative/pkg/client/listers/istio/v1alpha3/virtualservice.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha3 - -import ( - v1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VirtualServiceLister helps list VirtualServices. -type VirtualServiceLister interface { - // List lists all VirtualServices in the indexer. - List(selector labels.Selector) (ret []*v1alpha3.VirtualService, err error) - // VirtualServices returns an object that can list and get VirtualServices. - VirtualServices(namespace string) VirtualServiceNamespaceLister - VirtualServiceListerExpansion -} - -// virtualServiceLister implements the VirtualServiceLister interface. -type virtualServiceLister struct { - indexer cache.Indexer -} - -// NewVirtualServiceLister returns a new VirtualServiceLister. -func NewVirtualServiceLister(indexer cache.Indexer) VirtualServiceLister { - return &virtualServiceLister{indexer: indexer} -} - -// List lists all VirtualServices in the indexer. -func (s *virtualServiceLister) List(selector labels.Selector) (ret []*v1alpha3.VirtualService, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha3.VirtualService)) - }) - return ret, err -} - -// VirtualServices returns an object that can list and get VirtualServices. -func (s *virtualServiceLister) VirtualServices(namespace string) VirtualServiceNamespaceLister { - return virtualServiceNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VirtualServiceNamespaceLister helps list and get VirtualServices. -type VirtualServiceNamespaceLister interface { - // List lists all VirtualServices in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha3.VirtualService, err error) - // Get retrieves the VirtualService from the indexer for a given namespace and name. - Get(name string) (*v1alpha3.VirtualService, error) - VirtualServiceNamespaceListerExpansion -} - -// virtualServiceNamespaceLister implements the VirtualServiceNamespaceLister -// interface. -type virtualServiceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VirtualServices in the indexer for a given namespace. -func (s virtualServiceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.VirtualService, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha3.VirtualService)) - }) - return ret, err -} - -// Get retrieves the VirtualService from the indexer for a given namespace and name. -func (s virtualServiceNamespaceLister) Get(name string) (*v1alpha3.VirtualService, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha3.Resource("virtualservice"), name) - } - return obj.(*v1alpha3.VirtualService), nil -}