From 18780c6d8c78000986b131958c2114d85b09f350 Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Fri, 15 Jun 2018 14:22:58 -0400 Subject: [PATCH 1/3] Update to Istio v1alpha3 types RouteRule -> VirtualService Ingress -> Gateway --- Gopkg.lock | 16 +- Gopkg.toml | 4 +- cmd/controller/main.go | 2 +- hack/update-codegen.sh | 2 +- pkg/apis/istio/register.go | 23 - pkg/apis/istio/v1alpha2/doc.go | 20 - pkg/apis/istio/v1alpha2/register.go | 56 -- pkg/apis/istio/v1alpha2/routerule.go | 72 -- .../istio/v1alpha2/zz_generated.deepcopy.go | 182 ---- .../istio/v1alpha2/zz_generated.defaults.go | 32 - pkg/client/clientset/versioned/clientset.go | 22 - .../versioned/fake/clientset_generated.go | 12 - .../clientset/versioned/fake/register.go | 2 - .../clientset/versioned/scheme/register.go | 2 - .../versioned/typed/istio/v1alpha2/doc.go | 20 - .../typed/istio/v1alpha2/fake/doc.go | 20 - .../istio/v1alpha2/fake/fake_istio_client.go | 40 - .../istio/v1alpha2/fake/fake_routerule.go | 128 --- .../istio/v1alpha2/generated_expansion.go | 21 - .../typed/istio/v1alpha2/istio_client.go | 90 -- .../typed/istio/v1alpha2/routerule.go | 157 ---- .../informers/externalversions/factory.go | 6 - .../informers/externalversions/generic.go | 5 - .../externalversions/istio/interface.go | 46 - .../istio/v1alpha2/interface.go | 45 - .../istio/v1alpha2/routerule.go | 89 -- .../istio/v1alpha2/expansion_generated.go | 27 - .../listers/istio/v1alpha2/routerule.go | 94 --- pkg/controller/bind/controller.go | 2 + pkg/controller/bus/controller.go | 3 + pkg/controller/channel/controller.go | 198 ++--- pkg/controller/controller.go | 3 +- pkg/controller/names.go | 12 +- sample/hello/README.md | 8 +- .../build/v1alpha1/build_template_types.go | 2 + .../pkg/apis/build/v1alpha1/build_types.go | 13 +- .../serving/pkg/apis/istio/register.go | 2 +- .../apis/istio/v1alpha2/routerule_types.go | 101 --- .../istio/v1alpha2/zz_generated.deepcopy.go | 217 ----- .../apis/istio/{v1alpha2 => v1alpha3}/doc.go | 4 +- .../pkg/apis/istio/v1alpha3/gateway_types.go | 318 +++++++ .../istio/{v1alpha2 => v1alpha3}/register.go | 11 +- .../istio/v1alpha3/virtualservice_types.go | 783 ++++++++++++++++++ .../istio/v1alpha3/zz_generated.deepcopy.go | 701 ++++++++++++++++ .../serving/v1alpha1/configuration_types.go | 99 ++- .../apis/serving/v1alpha1/revision_types.go | 214 ++++- .../pkg/apis/serving/v1alpha1/route_types.go | 84 +- .../apis/serving/v1alpha1/service_types.go | 115 ++- .../serving/v1alpha1/zz_generated.deepcopy.go | 15 +- .../client/clientset/versioned/clientset.go | 28 +- .../clientset/versioned/scheme/register.go | 4 +- .../typed/istio/v1alpha2/routerule.go | 154 ---- .../typed/istio/{v1alpha2 => v1alpha3}/doc.go | 2 +- .../versioned/typed/istio/v1alpha3/gateway.go | 154 ++++ .../generated_expansion.go | 6 +- .../{v1alpha2 => v1alpha3}/istio_client.go | 41 +- .../typed/istio/v1alpha3/virtualservice.go | 154 ++++ .../informers/externalversions/factory.go | 4 +- .../informers/externalversions/generic.go | 10 +- .../externalversions/istio/interface.go | 14 +- .../routerule.go => v1alpha3/gateway.go} | 44 +- .../istio/{v1alpha2 => v1alpha3}/interface.go | 19 +- .../istio/v1alpha3/virtualservice.go | 86 ++ .../istio/v1alpha2/expansion_generated.go | 24 - .../listers/istio/v1alpha2/routerule.go | 91 -- .../istio/v1alpha3/expansion_generated.go | 32 + .../client/listers/istio/v1alpha3/gateway.go | 91 ++ .../listers/istio/v1alpha3/virtualservice.go | 91 ++ .../monitoring/{ => common}/istio/LICENSE | 0 .../{ => common}/kubernetes/LICENSE | 0 .../{ => common}/prometheus-operator/LICENSE | 0 .../{ => common}/prometheus-operator/NOTICE | 0 .../monitoring/elasticsearch}/LICENSE | 5 +- 73 files changed, 3163 insertions(+), 2031 deletions(-) delete mode 100644 pkg/apis/istio/register.go delete mode 100644 pkg/apis/istio/v1alpha2/doc.go delete mode 100644 pkg/apis/istio/v1alpha2/register.go delete mode 100644 pkg/apis/istio/v1alpha2/routerule.go delete mode 100644 pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go delete mode 100644 pkg/apis/istio/v1alpha2/zz_generated.defaults.go delete mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha2/doc.go delete mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/doc.go delete mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/fake_istio_client.go delete mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/fake_routerule.go delete mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha2/generated_expansion.go delete mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha2/istio_client.go delete mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go delete mode 100644 pkg/client/informers/externalversions/istio/interface.go delete mode 100644 pkg/client/informers/externalversions/istio/v1alpha2/interface.go delete mode 100644 pkg/client/informers/externalversions/istio/v1alpha2/routerule.go delete mode 100644 pkg/client/listers/istio/v1alpha2/expansion_generated.go delete mode 100644 pkg/client/listers/istio/v1alpha2/routerule.go delete mode 100644 vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/routerule_types.go delete mode 100644 vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go rename vendor/github.com/knative/serving/pkg/apis/istio/{v1alpha2 => v1alpha3}/doc.go (93%) create mode 100644 vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/gateway_types.go rename vendor/github.com/knative/serving/pkg/apis/istio/{v1alpha2 => v1alpha3}/register.go (92%) create mode 100644 vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/virtualservice_types.go create mode 100644 vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go delete mode 100644 vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go rename vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/{v1alpha2 => v1alpha3}/doc.go (97%) create mode 100644 vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go rename vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/{v1alpha2 => v1alpha3}/generated_expansion.go (85%) rename vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/{v1alpha2 => v1alpha3}/istio_client.go (57%) create mode 100644 vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go rename vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/{v1alpha2/routerule.go => v1alpha3/gateway.go} (53%) rename vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/{v1alpha2 => v1alpha3}/interface.go (66%) create mode 100644 vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go delete mode 100644 vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/expansion_generated.go delete mode 100644 vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/routerule.go create mode 100644 vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/expansion_generated.go create mode 100644 vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/gateway.go create mode 100644 vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/virtualservice.go rename vendor/github.com/knative/serving/third_party/config/monitoring/{ => common}/istio/LICENSE (100%) rename vendor/github.com/knative/serving/third_party/config/monitoring/{ => common}/kubernetes/LICENSE (100%) rename vendor/github.com/knative/serving/third_party/config/monitoring/{ => common}/prometheus-operator/LICENSE (100%) rename vendor/github.com/knative/serving/third_party/config/monitoring/{ => common}/prometheus-operator/NOTICE (100%) rename vendor/github.com/knative/serving/third_party/{istio-0.6.0 => config/monitoring/elasticsearch}/LICENSE (99%) diff --git a/Gopkg.lock b/Gopkg.lock index 438b4dafc9e..7b8c38c20d2 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -247,29 +247,31 @@ "pkg/apis/build", "pkg/apis/build/v1alpha1" ] - revision = "bfc0222e894da677b45fd63828a89676aa706589" + revision = "8624fda54557ac4461d35921765b7bf48e5aba6d" [[projects]] + branch = "gateway" name = "github.com/knative/serving" packages = [ "pkg/apis/istio", - "pkg/apis/istio/v1alpha2", + "pkg/apis/istio/v1alpha3", "pkg/apis/serving", "pkg/apis/serving/v1alpha1", "pkg/client/clientset/versioned", "pkg/client/clientset/versioned/scheme", - "pkg/client/clientset/versioned/typed/istio/v1alpha2", + "pkg/client/clientset/versioned/typed/istio/v1alpha3", "pkg/client/clientset/versioned/typed/serving/v1alpha1", "pkg/client/informers/externalversions", "pkg/client/informers/externalversions/internalinterfaces", "pkg/client/informers/externalversions/istio", - "pkg/client/informers/externalversions/istio/v1alpha2", + "pkg/client/informers/externalversions/istio/v1alpha3", "pkg/client/informers/externalversions/serving", "pkg/client/informers/externalversions/serving/v1alpha1", - "pkg/client/listers/istio/v1alpha2", + "pkg/client/listers/istio/v1alpha3", "pkg/client/listers/serving/v1alpha1" ] - revision = "a67361c49ec4a957f60d86de05f168a4b41b72ba" + revision = "d7e75ae644274202658d5e2e4aa996ba3e5a8f67" + source = "git@github.com:tcnghia/serving.git" [[projects]] name = "github.com/magiconair/properties" @@ -861,6 +863,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "3cc97f3e7505f0e537f526b3f11472a99f515438f217963fd1d73894dc44f669" + inputs-digest = "48e69066d374d21cfeb0690eb5d6c6ca7aed703a66623e62b1ff12af37cf9745" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 1a594e7e571..da0f555c49e 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -84,5 +84,5 @@ required = [ [[constraint]] name = "github.com/knative/serving" - # HEAD as of 2018-06-01 - revision = "a67361c49ec4a957f60d86de05f168a4b41b72ba" + source = "git@github.com:tcnghia/serving.git" + branch = "gateway" diff --git a/cmd/controller/main.go b/cmd/controller/main.go index d4ba762c0b8..acdf1603307 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -95,7 +95,7 @@ func main() { controllers := make([]controller.Interface, 0, len(ctors)) for _, ctor := range ctors { controllers = append(controllers, - ctor(kubeClient, client, kubeInformerFactory, informerFactory, servingInformerFactory)) + ctor(kubeClient, client, servingClient, kubeInformerFactory, informerFactory, servingInformerFactory)) } go kubeInformerFactory.Start(stopCh) diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index b560c3cf9f2..635c41964c8 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -27,7 +27,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge # instead of the $GOPATH directly. For normal projects this can be dropped. ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \ github.com/knative/eventing/pkg/client github.com/knative/eventing/pkg/apis \ - "channels:v1alpha1 feeds:v1alpha1 istio:v1alpha2" \ + "channels:v1alpha1 feeds:v1alpha1" \ --go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.go.txt # Make sure our dependencies are up-to-date diff --git a/pkg/apis/istio/register.go b/pkg/apis/istio/register.go deleted file mode 100644 index 4d6c0404047..00000000000 --- a/pkg/apis/istio/register.go +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2018 the original author or 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 - -// TODO remove package after knative/serving#1002 - -const ( - GroupName = "config.istio.io" -) diff --git a/pkg/apis/istio/v1alpha2/doc.go b/pkg/apis/istio/v1alpha2/doc.go deleted file mode 100644 index 424f9e1233d..00000000000 --- a/pkg/apis/istio/v1alpha2/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2018 the original author or 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. - */ - -// +k8s:deepcopy-gen=package -// HACK to enable k8s go client for RouteRule resources -// +groupName=config.istio.io -package v1alpha2 diff --git a/pkg/apis/istio/v1alpha2/register.go b/pkg/apis/istio/v1alpha2/register.go deleted file mode 100644 index d65eae0097d..00000000000 --- a/pkg/apis/istio/v1alpha2/register.go +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2018 the original author or 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 v1alpha2 - -import ( - "github.com/knative/eventing/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: "v1alpha2"} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. - SchemeBuilder runtime.SchemeBuilder - localSchemeBuilder = &SchemeBuilder - AddToScheme = localSchemeBuilder.AddToScheme -) - -func init() { - // We only register manually written functions here. The registration of the - // generated functions takes place in the generated files. The separation - // makes the code compile even when the generated files are missing. - localSchemeBuilder.Register(addKnownTypes) -} - -// Adds the list of known types to api.Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &RouteRule{}, - &RouteRuleList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/pkg/apis/istio/v1alpha2/routerule.go b/pkg/apis/istio/v1alpha2/routerule.go deleted file mode 100644 index 3656dd1e42b..00000000000 --- a/pkg/apis/istio/v1alpha2/routerule.go +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2018 the original author or 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 v1alpha2 - -import ( - meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +genclient:noStatus -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:defaulter-gen=true - -// RouteRule HACK -type RouteRule struct { - meta_v1.TypeMeta `json:",inline"` - meta_v1.ObjectMeta `json:"metadata"` - Spec RouteRuleSpec `json:"spec"` - Status *RouteRuleStatus `json:"status,omitempty"` -} - -// RouteRuleSpec HACK -type RouteRuleSpec struct { - Destination IstioService `json:"destination"` - Route []DestinationWeight `json:"route"` - Rewrite HTTPRewrite `json:"rewrite"` -} - -// IstioService HACK -type IstioService struct { - Domain string `json:"domain"` - Name string `json:"name"` - Namespace string `json:"namespace"` -} - -// DestinationWeight HACK -type DestinationWeight struct { - Destination IstioService `json:"destination"` - Weight int32 `json:"weight"` -} - -// HTTPRewrite HACK -type HTTPRewrite struct { - Authority string `json:"authority"` -} - -// RouteRuleStatus HACK -type RouteRuleStatus struct { -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// HACK -type RouteRuleList struct { - meta_v1.TypeMeta `json:",inline"` - meta_v1.ListMeta `json:"metadata"` - Items []RouteRule `json:"items"` -} diff --git a/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go deleted file mode 100644 index c66ed208c91..00000000000 --- a/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go +++ /dev/null @@ -1,182 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 2018 Google, Inc. All rights reserved. - -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 v1alpha2 - -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 *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 *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 *IstioService) DeepCopyInto(out *IstioService) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IstioService. -func (in *IstioService) DeepCopy() *IstioService { - if in == nil { - return nil - } - out := new(IstioService) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteRule) DeepCopyInto(out *RouteRule) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - if *in == nil { - *out = nil - } else { - *out = new(RouteRuleStatus) - **out = **in - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteRule. -func (in *RouteRule) DeepCopy() *RouteRule { - if in == nil { - return nil - } - out := new(RouteRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RouteRule) 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 *RouteRuleList) DeepCopyInto(out *RouteRuleList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]RouteRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteRuleList. -func (in *RouteRuleList) DeepCopy() *RouteRuleList { - if in == nil { - return nil - } - out := new(RouteRuleList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RouteRuleList) 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 *RouteRuleSpec) DeepCopyInto(out *RouteRuleSpec) { - *out = *in - out.Destination = in.Destination - if in.Route != nil { - in, out := &in.Route, &out.Route - *out = make([]DestinationWeight, len(*in)) - copy(*out, *in) - } - out.Rewrite = in.Rewrite - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteRuleSpec. -func (in *RouteRuleSpec) DeepCopy() *RouteRuleSpec { - if in == nil { - return nil - } - out := new(RouteRuleSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteRuleStatus) DeepCopyInto(out *RouteRuleStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteRuleStatus. -func (in *RouteRuleStatus) DeepCopy() *RouteRuleStatus { - if in == nil { - return nil - } - out := new(RouteRuleStatus) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/apis/istio/v1alpha2/zz_generated.defaults.go b/pkg/apis/istio/v1alpha2/zz_generated.defaults.go deleted file mode 100644 index 58996627546..00000000000 --- a/pkg/apis/istio/v1alpha2/zz_generated.defaults.go +++ /dev/null @@ -1,32 +0,0 @@ -// +build !ignore_autogenerated - -/* - * Copyright 2018 the original author or 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. - */ - -// This file was autogenerated by defaulter-gen. Do not edit it manually! - -package v1alpha2 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// RegisterDefaults adds defaulters functions to the given scheme. -// Public to allow building arbitrary schemes. -// All generated defaulters are covering - they call all nested defaulters. -func RegisterDefaults(scheme *runtime.Scheme) error { - return nil -} diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 5bf30f4e848..2bb329f08bb 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -22,7 +22,6 @@ import ( glog "github.com/golang/glog" channelsv1alpha1 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/channels/v1alpha1" feedsv1alpha1 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/feeds/v1alpha1" - configv1alpha2 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/istio/v1alpha2" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -36,9 +35,6 @@ type Interface interface { FeedsV1alpha1() feedsv1alpha1.FeedsV1alpha1Interface // Deprecated: please explicitly pick a version if possible. Feeds() feedsv1alpha1.FeedsV1alpha1Interface - ConfigV1alpha2() configv1alpha2.ConfigV1alpha2Interface - // Deprecated: please explicitly pick a version if possible. - Config() configv1alpha2.ConfigV1alpha2Interface } // Clientset contains the clients for groups. Each group has exactly one @@ -47,7 +43,6 @@ type Clientset struct { *discovery.DiscoveryClient channelsV1alpha1 *channelsv1alpha1.ChannelsV1alpha1Client feedsV1alpha1 *feedsv1alpha1.FeedsV1alpha1Client - configV1alpha2 *configv1alpha2.ConfigV1alpha2Client } // ChannelsV1alpha1 retrieves the ChannelsV1alpha1Client @@ -72,17 +67,6 @@ func (c *Clientset) Feeds() feedsv1alpha1.FeedsV1alpha1Interface { return c.feedsV1alpha1 } -// ConfigV1alpha2 retrieves the ConfigV1alpha2Client -func (c *Clientset) ConfigV1alpha2() configv1alpha2.ConfigV1alpha2Interface { - return c.configV1alpha2 -} - -// Deprecated: Config retrieves the default version of ConfigClient. -// Please explicitly pick a version. -func (c *Clientset) Config() configv1alpha2.ConfigV1alpha2Interface { - return c.configV1alpha2 -} - // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -107,10 +91,6 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } - cs.configV1alpha2, err = configv1alpha2.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -126,7 +106,6 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.channelsV1alpha1 = channelsv1alpha1.NewForConfigOrDie(c) cs.feedsV1alpha1 = feedsv1alpha1.NewForConfigOrDie(c) - cs.configV1alpha2 = configv1alpha2.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -137,7 +116,6 @@ func New(c rest.Interface) *Clientset { var cs Clientset cs.channelsV1alpha1 = channelsv1alpha1.New(c) cs.feedsV1alpha1 = feedsv1alpha1.New(c) - cs.configV1alpha2 = configv1alpha2.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 9fb3afde711..058a67ea1ef 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -24,8 +24,6 @@ import ( fakechannelsv1alpha1 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/channels/v1alpha1/fake" feedsv1alpha1 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/feeds/v1alpha1" fakefeedsv1alpha1 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/feeds/v1alpha1/fake" - configv1alpha2 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/istio/v1alpha2" - fakeconfigv1alpha2 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/istio/v1alpha2/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -93,13 +91,3 @@ func (c *Clientset) FeedsV1alpha1() feedsv1alpha1.FeedsV1alpha1Interface { func (c *Clientset) Feeds() feedsv1alpha1.FeedsV1alpha1Interface { return &fakefeedsv1alpha1.FakeFeedsV1alpha1{Fake: &c.Fake} } - -// ConfigV1alpha2 retrieves the ConfigV1alpha2Client -func (c *Clientset) ConfigV1alpha2() configv1alpha2.ConfigV1alpha2Interface { - return &fakeconfigv1alpha2.FakeConfigV1alpha2{Fake: &c.Fake} -} - -// Config retrieves the ConfigV1alpha2Client -func (c *Clientset) Config() configv1alpha2.ConfigV1alpha2Interface { - return &fakeconfigv1alpha2.FakeConfigV1alpha2{Fake: &c.Fake} -} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 65b8ac72114..362e6da3b0b 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -21,7 +21,6 @@ package fake import ( channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" feedsv1alpha1 "github.com/knative/eventing/pkg/apis/feeds/v1alpha1" - configv1alpha2 "github.com/knative/eventing/pkg/apis/istio/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -54,5 +53,4 @@ func init() { func AddToScheme(scheme *runtime.Scheme) { channelsv1alpha1.AddToScheme(scheme) feedsv1alpha1.AddToScheme(scheme) - configv1alpha2.AddToScheme(scheme) } diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index b3a31a8cfc2..4fa4736083c 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -21,7 +21,6 @@ package scheme import ( channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" feedsv1alpha1 "github.com/knative/eventing/pkg/apis/feeds/v1alpha1" - configv1alpha2 "github.com/knative/eventing/pkg/apis/istio/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -54,5 +53,4 @@ func init() { func AddToScheme(scheme *runtime.Scheme) { channelsv1alpha1.AddToScheme(scheme) feedsv1alpha1.AddToScheme(scheme) - configv1alpha2.AddToScheme(scheme) } diff --git a/pkg/client/clientset/versioned/typed/istio/v1alpha2/doc.go b/pkg/client/clientset/versioned/typed/istio/v1alpha2/doc.go deleted file mode 100644 index e38ac2cb44e..00000000000 --- a/pkg/client/clientset/versioned/typed/istio/v1alpha2/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -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 v1alpha2 diff --git a/pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/doc.go b/pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/doc.go deleted file mode 100644 index 2195046d473..00000000000 --- a/pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/fake_istio_client.go b/pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/fake_istio_client.go deleted file mode 100644 index e6d53ea0f87..00000000000 --- a/pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/fake_istio_client.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1alpha2 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/istio/v1alpha2" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeConfigV1alpha2 struct { - *testing.Fake -} - -func (c *FakeConfigV1alpha2) RouteRules(namespace string) v1alpha2.RouteRuleInterface { - return &FakeRouteRules{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeConfigV1alpha2) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/fake_routerule.go b/pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/fake_routerule.go deleted file mode 100644 index 2d3e2179751..00000000000 --- a/pkg/client/clientset/versioned/typed/istio/v1alpha2/fake/fake_routerule.go +++ /dev/null @@ -1,128 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1alpha2 "github.com/knative/eventing/pkg/apis/istio/v1alpha2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeRouteRules implements RouteRuleInterface -type FakeRouteRules struct { - Fake *FakeConfigV1alpha2 - ns string -} - -var routerulesResource = schema.GroupVersionResource{Group: "config.istio.io", Version: "v1alpha2", Resource: "routerules"} - -var routerulesKind = schema.GroupVersionKind{Group: "config.istio.io", Version: "v1alpha2", Kind: "RouteRule"} - -// Get takes name of the routeRule, and returns the corresponding routeRule object, and an error if there is any. -func (c *FakeRouteRules) Get(name string, options v1.GetOptions) (result *v1alpha2.RouteRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(routerulesResource, c.ns, name), &v1alpha2.RouteRule{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.RouteRule), err -} - -// List takes label and field selectors, and returns the list of RouteRules that match those selectors. -func (c *FakeRouteRules) List(opts v1.ListOptions) (result *v1alpha2.RouteRuleList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(routerulesResource, routerulesKind, c.ns, opts), &v1alpha2.RouteRuleList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha2.RouteRuleList{} - for _, item := range obj.(*v1alpha2.RouteRuleList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested routeRules. -func (c *FakeRouteRules) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(routerulesResource, c.ns, opts)) - -} - -// Create takes the representation of a routeRule and creates it. Returns the server's representation of the routeRule, and an error, if there is any. -func (c *FakeRouteRules) Create(routeRule *v1alpha2.RouteRule) (result *v1alpha2.RouteRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(routerulesResource, c.ns, routeRule), &v1alpha2.RouteRule{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.RouteRule), err -} - -// Update takes the representation of a routeRule and updates it. Returns the server's representation of the routeRule, and an error, if there is any. -func (c *FakeRouteRules) Update(routeRule *v1alpha2.RouteRule) (result *v1alpha2.RouteRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(routerulesResource, c.ns, routeRule), &v1alpha2.RouteRule{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.RouteRule), err -} - -// Delete takes name of the routeRule and deletes it. Returns an error if one occurs. -func (c *FakeRouteRules) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(routerulesResource, c.ns, name), &v1alpha2.RouteRule{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeRouteRules) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(routerulesResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha2.RouteRuleList{}) - return err -} - -// Patch applies the patch and returns the patched routeRule. -func (c *FakeRouteRules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.RouteRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(routerulesResource, c.ns, name, data, subresources...), &v1alpha2.RouteRule{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.RouteRule), err -} diff --git a/pkg/client/clientset/versioned/typed/istio/v1alpha2/generated_expansion.go b/pkg/client/clientset/versioned/typed/istio/v1alpha2/generated_expansion.go deleted file mode 100644 index 28db7e76e70..00000000000 --- a/pkg/client/clientset/versioned/typed/istio/v1alpha2/generated_expansion.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -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 v1alpha2 - -type RouteRuleExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/istio/v1alpha2/istio_client.go b/pkg/client/clientset/versioned/typed/istio/v1alpha2/istio_client.go deleted file mode 100644 index a0e84b27121..00000000000 --- a/pkg/client/clientset/versioned/typed/istio/v1alpha2/istio_client.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -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 v1alpha2 - -import ( - v1alpha2 "github.com/knative/eventing/pkg/apis/istio/v1alpha2" - "github.com/knative/eventing/pkg/client/clientset/versioned/scheme" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - rest "k8s.io/client-go/rest" -) - -type ConfigV1alpha2Interface interface { - RESTClient() rest.Interface - RouteRulesGetter -} - -// ConfigV1alpha2Client is used to interact with features provided by the config.istio.io group. -type ConfigV1alpha2Client struct { - restClient rest.Interface -} - -func (c *ConfigV1alpha2Client) RouteRules(namespace string) RouteRuleInterface { - return newRouteRules(c, namespace) -} - -// NewForConfig creates a new ConfigV1alpha2Client for the given config. -func NewForConfig(c *rest.Config) (*ConfigV1alpha2Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &ConfigV1alpha2Client{client}, nil -} - -// NewForConfigOrDie creates a new ConfigV1alpha2Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *ConfigV1alpha2Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new ConfigV1alpha2Client for the given RESTClient. -func New(c rest.Interface) *ConfigV1alpha2Client { - return &ConfigV1alpha2Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha2.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 *ConfigV1alpha2Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go b/pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go deleted file mode 100644 index d6fbcc0da2e..00000000000 --- a/pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go +++ /dev/null @@ -1,157 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -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 v1alpha2 - -import ( - v1alpha2 "github.com/knative/eventing/pkg/apis/istio/v1alpha2" - scheme "github.com/knative/eventing/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" -) - -// RouteRulesGetter has a method to return a RouteRuleInterface. -// A group's client should implement this interface. -type RouteRulesGetter interface { - RouteRules(namespace string) RouteRuleInterface -} - -// RouteRuleInterface has methods to work with RouteRule resources. -type RouteRuleInterface interface { - Create(*v1alpha2.RouteRule) (*v1alpha2.RouteRule, error) - Update(*v1alpha2.RouteRule) (*v1alpha2.RouteRule, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha2.RouteRule, error) - List(opts v1.ListOptions) (*v1alpha2.RouteRuleList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.RouteRule, err error) - RouteRuleExpansion -} - -// routeRules implements RouteRuleInterface -type routeRules struct { - client rest.Interface - ns string -} - -// newRouteRules returns a RouteRules -func newRouteRules(c *ConfigV1alpha2Client, namespace string) *routeRules { - return &routeRules{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the routeRule, and returns the corresponding routeRule object, and an error if there is any. -func (c *routeRules) Get(name string, options v1.GetOptions) (result *v1alpha2.RouteRule, err error) { - result = &v1alpha2.RouteRule{} - err = c.client.Get(). - Namespace(c.ns). - Resource("routerules"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of RouteRules that match those selectors. -func (c *routeRules) List(opts v1.ListOptions) (result *v1alpha2.RouteRuleList, err error) { - result = &v1alpha2.RouteRuleList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("routerules"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested routeRules. -func (c *routeRules) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("routerules"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a routeRule and creates it. Returns the server's representation of the routeRule, and an error, if there is any. -func (c *routeRules) Create(routeRule *v1alpha2.RouteRule) (result *v1alpha2.RouteRule, err error) { - result = &v1alpha2.RouteRule{} - err = c.client.Post(). - Namespace(c.ns). - Resource("routerules"). - Body(routeRule). - Do(). - Into(result) - return -} - -// Update takes the representation of a routeRule and updates it. Returns the server's representation of the routeRule, and an error, if there is any. -func (c *routeRules) Update(routeRule *v1alpha2.RouteRule) (result *v1alpha2.RouteRule, err error) { - result = &v1alpha2.RouteRule{} - err = c.client.Put(). - Namespace(c.ns). - Resource("routerules"). - Name(routeRule.Name). - Body(routeRule). - Do(). - Into(result) - return -} - -// Delete takes name of the routeRule and deletes it. Returns an error if one occurs. -func (c *routeRules) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("routerules"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *routeRules) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("routerules"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched routeRule. -func (c *routeRules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.RouteRule, err error) { - result = &v1alpha2.RouteRule{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("routerules"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index ead8d02e798..f13b067e1c3 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -27,7 +27,6 @@ import ( channels "github.com/knative/eventing/pkg/client/informers/externalversions/channels" feeds "github.com/knative/eventing/pkg/client/informers/externalversions/feeds" internalinterfaces "github.com/knative/eventing/pkg/client/informers/externalversions/internalinterfaces" - istio "github.com/knative/eventing/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" @@ -127,7 +126,6 @@ type SharedInformerFactory interface { Channels() channels.Interface Feeds() feeds.Interface - Config() istio.Interface } func (f *sharedInformerFactory) Channels() channels.Interface { @@ -137,7 +135,3 @@ func (f *sharedInformerFactory) Channels() channels.Interface { func (f *sharedInformerFactory) Feeds() feeds.Interface { return feeds.New(f, f.namespace, f.tweakListOptions) } - -func (f *sharedInformerFactory) Config() istio.Interface { - return istio.New(f, f.namespace, f.tweakListOptions) -} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 5a7cbb84ed2..a39ce5f1d21 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -23,7 +23,6 @@ import ( v1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" feeds_v1alpha1 "github.com/knative/eventing/pkg/apis/feeds/v1alpha1" - v1alpha2 "github.com/knative/eventing/pkg/apis/istio/v1alpha2" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -62,10 +61,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1alpha1.SchemeGroupVersion.WithResource("subscriptions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Channels().V1alpha1().Subscriptions().Informer()}, nil - // Group=config.istio.io, Version=v1alpha2 - case v1alpha2.SchemeGroupVersion.WithResource("routerules"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1alpha2().RouteRules().Informer()}, nil - // Group=feeds.knative.dev, Version=v1alpha1 case feeds_v1alpha1.SchemeGroupVersion.WithResource("binds"): return &genericInformer{resource: resource.GroupResource(), informer: f.Feeds().V1alpha1().Binds().Informer()}, nil diff --git a/pkg/client/informers/externalversions/istio/interface.go b/pkg/client/informers/externalversions/istio/interface.go deleted file mode 100644 index b781c35e8a6..00000000000 --- a/pkg/client/informers/externalversions/istio/interface.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -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 config - -import ( - internalinterfaces "github.com/knative/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "github.com/knative/eventing/pkg/client/informers/externalversions/istio/v1alpha2" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha2 provides access to shared informers for resources in V1alpha2. - V1alpha2() v1alpha2.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} -} - -// V1alpha2 returns a new v1alpha2.Interface. -func (g *group) V1alpha2() v1alpha2.Interface { - return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/pkg/client/informers/externalversions/istio/v1alpha2/interface.go b/pkg/client/informers/externalversions/istio/v1alpha2/interface.go deleted file mode 100644 index c9df313ae30..00000000000 --- a/pkg/client/informers/externalversions/istio/v1alpha2/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -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 v1alpha2 - -import ( - internalinterfaces "github.com/knative/eventing/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // RouteRules returns a RouteRuleInformer. - RouteRules() RouteRuleInformer -} - -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} -} - -// RouteRules returns a RouteRuleInformer. -func (v *version) RouteRules() RouteRuleInformer { - return &routeRuleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/client/informers/externalversions/istio/v1alpha2/routerule.go b/pkg/client/informers/externalversions/istio/v1alpha2/routerule.go deleted file mode 100644 index 3c76a1930c3..00000000000 --- a/pkg/client/informers/externalversions/istio/v1alpha2/routerule.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -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 v1alpha2 - -import ( - time "time" - - istio_v1alpha2 "github.com/knative/eventing/pkg/apis/istio/v1alpha2" - versioned "github.com/knative/eventing/pkg/client/clientset/versioned" - internalinterfaces "github.com/knative/eventing/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "github.com/knative/eventing/pkg/client/listers/istio/v1alpha2" - 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" -) - -// RouteRuleInformer provides access to a shared informer and lister for -// RouteRules. -type RouteRuleInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha2.RouteRuleLister -} - -type routeRuleInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewRouteRuleInformer constructs a new informer for RouteRule 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 NewRouteRuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRouteRuleInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredRouteRuleInformer constructs a new informer for RouteRule 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 NewFilteredRouteRuleInformer(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.ConfigV1alpha2().RouteRules(namespace).List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ConfigV1alpha2().RouteRules(namespace).Watch(options) - }, - }, - &istio_v1alpha2.RouteRule{}, - resyncPeriod, - indexers, - ) -} - -func (f *routeRuleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRouteRuleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *routeRuleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&istio_v1alpha2.RouteRule{}, f.defaultInformer) -} - -func (f *routeRuleInformer) Lister() v1alpha2.RouteRuleLister { - return v1alpha2.NewRouteRuleLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/istio/v1alpha2/expansion_generated.go b/pkg/client/listers/istio/v1alpha2/expansion_generated.go deleted file mode 100644 index 381e18b6494..00000000000 --- a/pkg/client/listers/istio/v1alpha2/expansion_generated.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -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 v1alpha2 - -// RouteRuleListerExpansion allows custom methods to be added to -// RouteRuleLister. -type RouteRuleListerExpansion interface{} - -// RouteRuleNamespaceListerExpansion allows custom methods to be added to -// RouteRuleNamespaceLister. -type RouteRuleNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/istio/v1alpha2/routerule.go b/pkg/client/listers/istio/v1alpha2/routerule.go deleted file mode 100644 index f146e158be7..00000000000 --- a/pkg/client/listers/istio/v1alpha2/routerule.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2018 Google, Inc. All rights reserved. - -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 v1alpha2 - -import ( - v1alpha2 "github.com/knative/eventing/pkg/apis/istio/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// RouteRuleLister helps list RouteRules. -type RouteRuleLister interface { - // List lists all RouteRules in the indexer. - List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) - // RouteRules returns an object that can list and get RouteRules. - RouteRules(namespace string) RouteRuleNamespaceLister - RouteRuleListerExpansion -} - -// routeRuleLister implements the RouteRuleLister interface. -type routeRuleLister struct { - indexer cache.Indexer -} - -// NewRouteRuleLister returns a new RouteRuleLister. -func NewRouteRuleLister(indexer cache.Indexer) RouteRuleLister { - return &routeRuleLister{indexer: indexer} -} - -// List lists all RouteRules in the indexer. -func (s *routeRuleLister) List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.RouteRule)) - }) - return ret, err -} - -// RouteRules returns an object that can list and get RouteRules. -func (s *routeRuleLister) RouteRules(namespace string) RouteRuleNamespaceLister { - return routeRuleNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// RouteRuleNamespaceLister helps list and get RouteRules. -type RouteRuleNamespaceLister interface { - // List lists all RouteRules in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) - // Get retrieves the RouteRule from the indexer for a given namespace and name. - Get(name string) (*v1alpha2.RouteRule, error) - RouteRuleNamespaceListerExpansion -} - -// routeRuleNamespaceLister implements the RouteRuleNamespaceLister -// interface. -type routeRuleNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all RouteRules in the indexer for a given namespace. -func (s routeRuleNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.RouteRule)) - }) - return ret, err -} - -// Get retrieves the RouteRule from the indexer for a given namespace and name. -func (s routeRuleNamespaceLister) Get(name string) (*v1alpha2.RouteRule, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("routerule"), name) - } - return obj.(*v1alpha2.RouteRule), nil -} diff --git a/pkg/controller/bind/controller.go b/pkg/controller/bind/controller.go index f0e1c84cd85..40cda1266eb 100644 --- a/pkg/controller/bind/controller.go +++ b/pkg/controller/bind/controller.go @@ -40,6 +40,7 @@ import ( "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" + servingclientset "github.com/knative/serving/pkg/client/clientset/versioned" servinginformers "github.com/knative/serving/pkg/client/informers/externalversions" servinglisters "github.com/knative/serving/pkg/client/listers/serving/v1alpha1" @@ -100,6 +101,7 @@ type Controller struct { func NewController( kubeclientset kubernetes.Interface, feedsclientset clientset.Interface, + servingclientset servingclientset.Interface, kubeInformerFactory kubeinformers.SharedInformerFactory, feedsInformerFactory informers.SharedInformerFactory, routeInformerFactory servinginformers.SharedInformerFactory) controller.Interface { diff --git a/pkg/controller/bus/controller.go b/pkg/controller/bus/controller.go index 823d969f1e3..8e3ec0c4540 100644 --- a/pkg/controller/bus/controller.go +++ b/pkg/controller/bus/controller.go @@ -47,6 +47,8 @@ import ( channelscheme "github.com/knative/eventing/pkg/client/clientset/versioned/scheme" informers "github.com/knative/eventing/pkg/client/informers/externalversions" listers "github.com/knative/eventing/pkg/client/listers/channels/v1alpha1" + + servingclientset "github.com/knative/serving/pkg/client/clientset/versioned" elainformers "github.com/knative/serving/pkg/client/informers/externalversions" channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" @@ -102,6 +104,7 @@ type Controller struct { func NewController( kubeclientset kubernetes.Interface, busclientset clientset.Interface, + servingclientset servingclientset.Interface, kubeInformerFactory kubeinformers.SharedInformerFactory, busInformerFactory informers.SharedInformerFactory, routeInformerFactory elainformers.SharedInformerFactory) controller.Interface { diff --git a/pkg/controller/channel/controller.go b/pkg/controller/channel/controller.go index 5156380f6af..e476f6c1b61 100644 --- a/pkg/controller/channel/controller.go +++ b/pkg/controller/channel/controller.go @@ -21,14 +21,12 @@ import ( "time" "github.com/golang/glog" - istiolisters "github.com/knative/eventing/pkg/client/listers/istio/v1alpha2" "github.com/knative/eventing/pkg/controller" + istiolisters "github.com/knative/serving/pkg/client/listers/istio/v1alpha3" corev1 "k8s.io/api/core/v1" - extensionsv1beta1 "k8s.io/api/extensions/v1beta1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" kubeinformers "k8s.io/client-go/informers" @@ -36,7 +34,6 @@ import ( "k8s.io/client-go/kubernetes/scheme" typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" corelisters "k8s.io/client-go/listers/core/v1" - extensionslisters "k8s.io/client-go/listers/extensions/v1beta1" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" @@ -45,10 +42,11 @@ import ( channelscheme "github.com/knative/eventing/pkg/client/clientset/versioned/scheme" informers "github.com/knative/eventing/pkg/client/informers/externalversions" listers "github.com/knative/eventing/pkg/client/listers/channels/v1alpha1" + servingclientset "github.com/knative/serving/pkg/client/clientset/versioned" elainformers "github.com/knative/serving/pkg/client/informers/externalversions" channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" - istiov1alpha2 "github.com/knative/eventing/pkg/apis/istio/v1alpha2" + istiov1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" ) const controllerAgentName = "channel-controller" @@ -68,21 +66,30 @@ const ( MessageResourceSynced = "Channel synced successfully" ) +const ( + PortNumber = 80 + PortName = "http" + IstioSelectorKey = "istio" + IstioIngressGateway = "ingressgateway" +) + // Controller is the controller implementation for Channel resources type Controller struct { // kubeclientset is a standard kubernetes clientset kubeclientset kubernetes.Interface + // knative service clientset + servingclientset servingclientset.Interface // channelclientset is a clientset for our own API group channelclientset clientset.Interface - ingressesLister extensionslisters.IngressLister - ingressesSynced cache.InformerSynced - routerulesLister istiolisters.RouteRuleLister - routerulesSynced cache.InformerSynced - servicesLister corelisters.ServiceLister - servicesSynced cache.InformerSynced - channelsLister listers.ChannelLister - channelsSynced cache.InformerSynced + gatewaysLister istiolisters.GatewayLister + gatewaysSynced cache.InformerSynced + virtualservicesLister istiolisters.VirtualServiceLister + virtualservicesSynced 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 @@ -99,14 +106,15 @@ type Controller struct { func NewController( kubeclientset kubernetes.Interface, channelclientset clientset.Interface, + servingclientset servingclientset.Interface, kubeInformerFactory kubeinformers.SharedInformerFactory, channelInformerFactory informers.SharedInformerFactory, routeInformerFactory elainformers.SharedInformerFactory) controller.Interface { - // obtain references to shared index informers for the Ingress, Service and Channel + // obtain references to shared index informers for the Gateway, Service and Channel // types. - ingressInformer := kubeInformerFactory.Extensions().V1beta1().Ingresses() - routeruleInformer := channelInformerFactory.Config().V1alpha2().RouteRules() + gatewayInformer := routeInformerFactory.Networking().V1alpha3().Gateways() + virtualserviceInformer := routeInformerFactory.Networking().V1alpha3().VirtualServices() serviceInformer := kubeInformerFactory.Core().V1().Services() channelInformer := channelInformerFactory.Channels().V1alpha1().Channels() @@ -121,18 +129,19 @@ func NewController( recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerAgentName}) controller := &Controller{ - kubeclientset: kubeclientset, - channelclientset: channelclientset, - ingressesLister: ingressInformer.Lister(), - ingressesSynced: ingressInformer.Informer().HasSynced, - routerulesLister: routeruleInformer.Lister(), - routerulesSynced: routeruleInformer.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, + servingclientset: servingclientset, + gatewaysLister: gatewayInformer.Lister(), + gatewaysSynced: gatewayInformer.Informer().HasSynced, + 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, } glog.Info("Setting up event handlers") @@ -180,7 +189,7 @@ func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error { // Wait for the caches to be synced before starting workers glog.Info("Waiting for informer caches to sync") - if ok := cache.WaitForCacheSync(stopCh, c.ingressesSynced, c.servicesSynced, c.channelsSynced); !ok { + if ok := cache.WaitForCacheSync(stopCh, c.gatewaysSynced, c.servicesSynced, c.channelsSynced); !ok { return fmt.Errorf("failed to wait for caches to sync") } @@ -288,21 +297,21 @@ func (c *Controller) syncHandler(key string) error { return err } - // Sync RouteRule derived from a Channel - routeRule, err := c.syncChannelRouteRule(channel) + // Sync VirtualService derived from a Channel + virtualService, err := c.syncChannelVirtualService(channel) if err != nil { return err } - // Sync Ingress derived from the Channel - ingress, err := c.syncChannelIngress(channel) + // Sync Gateway derived from the Channel + gateway, err := c.syncChannelGateway(channel) if err != nil { return err } // Finally, we update the status block of the Channel resource to reflect the // current state of the world - err = c.updateChannelStatus(channel, service, ingress, routeRule) + err = c.updateChannelStatus(channel, service, gateway, virtualService) if err != nil { return err } @@ -338,14 +347,14 @@ func (c *Controller) syncChannelService(channel *channelsv1alpha1.Channel) (*cor return service, nil } -func (c *Controller) syncChannelRouteRule(channel *channelsv1alpha1.Channel) (*istiov1alpha2.RouteRule, error) { - // Get the RouteRule with the specified Channel name - routeruleName := controller.ChannelRouteRuleName(channel.ObjectMeta.Name) - routerule, err := c.routerulesLister.RouteRules(channel.Namespace).Get(routeruleName) +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) { - routerule, err = c.channelclientset.ConfigV1alpha2().RouteRules(channel.Namespace).Create(newRouteRule(channel)) + virtualservice, err = c.servingclientset.NetworkingV1alpha3().VirtualServices(channel.Namespace).Create(newVirtualService(channel)) } // If an error occurs during Get/Create, we'll requeue the item so we can @@ -357,24 +366,24 @@ func (c *Controller) syncChannelRouteRule(channel *channelsv1alpha1.Channel) (*i // If the Service is not controlled by this Channel resource, we should log // a warning to the event recorder and return - if !metav1.IsControlledBy(routerule, channel) { - msg := fmt.Sprintf(MessageResourceExists, routerule.Name) + 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 routerule, nil + return virtualservice, nil } -func (c *Controller) syncChannelIngress(channel *channelsv1alpha1.Channel) (*extensionsv1beta1.Ingress, error) { - // TODO make ingress optional +func (c *Controller) syncChannelGateway(channel *channelsv1alpha1.Channel) (*istiov1alpha3.Gateway, error) { + // TODO make gateway optional - // Get the ingress with the specified ingress name - ingressName := controller.ChannelIngressName(channel.ObjectMeta.Name) - ingress, err := c.ingressesLister.Ingresses(channel.Namespace).Get(ingressName) + // Get the gateway with the specified gateway name + gatewayName := controller.ChannelGatewayName(channel.ObjectMeta.Name) + gateway, err := c.gatewaysLister.Gateways(channel.Namespace).Get(gatewayName) // If the resource doesn't exist, we'll create it if errors.IsNotFound(err) { - ingress, err = c.kubeclientset.ExtensionsV1beta1().Ingresses(channel.Namespace).Create(newIngress(channel)) + gateway, err = c.servingclientset.NetworkingV1alpha3().Gateways(channel.Namespace).Create(newGateway(channel)) } // If an error occurs during Get/Create, we'll requeue the item so we can @@ -384,18 +393,18 @@ func (c *Controller) syncChannelIngress(channel *channelsv1alpha1.Channel) (*ext return nil, err } - // If the Ingress is not controlled by this Channel resource, we should log + // If the Gateway is not controlled by this Channel resource, we should log // a warning to the event recorder and return - if !metav1.IsControlledBy(ingress, channel) { - msg := fmt.Sprintf(MessageResourceExists, ingress.Name) + if !metav1.IsControlledBy(gateway, channel) { + msg := fmt.Sprintf(MessageResourceExists, gateway.Name) c.recorder.Event(channel, corev1.EventTypeWarning, ErrResourceExists, msg) return nil, fmt.Errorf(msg) } - return ingress, nil + return gateway, nil } -func (c *Controller) updateChannelStatus(channel *channelsv1alpha1.Channel, service *corev1.Service, ingress *extensionsv1beta1.Ingress, routeRule *istiov1alpha2.RouteRule) error { +func (c *Controller) updateChannelStatus(channel *channelsv1alpha1.Channel, service *corev1.Service, gateway *istiov1alpha3.Gateway, virtualService *istiov1alpha3.VirtualService) 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 @@ -483,23 +492,23 @@ func newService(channel *channelsv1alpha1.Channel) *corev1.Service { }, Spec: corev1.ServiceSpec{ Ports: []corev1.ServicePort{ - {Name: "http", Port: 80}, + {Name: PortName, Port: PortNumber}, }, }, } } -// newRouteRule creates a new RouteRule for a Channel resource. It also sets +// 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 newRouteRule(channel *channelsv1alpha1.Channel) *istiov1alpha2.RouteRule { +func newVirtualService(channel *channelsv1alpha1.Channel) *istiov1alpha3.VirtualService { labels := map[string]string{ "bus": channel.Spec.Bus, "channel": channel.Name, } - return &istiov1alpha2.RouteRule{ + return &istiov1alpha3.VirtualService{ ObjectMeta: metav1.ObjectMeta{ - Name: controller.ChannelRouteRuleName(channel.Name), + Name: controller.ChannelVirtualServiceName(channel.Name), Namespace: channel.Namespace, Labels: labels, OwnerReferences: []metav1.OwnerReference{ @@ -510,41 +519,46 @@ func newRouteRule(channel *channelsv1alpha1.Channel) *istiov1alpha2.RouteRule { }), }, }, - Spec: istiov1alpha2.RouteRuleSpec{ - Destination: istiov1alpha2.IstioService{ - Name: controller.ChannelServiceName(channel.Name), + Spec: istiov1alpha3.VirtualServiceSpec{ + Gateways: []string{ + "mesh", + controller.ChannelGatewayName(channel.Name), + }, + Hosts: []string{ + // TODO make host name configurable + controller.ServiceHostName(controller.ChannelServiceName(channel.Name), channel.Namespace), + controller.ChannelHostName(channel.Name, channel.Namespace), }, - Route: []istiov1alpha2.DestinationWeight{ + Http: []istiov1alpha3.HTTPRoute{ { - Destination: istiov1alpha2.IstioService{ - Name: controller.BusDispatcherServiceName(channel.Spec.Bus), + Rewrite: &istiov1alpha3.HTTPRewrite{ + Authority: controller.ChannelHostName(channel.Name, channel.Namespace), + }, + Route: []istiov1alpha3.DestinationWeight{ + { + Destination: istiov1alpha3.Destination{ + Host: controller.ServiceHostName(controller.BusDispatcherServiceName(channel.Spec.Bus), channel.Namespace), + }, + }, }, - Weight: 100, }, }, - Rewrite: istiov1alpha2.HTTPRewrite{ - Authority: fmt.Sprintf("%s.%s.channels.cluster.local", channel.Name, channel.Namespace), - }, }, } } -// newIngress creates a new Ingress for a Channel resource. It also sets +// newGateway creates a new Gateway for a Channel resource. It also sets // the appropriate OwnerReferences on the resource so handleObject can discover // the Channel resource that 'owns' it. -func newIngress(channel *channelsv1alpha1.Channel) *extensionsv1beta1.Ingress { +func newGateway(channel *channelsv1alpha1.Channel) *istiov1alpha3.Gateway { labels := map[string]string{ "channel": channel.Name, } - annotations := map[string]string{ - "kubernetes.io/ingress.class": "istio", - } - return &extensionsv1beta1.Ingress{ + return &istiov1alpha3.Gateway{ ObjectMeta: metav1.ObjectMeta{ - Name: controller.ChannelIngressName(channel.ObjectMeta.Name), - Namespace: channel.Namespace, - Labels: labels, - Annotations: annotations, + Name: controller.ChannelGatewayName(channel.Name), + Namespace: channel.Namespace, + Labels: labels, OwnerReferences: []metav1.OwnerReference{ *metav1.NewControllerRef(channel, schema.GroupVersionKind{ Group: channelsv1alpha1.SchemeGroupVersion.Group, @@ -553,22 +567,20 @@ func newIngress(channel *channelsv1alpha1.Channel) *extensionsv1beta1.Ingress { }), }, }, - Spec: extensionsv1beta1.IngressSpec{ - Rules: []extensionsv1beta1.IngressRule{ + Spec: istiov1alpha3.GatewaySpec{ + Selector: map[string]string{ + IstioSelectorKey: IstioIngressGateway, + }, + Servers: []istiov1alpha3.Server{ { - // TODO make host name configurable - Host: channel.ObjectMeta.Name, - IngressRuleValue: extensionsv1beta1.IngressRuleValue{ - HTTP: &extensionsv1beta1.HTTPIngressRuleValue{ - Paths: []extensionsv1beta1.HTTPIngressPath{ - { - Backend: extensionsv1beta1.IngressBackend{ - ServiceName: controller.ChannelServiceName(channel.ObjectMeta.Name), - ServicePort: intstr.FromString("http"), - }, - }, - }, - }, + Port: istiov1alpha3.Port{ + Number: PortNumber, + Name: PortName, + Protocol: istiov1alpha3.ProtocolHTTP, + }, + Hosts: []string{ + // TODO make host name configurable + controller.ChannelHostName(channel.Name, channel.Namespace), }, }, }, diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index febd6595601..5c5b69e4d61 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -20,6 +20,7 @@ import ( kubeinformers "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" + servingclientset "github.com/knative/serving/pkg/client/clientset/versioned" servinginformers "github.com/knative/serving/pkg/client/informers/externalversions" clientset "github.com/knative/eventing/pkg/client/clientset/versioned" @@ -30,4 +31,4 @@ type Interface interface { Run(threadiness int, stopCh <-chan struct{}) error } -type Constructor func(kubernetes.Interface, clientset.Interface, kubeinformers.SharedInformerFactory, informers.SharedInformerFactory, servinginformers.SharedInformerFactory) Interface +type Constructor func(kubernetes.Interface, clientset.Interface, servingclientset.Interface, kubeinformers.SharedInformerFactory, informers.SharedInformerFactory, servinginformers.SharedInformerFactory) Interface diff --git a/pkg/controller/names.go b/pkg/controller/names.go index 587d151e13a..b80af862e59 100644 --- a/pkg/controller/names.go +++ b/pkg/controller/names.go @@ -38,14 +38,22 @@ func BusDispatcherServiceName(busName string) string { return fmt.Sprintf("%s-bus", busName) } -func ChannelRouteRuleName(channelName string) string { +func ChannelVirtualServiceName(channelName string) string { return fmt.Sprintf("%s-channel", channelName) } -func ChannelIngressName(channelName string) string { +func ChannelGatewayName(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/sample/hello/README.md b/sample/hello/README.md index 40c8f9d25cc..c7988f13e68 100644 --- a/sample/hello/README.md +++ b/sample/hello/README.md @@ -62,11 +62,11 @@ kail -d stub-bus -c dispatcher To invoke the function via the channel: ``` -# Put the Ingress Host name into an environment variable. -$ export SERVICE_HOST=`kubectl get ingress aloha-channel -o jsonpath="{.spec.rules[0].host}"` +# Put the channel hostname into an environment variable. +$ export SERVICE_HOST=`kubectl get gateway aloha-channel -o jsonpath="{.spec.servers[0].hosts[0]}"` -# Put the Ingress IP into an environment variable. -$ export SERVICE_IP=`kubectl get ingress aloha-channel -o jsonpath="{.status.loadBalancer.ingress[*]['ip']}"` +# Put the Istio IngressGateway IP into an environment variable. +$ export SERVICE_IP=`kubectl get svc -l istio=ingressgateway --all-namespaces -o jsonpath="{.items[0].status.loadBalancer.ingress[0].ip}"` # Curl the Ingress IP "as-if" DNS were properly configured. $ curl -H "Host: $SERVICE_HOST" -H "Content-Type: text/plain" $SERVICE_IP -d "Knative" diff --git a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go index 4fcba3e30b7..64b64421408 100644 --- a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go +++ b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go @@ -49,6 +49,8 @@ type BuildTemplateConditionType string const ( // BuildTemplateInvalid specifies that the given specification is invalid. + // + // TODO(jasonhall): Remove when webhook validation rejects invalid build templates. BuildTemplateInvalid BuildTemplateConditionType = "Invalid" ) diff --git a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go index 988be73c370..52ff1ae7776 100644 --- a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go +++ b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go @@ -147,11 +147,16 @@ type GoogleSpec struct { type BuildConditionType string const ( - // BuildComplete specifies that the build has completed successfully. - BuildComplete BuildConditionType = "Complete" - // BuildFailed specifies that the build has failed. - BuildFailed BuildConditionType = "Failed" + // BuildSucceeded is set when the build is running, and becomes True + // when the build finishes successfully. + // + // If the build is ongoing, its status will be Unknown. If it fails, + // its status will be False. + BuildSucceeded BuildConditionType = "Succeeded" + // BuildInvalid specifies that the given build specification is invalid. + // + // TODO(jasonhall): Remove when webhook validation rejects invalid builds. BuildInvalid BuildConditionType = "Invalid" ) diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/register.go b/vendor/github.com/knative/serving/pkg/apis/istio/register.go index 73deef9d07c..c5accd838e6 100644 --- a/vendor/github.com/knative/serving/pkg/apis/istio/register.go +++ b/vendor/github.com/knative/serving/pkg/apis/istio/register.go @@ -17,5 +17,5 @@ limitations under the License. package istio const ( - GroupName = "config.istio.io" + GroupName = "networking.istio.io" ) diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/routerule_types.go b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/routerule_types.go deleted file mode 100644 index 2a9f339c993..00000000000 --- a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/routerule_types.go +++ /dev/null @@ -1,101 +0,0 @@ -/* -Copyright 2018 Google LLC - -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 v1alpha2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// RouteRule -type RouteRule struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec RouteRuleSpec `json:"spec,omitempty"` -} - -// Istio route looks like so, but couldn't find a k8s/go definition for it -// so we'll just create one. This is terrible, but it just might work for -// now, but if things change on their end, this will most certainly break :( -// spec: -// destination: -// # this matches what's in the ingress rule as a placeholder k8s service -// name: k8s-placeholder-service -// route: -// - destination: -// name: revision-service-1 -// match: -// request: -// headers: -// authority: -// regex: foo.example.com -// weight: 90 -// - destination: -// name: revision-service-2 -// namespace: revision-2-namespace -// weight: 10 -// # https://github.com/istio/istio/blob/master/tests/helm/templates/rule-default-route-append-headers.yaml -// appendHeaders: -// istio-custom-header: user-defined-value -type DestinationWeight struct { - Destination IstioService `json:"destination"` - Weight int `json:"weight"` -} - -type IstioService struct { - Name string `json:"name"` - Namespace string `json:"namespace"` - Domain string `json:"domain"` -} - -type Match struct { - Request MatchRequest `json:"request"` -} - -type MatchRequest struct { - Headers Headers `json:"headers"` -} - -type Headers struct { - Authority MatchString `json:"authority"` -} - -type MatchString struct { - Exact string `json:"exact,omitempty"` - Regex string `json:"regex,omitempty"` - Prefix string `json:"prefix,omitempty"` -} - -type RouteRuleSpec struct { - Destination IstioService `json:"destination"` - Match Match `json:"match,omitempty"` - Route []DestinationWeight `json:"route"` - AppendHeaders map[string]string `json:"appendHeaders"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// RouteRuleList is a list of RouteRule resources -type RouteRuleList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []RouteRule `json:"items"` -} diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go deleted file mode 100644 index ca2779b6f13..00000000000 --- a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go +++ /dev/null @@ -1,217 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 2018 Google LLC - -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. -*/ - -// This file was autogenerated by deepcopy-gen. Do not edit it manually! - -package v1alpha2 - -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 *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 *Headers) DeepCopyInto(out *Headers) { - *out = *in - out.Authority = in.Authority - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Headers. -func (in *Headers) DeepCopy() *Headers { - if in == nil { - return nil - } - out := new(Headers) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IstioService) DeepCopyInto(out *IstioService) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IstioService. -func (in *IstioService) DeepCopy() *IstioService { - if in == nil { - return nil - } - out := new(IstioService) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Match) DeepCopyInto(out *Match) { - *out = *in - out.Request = in.Request - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Match. -func (in *Match) DeepCopy() *Match { - if in == nil { - return nil - } - out := new(Match) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MatchRequest) DeepCopyInto(out *MatchRequest) { - *out = *in - out.Headers = in.Headers - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchRequest. -func (in *MatchRequest) DeepCopy() *MatchRequest { - if in == nil { - return nil - } - out := new(MatchRequest) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MatchString) DeepCopyInto(out *MatchString) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchString. -func (in *MatchString) DeepCopy() *MatchString { - if in == nil { - return nil - } - out := new(MatchString) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteRule) DeepCopyInto(out *RouteRule) { - *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 RouteRule. -func (in *RouteRule) DeepCopy() *RouteRule { - if in == nil { - return nil - } - out := new(RouteRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RouteRule) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } else { - return nil - } -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteRuleList) DeepCopyInto(out *RouteRuleList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]RouteRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteRuleList. -func (in *RouteRuleList) DeepCopy() *RouteRuleList { - if in == nil { - return nil - } - out := new(RouteRuleList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RouteRuleList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } else { - return nil - } -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteRuleSpec) DeepCopyInto(out *RouteRuleSpec) { - *out = *in - out.Destination = in.Destination - out.Match = in.Match - if in.Route != nil { - in, out := &in.Route, &out.Route - *out = make([]DestinationWeight, len(*in)) - copy(*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 - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteRuleSpec. -func (in *RouteRuleSpec) DeepCopy() *RouteRuleSpec { - if in == nil { - return nil - } - out := new(RouteRuleSpec) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/doc.go b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/doc.go similarity index 93% rename from vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/doc.go rename to vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/doc.go index e7284fcf40f..a28b66df79c 100644 --- a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/doc.go +++ b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/doc.go @@ -19,5 +19,5 @@ limitations under the License. // of the same resource // +k8s:deepcopy-gen=package -// +groupName=config.istio.io -package v1alpha2 +// +groupName=networking.istio.io +package v1alpha3 diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/gateway_types.go b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/gateway_types.go new file mode 100644 index 00000000000..31c709ef448 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/gateway_types.go @@ -0,0 +1,318 @@ +/* +Copyright 2018 Google LLC + +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/serving/pkg/apis/istio/v1alpha2/register.go b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/register.go similarity index 92% rename from vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/register.go rename to vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/register.go index b4ee69cfb34..55a105c0f83 100644 --- a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/register.go +++ b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/register.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha3 import ( - "github.com/knative/serving/pkg/apis/istio" - + istio "github.com/knative/serving/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: "v1alpha2"} +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 { @@ -45,8 +44,8 @@ var ( // Adds the list of known types to Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &RouteRule{}, - &RouteRuleList{}, + &VirtualService{}, + &Gateway{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/virtualservice_types.go b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/virtualservice_types.go new file mode 100644 index 00000000000..fd659288607 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/virtualservice_types.go @@ -0,0 +1,783 @@ +/* +Copyright 2018 Google LLC + +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/serving/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go new file mode 100644 index 00000000000..91f5e9418e0 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go @@ -0,0 +1,701 @@ +// +build !ignore_autogenerated + +/* +Copyright 2018 Google LLC + +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. +*/ + +// This file was autogenerated by deepcopy-gen. Do not edit it manually! + +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 + } else { + 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 + } else { + 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 + if *in == nil { + *out = nil + } else { + *out = new(InjectDelay) + **out = **in + } + } + if in.Abort != nil { + in, out := &in.Abort, &out.Abort + if *in == nil { + *out = nil + } else { + *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 + if *in == nil { + *out = nil + } else { + *out = new(StringMatch) + **out = **in + } + } + if in.Scheme != nil { + in, out := &in.Scheme, &out.Scheme + if *in == nil { + *out = nil + } else { + *out = new(StringMatch) + **out = **in + } + } + if in.Method != nil { + in, out := &in.Method, &out.Method + if *in == nil { + *out = nil + } else { + *out = new(StringMatch) + **out = **in + } + } + if in.Authority != nil { + in, out := &in.Authority, &out.Authority + if *in == nil { + *out = nil + } else { + *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 + if *in == nil { + *out = nil + } else { + *out = new(HTTPRedirect) + **out = **in + } + } + if in.Rewrite != nil { + in, out := &in.Rewrite, &out.Rewrite + if *in == nil { + *out = nil + } else { + *out = new(HTTPRewrite) + **out = **in + } + } + if in.Retries != nil { + in, out := &in.Retries, &out.Retries + if *in == nil { + *out = nil + } else { + *out = new(HTTPRetry) + **out = **in + } + } + if in.Fault != nil { + in, out := &in.Fault, &out.Fault + if *in == nil { + *out = nil + } else { + *out = new(HTTPFaultInjection) + (*in).DeepCopyInto(*out) + } + } + if in.Mirror != nil { + in, out := &in.Mirror, &out.Mirror + if *in == nil { + *out = nil + } else { + *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 + if *in == nil { + *out = nil + } else { + *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 + } else { + 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 + } else { + 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/serving/pkg/apis/serving/v1alpha1/configuration_types.go b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/configuration_types.go index 76923be6d29..f8310f0208f 100644 --- a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/configuration_types.go +++ b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/configuration_types.go @@ -18,6 +18,9 @@ package v1alpha1 import ( "encoding/json" + "fmt" + "reflect" + "time" build "github.com/knative/build/pkg/apis/build/v1alpha1" @@ -35,13 +38,16 @@ import ( // "latest ready" revision's name. // See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#configuration type Configuration struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:",inline"` + // +optional metav1.ObjectMeta `json:"metadata,omitempty"` // Spec holds the desired state of the Configuration (from the client). + // +optional Spec ConfigurationSpec `json:"spec,omitempty"` // Status communicates the observed state of the Configuration (from the controller). + // +optional Status ConfigurationStatus `json:"status,omitempty"` } @@ -51,16 +57,19 @@ type ConfigurationSpec struct { // by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778) // So, we add Generation here. Once that gets fixed, remove this and use // ObjectMeta.Generation instead. + // +optional Generation int64 `json:"generation,omitempty"` // Build optionally holds the specification for the build to // perform to produce the Revision's container image. + // +optional Build *build.BuildSpec `json:"build,omitempty"` // RevisionTemplate holds the latest specification for the Revision to // be stamped out. If a Build specification is provided, then the // RevisionTemplate's BuildName field will be populated with the name of // the Build object created to produce the container for the Revision. + // +optional RevisionTemplate RevisionTemplateSpec `json:"revisionTemplate"` } @@ -84,6 +93,9 @@ type ConfigurationCondition struct { Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"` + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"` + // +optional Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"` @@ -96,19 +108,23 @@ type ConfigurationStatus struct { // Conditions communicates information about ongoing/complete // reconciliation processes that bring the "spec" inline with the observed // state of the world. + // +optional Conditions []ConfigurationCondition `json:"conditions,omitempty"` // LatestReadyRevisionName holds the name of the latest Revision stamped out // from this Configuration that has had its "Ready" condition become "True". + // +optional LatestReadyRevisionName string `json:"latestReadyRevisionName,omitempty"` // LatestCreatedRevisionName is the last revision that was created from this // Configuration. It might not be ready yet, for that use LatestReadyRevisionName. + // +optional LatestCreatedRevisionName string `json:"latestCreatedRevisionName,omitempty"` // ObservedGeneration is the 'Generation' of the Configuration that // was last processed by the controller. The observed generation is updated // even if the controller failed to process the spec and create the Revision. + // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` } @@ -136,8 +152,8 @@ func (r *Configuration) GetSpecJSON() ([]byte, error) { // IsReady looks at the conditions on the ConfigurationStatus. // ConfigurationConditionReady returns true if ConditionStatus is True -func (configStatus *ConfigurationStatus) IsReady() bool { - if c := configStatus.GetCondition(ConfigurationConditionReady); c != nil { +func (cs *ConfigurationStatus) IsReady() bool { + if c := cs.GetCondition(ConfigurationConditionReady); c != nil { return c.Status == corev1.ConditionTrue } return false @@ -146,9 +162,9 @@ func (configStatus *ConfigurationStatus) IsReady() bool { // IsLatestReadyRevisionNameUpToDate returns true if the Configuration is ready // and LatestCreateRevisionName is equal to LatestReadyRevisionName. Otherwise // it returns false. -func (configStatus *ConfigurationStatus) IsLatestReadyRevisionNameUpToDate() bool { - return configStatus.IsReady() && - configStatus.LatestCreatedRevisionName == configStatus.LatestReadyRevisionName +func (cs *ConfigurationStatus) IsLatestReadyRevisionNameUpToDate() bool { + return cs.IsReady() && + cs.LatestCreatedRevisionName == cs.LatestReadyRevisionName } func (config *ConfigurationStatus) GetCondition(t ConfigurationConditionType) *ConfigurationCondition { @@ -160,28 +176,87 @@ func (config *ConfigurationStatus) GetCondition(t ConfigurationConditionType) *C return nil } -func (configStatus *ConfigurationStatus) SetCondition(new *ConfigurationCondition) { +func (cs *ConfigurationStatus) setCondition(new *ConfigurationCondition) { if new == nil { return } t := new.Type var conditions []ConfigurationCondition - for _, cond := range configStatus.Conditions { + for _, cond := range cs.Conditions { if cond.Type != t { conditions = append(conditions, cond) + } else { + // If we'd only update the LastTransitionTime, then return. + new.LastTransitionTime = cond.LastTransitionTime + if reflect.DeepEqual(new, &cond) { + return + } } } + new.LastTransitionTime = metav1.NewTime(time.Now()) conditions = append(conditions, *new) - configStatus.Conditions = conditions + cs.Conditions = conditions } -func (configStatus *ConfigurationStatus) RemoveCondition(t ConfigurationConditionType) { +func (cs *ConfigurationStatus) RemoveCondition(t ConfigurationConditionType) { var conditions []ConfigurationCondition - for _, cond := range configStatus.Conditions { + for _, cond := range cs.Conditions { if cond.Type != t { conditions = append(conditions, cond) } } - configStatus.Conditions = conditions + cs.Conditions = conditions +} + +func (cs *ConfigurationStatus) InitializeConditions() { + for _, cond := range []ConfigurationConditionType{ + ConfigurationConditionLatestRevisionReady, + ConfigurationConditionReady, + } { + if rc := cs.GetCondition(cond); rc == nil { + cs.setCondition(&ConfigurationCondition{ + Type: cond, + Status: corev1.ConditionUnknown, + }) + } + } +} + +func (cs *ConfigurationStatus) SetLatestCreatedRevisionName(name string) { + cs.LatestCreatedRevisionName = name + if cs.LatestReadyRevisionName != name { + cs.setCondition(&ConfigurationCondition{ + Type: ConfigurationConditionLatestRevisionReady, + Status: corev1.ConditionUnknown, + }) + } +} + +func (cs *ConfigurationStatus) SetLatestReadyRevisionName(name string) { + cs.LatestReadyRevisionName = name + for _, cond := range []ConfigurationConditionType{ + ConfigurationConditionLatestRevisionReady, + ConfigurationConditionReady, + } { + cs.setCondition(&ConfigurationCondition{ + Type: cond, + Status: corev1.ConditionTrue, + }) + } +} + +func (cs *ConfigurationStatus) MarkLatestCreatedFailed(name, message string) { + cct := []ConfigurationConditionType{ConfigurationConditionLatestRevisionReady} + if cs.LatestReadyRevisionName == "" { + cct = append(cct, ConfigurationConditionReady) + } + for _, cond := range cct { + cs.setCondition(&ConfigurationCondition{ + Type: cond, + Status: corev1.ConditionFalse, + Reason: "RevisionFailed", + Message: fmt.Sprintf("revision %q failed with message: %s", name, message), + }) + } } diff --git a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/revision_types.go b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/revision_types.go index 4b21668ffa4..663f49259f1 100644 --- a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/revision_types.go +++ b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/revision_types.go @@ -18,11 +18,13 @@ package v1alpha1 import ( "encoding/json" + "reflect" "time" corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + buildv1alpha1 "github.com/knative/build/pkg/apis/build/v1alpha1" ) // +genclient @@ -31,21 +33,25 @@ import ( // Revision is an immutable snapshot of code and configuration. // See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#revision type Revision struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:",inline"` + // +optional metav1.ObjectMeta `json:"metadata,omitempty"` // Spec holds the desired state of the Revision (from the client). + // +optional Spec RevisionSpec `json:"spec,omitempty"` // Status communicates the observed state of the Revision (from the controller). + // +optional Status RevisionStatus `json:"status,omitempty"` } // RevisionTemplateSpec describes the data a revision should have when created from a template. // Based on: https://github.com/kubernetes/api/blob/e771f807/core/v1/types.go#L3179-L3190 type RevisionTemplateSpec struct { + // +optional metav1.ObjectMeta `json:"metadata,omitempty"` - + // +optional Spec RevisionSpec `json:"spec,omitempty"` } @@ -89,17 +95,20 @@ type RevisionSpec struct { // by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778) // So, we add Generation here. Once that gets fixed, remove this and use // ObjectMeta.Generation instead. + // +optional Generation int64 `json:"generation,omitempty"` // ServingState holds a value describing the desired state the Kubernetes // resources should be in for this Revision. // Users must not specify this when creating a revision. It is expected // that the system will manipulate this based on routability and load. + // +optional ServingState RevisionServingStateType `json:"servingState,omitempty"` // ConcurrencyModel specifies the desired concurrency model - // (SingleConcurrency or MultiConcurrency) for the - // Revision. Defaults to MultiConcurrency. + // (Single or Multi) for the + // Revision. Defaults to Multi. + // +optional ConcurrencyModel RevisionRequestConcurrencyModelType `json:"concurrencyModel,omitempty"` // ServiceAccountName holds the name of the Kubernetes service account @@ -109,10 +118,12 @@ type RevisionSpec struct { // This may be used to provide access to private container images by // following: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account // TODO(ZhiminXiang): verify the corresponding service account exists. + // +optional ServiceAccountName string `json:"serviceAccountName,omitempty"` // BuildName optionally holds the name of the Build responsible for // producing the container image for its Revision. + // +optional BuildName string `json:"buildName,omitempty"` // Container defines the unit of execution for this Revision. @@ -120,6 +131,7 @@ type RevisionSpec struct { // this Container, including: name, resources, ports, and volumeMounts. // TODO(mattmoor): Link to the runtime contract tracked by: // https://github.com/knative/serving/issues/627 + // +optional Container corev1.Container `json:"container,omitempty"` } @@ -164,20 +176,24 @@ type RevisionStatus struct { // load balances over the pods backing this Revision. When the Revision // is Active, this service would be an appropriate ingress target for // targeting the revision. + // +optional ServiceName string `json:"serviceName,omitempty"` // Conditions communicates information about ongoing/complete // reconciliation processes that bring the "spec" inline with the observed // state of the world. + // +optional Conditions []RevisionCondition `json:"conditions,omitempty"` // ObservedGeneration is the 'Generation' of the Configuration that // was last processed by the controller. The observed generation is updated // even if the controller failed to process the spec and create the Revision. + // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` // LogURL specifies the generated logging url for this particular revision // based on the revision url template specified in the controller's config. + // +optional LogURL string `json:"logUrl,omitempty"` } @@ -212,6 +228,20 @@ func (rs *RevisionStatus) IsReady() bool { return false } +func (rs *RevisionStatus) IsInactive() bool { + cond := rs.GetCondition(RevisionConditionReady) + return (cond.Reason == "Inactive" && cond.Status == corev1.ConditionFalse) || + (cond.Reason == "Activating" && cond.Status == corev1.ConditionUnknown) +} + +func (rs *RevisionStatus) IsActive() bool { + return rs.IsReady() && !rs.IsInactive() +} + +func (rs *RevisionStatus) IsRoutable() bool { + return rs.IsReady() || rs.IsInactive() +} + // IsFailed looks to all non-Ready conditions; if any are false, then // this node is in a terminal failure state. func (rs *RevisionStatus) IsFailed() bool { @@ -232,7 +262,7 @@ func (rs *RevisionStatus) GetCondition(t RevisionConditionType) *RevisionConditi return nil } -func (rs *RevisionStatus) SetCondition(new *RevisionCondition) { +func (rs *RevisionStatus) setCondition(new *RevisionCondition) { if new == nil { return } @@ -242,6 +272,12 @@ func (rs *RevisionStatus) SetCondition(new *RevisionCondition) { for _, cond := range rs.Conditions { if cond.Type != t { conditions = append(conditions, cond) + } else { + // If we'd only update the LastTransitionTime, then return. + new.LastTransitionTime = cond.LastTransitionTime + if reflect.DeepEqual(new, &cond) { + return + } } } new.LastTransitionTime = metav1.NewTime(time.Now()) @@ -258,3 +294,169 @@ func (rs *RevisionStatus) RemoveCondition(t RevisionConditionType) { } rs.Conditions = conditions } + +func (rs *RevisionStatus) InitializeConditions() { + // We don't include BuildSucceeded here because it could confuse users if + // no `buildName` was specified. + for _, cond := range []RevisionConditionType{ + RevisionConditionResourcesAvailable, + RevisionConditionContainerHealthy, + RevisionConditionReady, + } { + if rc := rs.GetCondition(cond); rc == nil { + rs.setCondition(&RevisionCondition{ + Type: cond, + Status: corev1.ConditionUnknown, + }) + } + } +} + +func (rs *RevisionStatus) InitializeBuildCondition() { + if rc := rs.GetCondition(RevisionConditionBuildSucceeded); rc == nil { + rs.setCondition(&RevisionCondition{ + Type: RevisionConditionBuildSucceeded, + Status: corev1.ConditionUnknown, + }) + } +} + +func (rs *RevisionStatus) MarkBuilding() { + for _, cond := range []RevisionConditionType{ + RevisionConditionBuildSucceeded, + RevisionConditionReady, + } { + rs.setCondition(&RevisionCondition{ + Type: cond, + Status: corev1.ConditionUnknown, + Reason: "Building", + }) + } +} + +func (rs *RevisionStatus) MarkBuildSucceeded() { + rs.setCondition(&RevisionCondition{ + Type: RevisionConditionBuildSucceeded, + Status: corev1.ConditionTrue, + }) + // Clear "Reason: Building". There is a risk this could reset a "Ready: False" state, + // but not as things exist today. + rs.setCondition(&RevisionCondition{ + Type: RevisionConditionReady, + Status: corev1.ConditionUnknown, + }) +} + +func (rs *RevisionStatus) MarkBuildFailed(bc *buildv1alpha1.BuildCondition) { + for _, cond := range []RevisionConditionType{ + RevisionConditionBuildSucceeded, + RevisionConditionReady, + } { + rs.setCondition(&RevisionCondition{ + Type: cond, + Status: corev1.ConditionFalse, + Reason: bc.Reason, + Message: bc.Message, + }) + } +} + +func (rs *RevisionStatus) MarkDeploying(reason string) { + for _, cond := range []RevisionConditionType{ + RevisionConditionResourcesAvailable, + RevisionConditionContainerHealthy, + RevisionConditionReady, + } { + rs.setCondition(&RevisionCondition{ + Type: cond, + Status: corev1.ConditionUnknown, + Reason: reason, + }) + } +} + +func (rs *RevisionStatus) MarkServiceTimeout() { + for _, cond := range []RevisionConditionType{ + RevisionConditionResourcesAvailable, + RevisionConditionReady, + } { + rs.setCondition(&RevisionCondition{ + Type: cond, + Status: corev1.ConditionFalse, + Reason: "ServiceTimeout", + Message: "Timed out waiting for a service endpoint to become ready", + }) + } +} + +func (rs *RevisionStatus) MarkProgressDeadlineExceeded(message string) { + for _, cond := range []RevisionConditionType{ + RevisionConditionResourcesAvailable, + RevisionConditionReady, + } { + rs.setCondition(&RevisionCondition{ + Type: cond, + Status: corev1.ConditionFalse, + Reason: "ProgressDeadlineExceeded", + Message: message, + }) + } +} + +func (rs *RevisionStatus) MarkContainerHealthy() { + rs.setCondition(&RevisionCondition{ + Type: RevisionConditionContainerHealthy, + Status: corev1.ConditionTrue, + }) + rs.checkAndMarkReady() +} + +func (rs *RevisionStatus) MarkResourcesAvailable() { + rs.setCondition(&RevisionCondition{ + Type: RevisionConditionResourcesAvailable, + Status: corev1.ConditionTrue, + }) + rs.checkAndMarkReady() +} + +func (rs *RevisionStatus) MarkInactive() { + rs.setCondition(&RevisionCondition{ + Type: RevisionConditionReady, + Status: corev1.ConditionFalse, + Reason: "Inactive", + }) +} + +func (rs *RevisionStatus) MarkContainerMissing(message string) { + for _, cond := range []RevisionConditionType{ + RevisionConditionContainerHealthy, + RevisionConditionReady, + } { + rs.setCondition(&RevisionCondition{ + Type: cond, + Status: corev1.ConditionFalse, + Reason: "ContainerMissing", + Message: message, + }) + } +} + +func (rs *RevisionStatus) checkAndMarkReady() { + for _, cond := range []RevisionConditionType{ + RevisionConditionContainerHealthy, + RevisionConditionResourcesAvailable, + } { + c := rs.GetCondition(cond) + if c == nil || c.Status != corev1.ConditionTrue { + return + } + } + rs.markReady() +} + +func (rs *RevisionStatus) markReady() { + rs.setCondition(&RevisionCondition{ + Type: RevisionConditionReady, + Status: corev1.ConditionTrue, + }) +} diff --git a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/route_types.go b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/route_types.go index ed0dbe899e5..ba02b2d46a1 100644 --- a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/route_types.go +++ b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/route_types.go @@ -18,6 +18,9 @@ package v1alpha1 import ( "encoding/json" + "fmt" + "reflect" + "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -33,13 +36,16 @@ import ( // "latest ready" revision changes, and smoothly rolling out latest revisions. // See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#route type Route struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:",inline"` + // +optional metav1.ObjectMeta `json:"metadata,omitempty"` // Spec holds the desired state of the Route (from the client). + // +optional Spec RouteSpec `json:"spec,omitempty"` // Status communicates the observed state of the Route (from the controller). + // +optional Status RouteStatus `json:"status,omitempty"` } @@ -75,9 +81,11 @@ type RouteSpec struct { // by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778) // So, we add Generation here. Once that gets fixed, remove this and use // ObjectMeta.Generation instead. + // +optional Generation int64 `json:"generation,omitempty"` - // Traffic specifies how to distribute traffic over a collection of Elafros Revisions and Configurations. + // Traffic specifies how to distribute traffic over a collection of Knative Serving Revisions and Configurations. + // +optional Traffic []TrafficTarget `json:"traffic,omitempty"` } @@ -88,6 +96,9 @@ type RouteCondition struct { Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"` + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"` + // +optional Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"` // +optional @@ -102,6 +113,7 @@ const ( // RouteConditionReady is set when the service is configured // and has available backends ready to receive traffic. RouteConditionReady RouteConditionType = "Ready" + // RouteConditionAllTrafficAssigned is set to False when the // service is not configured properly or has no available // backends ready to receive traffic. @@ -112,22 +124,26 @@ const ( type RouteStatus struct { // Domain holds the top-level domain that will distribute traffic over the provided targets. // It generally has the form {route-name}.{route-namespace}.{cluster-level-suffix} + // +optional Domain string `json:"domain,omitempty"` // Traffic holds the configured traffic distribution. // These entries will always contain RevisionName references. // When ConfigurationName appears in the spec, this will hold the // LatestReadyRevisionName that we last observed. + // +optional Traffic []TrafficTarget `json:"traffic,omitempty"` // Conditions communicates information about ongoing/complete // reconciliation processes that bring the "spec" inline with the observed // state of the world. + // +optional Conditions []RouteCondition `json:"conditions,omitempty"` // ObservedGeneration is the 'Generation' of the Configuration that // was last processed by the controller. The observed generation is updated // even if the controller failed to process the spec and create the Revision. + // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` } @@ -169,7 +185,7 @@ func (rs *RouteStatus) GetCondition(t RouteConditionType) *RouteCondition { return nil } -func (rs *RouteStatus) SetCondition(new *RouteCondition) { +func (rs *RouteStatus) setCondition(new *RouteCondition) { if new == nil { return } @@ -179,8 +195,15 @@ func (rs *RouteStatus) SetCondition(new *RouteCondition) { for _, cond := range rs.Conditions { if cond.Type != t { conditions = append(conditions, cond) + } else { + // If we'd only update the LastTransitionTime, then return. + new.LastTransitionTime = cond.LastTransitionTime + if reflect.DeepEqual(new, &cond) { + return + } } } + new.LastTransitionTime = metav1.NewTime(time.Now()) conditions = append(conditions, *new) rs.Conditions = conditions } @@ -194,3 +217,58 @@ func (rs *RouteStatus) RemoveCondition(t RouteConditionType) { } rs.Conditions = conditions } + +func (rs *RouteStatus) InitializeConditions() { + for _, cond := range []RouteConditionType{ + RouteConditionAllTrafficAssigned, + RouteConditionReady, + } { + if rc := rs.GetCondition(cond); rc == nil { + rs.setCondition(&RouteCondition{ + Type: cond, + Status: corev1.ConditionUnknown, + }) + } + } +} + +func (rs *RouteStatus) MarkTrafficAssigned() { + rs.setCondition(&RouteCondition{ + Type: RouteConditionAllTrafficAssigned, + Status: corev1.ConditionTrue, + }) + rs.checkAndMarkReady() +} + +func (rs *RouteStatus) MarkTrafficNotAssigned(kind, name string) { + for _, cond := range []RouteConditionType{ + RouteConditionAllTrafficAssigned, + RouteConditionReady, + } { + rs.setCondition(&RouteCondition{ + Type: cond, + Status: corev1.ConditionFalse, + Reason: kind + "Missing", + Message: fmt.Sprintf("Referenced %s %q not found", kind, name), + }) + } +} + +func (rs *RouteStatus) checkAndMarkReady() { + for _, cond := range []RouteConditionType{ + RouteConditionAllTrafficAssigned, + } { + ata := rs.GetCondition(cond) + if ata == nil || ata.Status != corev1.ConditionTrue { + return + } + } + rs.markReady() +} + +func (rs *RouteStatus) markReady() { + rs.setCondition(&RouteCondition{ + Type: RouteConditionReady, + Status: corev1.ConditionTrue, + }) +} diff --git a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/service_types.go b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/service_types.go index a76fbf1b7bc..9a46ebb3581 100644 --- a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/service_types.go +++ b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/service_types.go @@ -18,6 +18,8 @@ package v1alpha1 import ( "encoding/json" + "reflect" + "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -28,10 +30,12 @@ import ( // Service type Service struct { - metav1.TypeMeta `json:",inline"` + metav1.TypeMeta `json:",inline"` + // +optional metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ServiceSpec `json:"spec,omitempty"` + // +optional + Spec ServiceSpec `json:"spec,omitempty"` + // +optional Status ServiceStatus `json:"status,omitempty"` } @@ -42,6 +46,7 @@ type ServiceSpec struct { // by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778) // So, we add Generation here. Once that gets fixed, remove this and use // ObjectMeta.Generation instead. + // +optional Generation int64 `json:"generation,omitempty"` // RunLatest defines a simple Service. It will automatically @@ -58,15 +63,18 @@ type ServiceSpec struct { type RunLatestType struct { // The configuration for this service. + // +optional Configuration ConfigurationSpec `json:"configuration,omitempty"` } type PinnedType struct { // The revision name to pin this service to until changed // to a different service type. + // +optional RevisionName string `json:"revisionName,omitempty"` // The configuration for this service. + // +optional Configuration ConfigurationSpec `json:"configuration,omitempty"` } @@ -75,6 +83,9 @@ type ServiceCondition struct { Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"` + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"` + // +optional Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"` // +optional @@ -88,13 +99,21 @@ const ( // ServiceConditionReady is set when the service is configured // and has available backends ready to receive traffic. ServiceConditionReady ServiceConditionType = "Ready" + // ServiceConditionRouteReady is set when the service's underlying + // route has reported readiness. + ServiceConditionRouteReady ServiceConditionType = "RouteReady" + // ServiceConditionConfigurationReady is set when the service's underlying + // configuration has reported readiness. + ServiceConditionConfigurationReady ServiceConditionType = "ConfigurationReady" ) type ServiceStatus struct { + // +optional Conditions []ServiceCondition `json:"conditions,omitempty"` // ObservedGeneration is the 'Generation' of the Service that // was last processed by the controller. + // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` } @@ -136,7 +155,7 @@ func (ss *ServiceStatus) GetCondition(t ServiceConditionType) *ServiceCondition return nil } -func (ss *ServiceStatus) SetCondition(new *ServiceCondition) { +func (ss *ServiceStatus) setCondition(new *ServiceCondition) { if new == nil { return } @@ -146,8 +165,15 @@ func (ss *ServiceStatus) SetCondition(new *ServiceCondition) { for _, cond := range ss.Conditions { if cond.Type != t { conditions = append(conditions, cond) + } else { + // If we'd only update the LastTransitionTime, then return. + new.LastTransitionTime = cond.LastTransitionTime + if reflect.DeepEqual(new, &cond) { + return + } } } + new.LastTransitionTime = metav1.NewTime(time.Now()) conditions = append(conditions, *new) ss.Conditions = conditions } @@ -161,3 +187,84 @@ func (ss *ServiceStatus) RemoveCondition(t ServiceConditionType) { } ss.Conditions = conditions } + +func (ss *ServiceStatus) InitializeConditions() { + for _, cond := range []ServiceConditionType{ + ServiceConditionReady, + ServiceConditionConfigurationReady, + ServiceConditionRouteReady, + } { + if rc := ss.GetCondition(cond); rc == nil { + ss.setCondition(&ServiceCondition{ + Type: cond, + Status: corev1.ConditionUnknown, + }) + } + } +} + +func (ss *ServiceStatus) PropagateConfigurationStatus(cs ConfigurationStatus) { + cc := cs.GetCondition(ConfigurationConditionReady) + if cc == nil { + return + } + sct := []ServiceConditionType{ServiceConditionConfigurationReady} + // If the underlying Configuration reported failure, then bubble it up. + if cc.Status == corev1.ConditionFalse { + sct = append(sct, ServiceConditionReady) + } + for _, cond := range sct { + ss.setCondition(&ServiceCondition{ + Type: cond, + Status: cc.Status, + Reason: cc.Reason, + Message: cc.Message, + }) + } + if cc.Status == corev1.ConditionTrue { + ss.checkAndMarkReady() + } +} + +func (ss *ServiceStatus) PropagateRouteStatus(rs RouteStatus) { + rc := rs.GetCondition(RouteConditionReady) + if rc == nil { + return + } + sct := []ServiceConditionType{ServiceConditionRouteReady} + // If the underlying Route reported failure, then bubble it up. + if rc.Status == corev1.ConditionFalse { + sct = append(sct, ServiceConditionReady) + } + for _, cond := range sct { + ss.setCondition(&ServiceCondition{ + Type: cond, + Status: rc.Status, + Reason: rc.Reason, + Message: rc.Message, + }) + } + if rc.Status == corev1.ConditionTrue { + ss.checkAndMarkReady() + } +} + +func (ss *ServiceStatus) checkAndMarkReady() { + for _, cond := range []ServiceConditionType{ + ServiceConditionConfigurationReady, + ServiceConditionRouteReady, + } { + c := ss.GetCondition(cond) + if c == nil || c.Status != corev1.ConditionTrue { + return + } + } + ss.markReady() +} + +func (ss *ServiceStatus) markReady() { + ss.setCondition(&ServiceCondition{ + Type: ServiceConditionReady, + Status: corev1.ConditionTrue, + }) +} diff --git a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go index cb4256eb2b7..a8fbe520b5e 100644 --- a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go @@ -57,6 +57,7 @@ func (in *Configuration) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ConfigurationCondition) DeepCopyInto(out *ConfigurationCondition) { *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } @@ -136,7 +137,9 @@ func (in *ConfigurationStatus) DeepCopyInto(out *ConfigurationStatus) { if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make([]ConfigurationCondition, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } return } @@ -338,6 +341,7 @@ func (in *Route) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RouteCondition) DeepCopyInto(out *RouteCondition) { *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } @@ -417,7 +421,9 @@ func (in *RouteStatus) DeepCopyInto(out *RouteStatus) { if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make([]RouteCondition, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } return } @@ -481,6 +487,7 @@ func (in *Service) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServiceCondition) DeepCopyInto(out *ServiceCondition) { *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } @@ -568,7 +575,9 @@ func (in *ServiceStatus) DeepCopyInto(out *ServiceStatus) { if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make([]ServiceCondition, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } return } diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/clientset.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/clientset.go index 7be974c10af..25d69bc661c 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/clientset.go +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/clientset.go @@ -17,7 +17,7 @@ package versioned import ( glog "github.com/golang/glog" - configv1alpha2 "github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2" + networkingv1alpha3 "github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3" servingv1alpha1 "github.com/knative/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" @@ -26,9 +26,9 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - ConfigV1alpha2() configv1alpha2.ConfigV1alpha2Interface + NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface // Deprecated: please explicitly pick a version if possible. - Config() configv1alpha2.ConfigV1alpha2Interface + Networking() networkingv1alpha3.NetworkingV1alpha3Interface ServingV1alpha1() servingv1alpha1.ServingV1alpha1Interface // Deprecated: please explicitly pick a version if possible. Serving() servingv1alpha1.ServingV1alpha1Interface @@ -38,19 +38,19 @@ type Interface interface { // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - configV1alpha2 *configv1alpha2.ConfigV1alpha2Client - servingV1alpha1 *servingv1alpha1.ServingV1alpha1Client + networkingV1alpha3 *networkingv1alpha3.NetworkingV1alpha3Client + servingV1alpha1 *servingv1alpha1.ServingV1alpha1Client } -// ConfigV1alpha2 retrieves the ConfigV1alpha2Client -func (c *Clientset) ConfigV1alpha2() configv1alpha2.ConfigV1alpha2Interface { - return c.configV1alpha2 +// NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client +func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface { + return c.networkingV1alpha3 } -// Deprecated: Config retrieves the default version of ConfigClient. +// Deprecated: Networking retrieves the default version of NetworkingClient. // Please explicitly pick a version. -func (c *Clientset) Config() configv1alpha2.ConfigV1alpha2Interface { - return c.configV1alpha2 +func (c *Clientset) Networking() networkingv1alpha3.NetworkingV1alpha3Interface { + return c.networkingV1alpha3 } // ServingV1alpha1 retrieves the ServingV1alpha1Client @@ -80,7 +80,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error - cs.configV1alpha2, err = configv1alpha2.NewForConfig(&configShallowCopy) + cs.networkingV1alpha3, err = networkingv1alpha3.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -101,7 +101,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset - cs.configV1alpha2 = configv1alpha2.NewForConfigOrDie(c) + cs.networkingV1alpha3 = networkingv1alpha3.NewForConfigOrDie(c) cs.servingV1alpha1 = servingv1alpha1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) @@ -111,7 +111,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.configV1alpha2 = configv1alpha2.New(c) + cs.networkingV1alpha3 = networkingv1alpha3.New(c) cs.servingV1alpha1 = servingv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/scheme/register.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/scheme/register.go index ac5900b2c3d..fae0f9ae6b5 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/scheme/register.go +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/scheme/register.go @@ -16,7 +16,7 @@ limitations under the License. package scheme import ( - configv1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" + networkingv1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" servingv1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -48,6 +48,6 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { - configv1alpha2.AddToScheme(scheme) + networkingv1alpha3.AddToScheme(scheme) servingv1alpha1.AddToScheme(scheme) } diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go deleted file mode 100644 index 6dda2077811..00000000000 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go +++ /dev/null @@ -1,154 +0,0 @@ -/* -Copyright 2018 Google LLC - -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 v1alpha2 - -import ( - v1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" - scheme "github.com/knative/serving/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" -) - -// RouteRulesGetter has a method to return a RouteRuleInterface. -// A group's client should implement this interface. -type RouteRulesGetter interface { - RouteRules(namespace string) RouteRuleInterface -} - -// RouteRuleInterface has methods to work with RouteRule resources. -type RouteRuleInterface interface { - Create(*v1alpha2.RouteRule) (*v1alpha2.RouteRule, error) - Update(*v1alpha2.RouteRule) (*v1alpha2.RouteRule, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha2.RouteRule, error) - List(opts v1.ListOptions) (*v1alpha2.RouteRuleList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.RouteRule, err error) - RouteRuleExpansion -} - -// routeRules implements RouteRuleInterface -type routeRules struct { - client rest.Interface - ns string -} - -// newRouteRules returns a RouteRules -func newRouteRules(c *ConfigV1alpha2Client, namespace string) *routeRules { - return &routeRules{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the routeRule, and returns the corresponding routeRule object, and an error if there is any. -func (c *routeRules) Get(name string, options v1.GetOptions) (result *v1alpha2.RouteRule, err error) { - result = &v1alpha2.RouteRule{} - err = c.client.Get(). - Namespace(c.ns). - Resource("routerules"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of RouteRules that match those selectors. -func (c *routeRules) List(opts v1.ListOptions) (result *v1alpha2.RouteRuleList, err error) { - result = &v1alpha2.RouteRuleList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("routerules"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested routeRules. -func (c *routeRules) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("routerules"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a routeRule and creates it. Returns the server's representation of the routeRule, and an error, if there is any. -func (c *routeRules) Create(routeRule *v1alpha2.RouteRule) (result *v1alpha2.RouteRule, err error) { - result = &v1alpha2.RouteRule{} - err = c.client.Post(). - Namespace(c.ns). - Resource("routerules"). - Body(routeRule). - Do(). - Into(result) - return -} - -// Update takes the representation of a routeRule and updates it. Returns the server's representation of the routeRule, and an error, if there is any. -func (c *routeRules) Update(routeRule *v1alpha2.RouteRule) (result *v1alpha2.RouteRule, err error) { - result = &v1alpha2.RouteRule{} - err = c.client.Put(). - Namespace(c.ns). - Resource("routerules"). - Name(routeRule.Name). - Body(routeRule). - Do(). - Into(result) - return -} - -// Delete takes name of the routeRule and deletes it. Returns an error if one occurs. -func (c *routeRules) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("routerules"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *routeRules) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("routerules"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched routeRule. -func (c *routeRules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.RouteRule, err error) { - result = &v1alpha2.RouteRule{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("routerules"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/doc.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go similarity index 97% rename from vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/doc.go rename to vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go index bebde544855..e594c0f20b6 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/doc.go +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go @@ -14,4 +14,4 @@ See the License for the specific language governing permissions and limitations under the License. */ // This package has the automatically generated typed clients. -package v1alpha2 +package v1alpha3 diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go new file mode 100644 index 00000000000..e90f626a114 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go @@ -0,0 +1,154 @@ +/* +Copyright 2018 Google LLC + +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 ( + v1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" + scheme "github.com/knative/serving/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/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/generated_expansion.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go similarity index 85% rename from vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/generated_expansion.go rename to vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go index 58b93d91a00..793f5793ac9 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/generated_expansion.go +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go @@ -13,6 +13,8 @@ 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 v1alpha2 +package v1alpha3 -type RouteRuleExpansion interface{} +type GatewayExpansion interface{} + +type VirtualServiceExpansion interface{} diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/istio_client.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go similarity index 57% rename from vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/istio_client.go rename to vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go index effeee68c7a..34111f53c9c 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/istio_client.go +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go @@ -13,31 +13,36 @@ 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 v1alpha2 +package v1alpha3 import ( - v1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" + v1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" "github.com/knative/serving/pkg/client/clientset/versioned/scheme" serializer "k8s.io/apimachinery/pkg/runtime/serializer" rest "k8s.io/client-go/rest" ) -type ConfigV1alpha2Interface interface { +type NetworkingV1alpha3Interface interface { RESTClient() rest.Interface - RouteRulesGetter + GatewaysGetter + VirtualServicesGetter } -// ConfigV1alpha2Client is used to interact with features provided by the config.istio.io group. -type ConfigV1alpha2Client struct { +// NetworkingV1alpha3Client is used to interact with features provided by the networking.istio.io group. +type NetworkingV1alpha3Client struct { restClient rest.Interface } -func (c *ConfigV1alpha2Client) RouteRules(namespace string) RouteRuleInterface { - return newRouteRules(c, namespace) +func (c *NetworkingV1alpha3Client) Gateways(namespace string) GatewayInterface { + return newGateways(c, namespace) } -// NewForConfig creates a new ConfigV1alpha2Client for the given config. -func NewForConfig(c *rest.Config) (*ConfigV1alpha2Client, error) { +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 @@ -46,12 +51,12 @@ func NewForConfig(c *rest.Config) (*ConfigV1alpha2Client, error) { if err != nil { return nil, err } - return &ConfigV1alpha2Client{client}, nil + return &NetworkingV1alpha3Client{client}, nil } -// NewForConfigOrDie creates a new ConfigV1alpha2Client for the given config and +// NewForConfigOrDie creates a new NetworkingV1alpha3Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *ConfigV1alpha2Client { +func NewForConfigOrDie(c *rest.Config) *NetworkingV1alpha3Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -59,13 +64,13 @@ func NewForConfigOrDie(c *rest.Config) *ConfigV1alpha2Client { return client } -// New creates a new ConfigV1alpha2Client for the given RESTClient. -func New(c rest.Interface) *ConfigV1alpha2Client { - return &ConfigV1alpha2Client{c} +// 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 := v1alpha2.SchemeGroupVersion + gv := v1alpha3.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} @@ -79,7 +84,7 @@ func setConfigDefaults(config *rest.Config) error { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *ConfigV1alpha2Client) RESTClient() rest.Interface { +func (c *NetworkingV1alpha3Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go new file mode 100644 index 00000000000..e28488373b1 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go @@ -0,0 +1,154 @@ +/* +Copyright 2018 Google LLC + +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 ( + v1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" + scheme "github.com/knative/serving/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/serving/pkg/client/informers/externalversions/factory.go b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/factory.go index ea4b2ea58a0..df03f3cbe5a 100644 --- a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/factory.go +++ b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/factory.go @@ -121,11 +121,11 @@ type SharedInformerFactory interface { ForResource(resource schema.GroupVersionResource) (GenericInformer, error) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - Config() istio.Interface + Networking() istio.Interface Serving() serving.Interface } -func (f *sharedInformerFactory) Config() istio.Interface { +func (f *sharedInformerFactory) Networking() istio.Interface { return istio.New(f, f.namespace, f.tweakListOptions) } diff --git a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/generic.go b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/generic.go index 9547f925d2e..0f7da296d89 100644 --- a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/generic.go +++ b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/generic.go @@ -18,7 +18,7 @@ package externalversions import ( "fmt" - v1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" + v1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" v1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" @@ -50,9 +50,11 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=config.istio.io, Version=v1alpha2 - case v1alpha2.SchemeGroupVersion.WithResource("routerules"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1alpha2().RouteRules().Informer()}, nil + // 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 // Group=serving.knative.dev, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithResource("configurations"): diff --git a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/interface.go b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/interface.go index 50a8177604f..dcfbac86216 100644 --- a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/interface.go +++ b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/interface.go @@ -13,17 +13,17 @@ 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 config +package networking import ( internalinterfaces "github.com/knative/serving/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2" + v1alpha3 "github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3" ) // Interface provides access to each of this group's versions. type Interface interface { - // V1alpha2 provides access to shared informers for resources in V1alpha2. - V1alpha2() v1alpha2.Interface + // V1alpha3 provides access to shared informers for resources in V1alpha3. + V1alpha3() v1alpha3.Interface } type group struct { @@ -37,7 +37,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1alpha2 returns a new v1alpha2.Interface. -func (g *group) V1alpha2() v1alpha2.Interface { - return v1alpha2.New(g.factory, g.namespace, g.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/serving/pkg/client/informers/externalversions/istio/v1alpha2/routerule.go b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/gateway.go similarity index 53% rename from vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/routerule.go rename to vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/gateway.go index b923794dabc..535d8eae612 100644 --- a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/routerule.go +++ b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/gateway.go @@ -13,74 +13,74 @@ 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 v1alpha2 +package v1alpha3 import ( time "time" - istio_v1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" + istio_v1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" versioned "github.com/knative/serving/pkg/client/clientset/versioned" internalinterfaces "github.com/knative/serving/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "github.com/knative/serving/pkg/client/listers/istio/v1alpha2" + v1alpha3 "github.com/knative/serving/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" ) -// RouteRuleInformer provides access to a shared informer and lister for -// RouteRules. -type RouteRuleInformer interface { +// GatewayInformer provides access to a shared informer and lister for +// Gateways. +type GatewayInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha2.RouteRuleLister + Lister() v1alpha3.GatewayLister } -type routeRuleInformer struct { +type gatewayInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } -// NewRouteRuleInformer constructs a new informer for RouteRule type. +// 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 NewRouteRuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRouteRuleInformer(client, namespace, resyncPeriod, indexers, nil) +func NewGatewayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredGatewayInformer(client, namespace, resyncPeriod, indexers, nil) } -// NewFilteredRouteRuleInformer constructs a new informer for RouteRule type. +// 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 NewFilteredRouteRuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +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.ConfigV1alpha2().RouteRules(namespace).List(options) + return client.NetworkingV1alpha3().Gateways(namespace).List(options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.ConfigV1alpha2().RouteRules(namespace).Watch(options) + return client.NetworkingV1alpha3().Gateways(namespace).Watch(options) }, }, - &istio_v1alpha2.RouteRule{}, + &istio_v1alpha3.Gateway{}, resyncPeriod, indexers, ) } -func (f *routeRuleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRouteRuleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +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 *routeRuleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&istio_v1alpha2.RouteRule{}, f.defaultInformer) +func (f *gatewayInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&istio_v1alpha3.Gateway{}, f.defaultInformer) } -func (f *routeRuleInformer) Lister() v1alpha2.RouteRuleLister { - return v1alpha2.NewRouteRuleLister(f.Informer().GetIndexer()) +func (f *gatewayInformer) Lister() v1alpha3.GatewayLister { + return v1alpha3.NewGatewayLister(f.Informer().GetIndexer()) } diff --git a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/interface.go b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/interface.go similarity index 66% rename from vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/interface.go rename to vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/interface.go index e45718784c2..949e9e52cc8 100644 --- a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/interface.go +++ b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/interface.go @@ -13,7 +13,7 @@ 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 v1alpha2 +package v1alpha3 import ( internalinterfaces "github.com/knative/serving/pkg/client/informers/externalversions/internalinterfaces" @@ -21,8 +21,10 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // RouteRules returns a RouteRuleInformer. - RouteRules() RouteRuleInformer + // Gateways returns a GatewayInformer. + Gateways() GatewayInformer + // VirtualServices returns a VirtualServiceInformer. + VirtualServices() VirtualServiceInformer } type version struct { @@ -36,7 +38,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// RouteRules returns a RouteRuleInformer. -func (v *version) RouteRules() RouteRuleInformer { - return &routeRuleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.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/serving/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go new file mode 100644 index 00000000000..e907a0ccbe2 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go @@ -0,0 +1,86 @@ +/* +Copyright 2018 Google LLC + +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 ( + time "time" + + istio_v1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" + versioned "github.com/knative/serving/pkg/client/clientset/versioned" + internalinterfaces "github.com/knative/serving/pkg/client/informers/externalversions/internalinterfaces" + v1alpha3 "github.com/knative/serving/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) + }, + }, + &istio_v1alpha3.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(&istio_v1alpha3.VirtualService{}, f.defaultInformer) +} + +func (f *virtualServiceInformer) Lister() v1alpha3.VirtualServiceLister { + return v1alpha3.NewVirtualServiceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/expansion_generated.go b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/expansion_generated.go deleted file mode 100644 index 63c0e424cf1..00000000000 --- a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/expansion_generated.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2018 Google LLC - -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 v1alpha2 - -// RouteRuleListerExpansion allows custom methods to be added to -// RouteRuleLister. -type RouteRuleListerExpansion interface{} - -// RouteRuleNamespaceListerExpansion allows custom methods to be added to -// RouteRuleNamespaceLister. -type RouteRuleNamespaceListerExpansion interface{} diff --git a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/routerule.go b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/routerule.go deleted file mode 100644 index 353d6e01e50..00000000000 --- a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/routerule.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 2018 Google LLC - -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 v1alpha2 - -import ( - v1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// RouteRuleLister helps list RouteRules. -type RouteRuleLister interface { - // List lists all RouteRules in the indexer. - List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) - // RouteRules returns an object that can list and get RouteRules. - RouteRules(namespace string) RouteRuleNamespaceLister - RouteRuleListerExpansion -} - -// routeRuleLister implements the RouteRuleLister interface. -type routeRuleLister struct { - indexer cache.Indexer -} - -// NewRouteRuleLister returns a new RouteRuleLister. -func NewRouteRuleLister(indexer cache.Indexer) RouteRuleLister { - return &routeRuleLister{indexer: indexer} -} - -// List lists all RouteRules in the indexer. -func (s *routeRuleLister) List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.RouteRule)) - }) - return ret, err -} - -// RouteRules returns an object that can list and get RouteRules. -func (s *routeRuleLister) RouteRules(namespace string) RouteRuleNamespaceLister { - return routeRuleNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// RouteRuleNamespaceLister helps list and get RouteRules. -type RouteRuleNamespaceLister interface { - // List lists all RouteRules in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) - // Get retrieves the RouteRule from the indexer for a given namespace and name. - Get(name string) (*v1alpha2.RouteRule, error) - RouteRuleNamespaceListerExpansion -} - -// routeRuleNamespaceLister implements the RouteRuleNamespaceLister -// interface. -type routeRuleNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all RouteRules in the indexer for a given namespace. -func (s routeRuleNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.RouteRule)) - }) - return ret, err -} - -// Get retrieves the RouteRule from the indexer for a given namespace and name. -func (s routeRuleNamespaceLister) Get(name string) (*v1alpha2.RouteRule, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("routerule"), name) - } - return obj.(*v1alpha2.RouteRule), nil -} diff --git a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/expansion_generated.go b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/expansion_generated.go new file mode 100644 index 00000000000..56c5e06274d --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/expansion_generated.go @@ -0,0 +1,32 @@ +/* +Copyright 2018 Google LLC + +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 + +// 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/serving/pkg/client/listers/istio/v1alpha3/gateway.go b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/gateway.go new file mode 100644 index 00000000000..42beaee6663 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/gateway.go @@ -0,0 +1,91 @@ +/* +Copyright 2018 Google LLC + +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 ( + v1alpha3 "github.com/knative/serving/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/serving/pkg/client/listers/istio/v1alpha3/virtualservice.go b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/virtualservice.go new file mode 100644 index 00000000000..9c052e01b38 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/virtualservice.go @@ -0,0 +1,91 @@ +/* +Copyright 2018 Google LLC + +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 ( + v1alpha3 "github.com/knative/serving/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 +} diff --git a/vendor/github.com/knative/serving/third_party/config/monitoring/istio/LICENSE b/vendor/github.com/knative/serving/third_party/config/monitoring/common/istio/LICENSE similarity index 100% rename from vendor/github.com/knative/serving/third_party/config/monitoring/istio/LICENSE rename to vendor/github.com/knative/serving/third_party/config/monitoring/common/istio/LICENSE diff --git a/vendor/github.com/knative/serving/third_party/config/monitoring/kubernetes/LICENSE b/vendor/github.com/knative/serving/third_party/config/monitoring/common/kubernetes/LICENSE similarity index 100% rename from vendor/github.com/knative/serving/third_party/config/monitoring/kubernetes/LICENSE rename to vendor/github.com/knative/serving/third_party/config/monitoring/common/kubernetes/LICENSE diff --git a/vendor/github.com/knative/serving/third_party/config/monitoring/prometheus-operator/LICENSE b/vendor/github.com/knative/serving/third_party/config/monitoring/common/prometheus-operator/LICENSE similarity index 100% rename from vendor/github.com/knative/serving/third_party/config/monitoring/prometheus-operator/LICENSE rename to vendor/github.com/knative/serving/third_party/config/monitoring/common/prometheus-operator/LICENSE diff --git a/vendor/github.com/knative/serving/third_party/config/monitoring/prometheus-operator/NOTICE b/vendor/github.com/knative/serving/third_party/config/monitoring/common/prometheus-operator/NOTICE similarity index 100% rename from vendor/github.com/knative/serving/third_party/config/monitoring/prometheus-operator/NOTICE rename to vendor/github.com/knative/serving/third_party/config/monitoring/common/prometheus-operator/NOTICE diff --git a/vendor/github.com/knative/serving/third_party/istio-0.6.0/LICENSE b/vendor/github.com/knative/serving/third_party/config/monitoring/elasticsearch/LICENSE similarity index 99% rename from vendor/github.com/knative/serving/third_party/istio-0.6.0/LICENSE rename to vendor/github.com/knative/serving/third_party/config/monitoring/elasticsearch/LICENSE index 2c45691e883..8dada3edaf5 100644 --- a/vendor/github.com/knative/serving/third_party/istio-0.6.0/LICENSE +++ b/vendor/github.com/knative/serving/third_party/config/monitoring/elasticsearch/LICENSE @@ -1,5 +1,4 @@ - - Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -187,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2016 Istio Authors + Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 29b4cc514b6843cb5fed198f7c2c6c0166f8921c Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Wed, 20 Jun 2018 16:31:19 -0400 Subject: [PATCH 2/3] Drop ingress for channels --- Gopkg.lock | 16 +- Gopkg.toml | 4 +- hack/update-codegen.sh | 2 +- pkg/apis/istio/register.go | 21 ++ .../pkg => pkg}/apis/istio/v1alpha3/doc.go | 0 .../apis/istio/v1alpha3/gateway_types.go | 0 .../apis/istio/v1alpha3/register.go | 2 +- .../istio/v1alpha3/virtualservice_types.go | 0 .../istio/v1alpha3/zz_generated.deepcopy.go | 16 +- pkg/client/clientset/versioned/clientset.go | 26 ++- .../versioned/fake/clientset_generated.go | 12 + .../clientset/versioned/fake/register.go | 2 + .../clientset/versioned/scheme/register.go | 2 + .../versioned/typed/istio/v1alpha3/doc.go | 20 ++ .../typed/istio/v1alpha3/fake/doc.go | 20 ++ .../typed/istio/v1alpha3/fake/fake_gateway.go | 128 +++++++++++ .../istio/v1alpha3/fake/fake_istio_client.go | 44 ++++ .../v1alpha3/fake/fake_virtualservice.go | 128 +++++++++++ .../versioned/typed/istio/v1alpha3/gateway.go | 9 +- .../istio/v1alpha3/generated_expansion.go | 5 +- .../typed/istio/v1alpha3/istio_client.go | 9 +- .../typed/istio/v1alpha3/virtualservice.go | 9 +- .../informers/externalversions/factory.go | 6 + .../informers/externalversions/generic.go | 7 + .../externalversions/istio/interface.go | 46 ++++ .../istio/v1alpha3/gateway.go | 13 +- .../istio/v1alpha3/interface.go | 7 +- .../istio/v1alpha3/virtualservice.go | 13 +- .../istio/v1alpha3/expansion_generated.go | 5 +- .../client/listers/istio/v1alpha3/gateway.go | 7 +- .../listers/istio/v1alpha3/virtualservice.go | 7 +- pkg/controller/bus/controller.go | 4 +- pkg/controller/channel/controller.go | 113 +-------- pkg/controller/names.go | 4 - .../build/v1alpha1/build_template_types.go | 2 - .../pkg/apis/build/v1alpha1/build_types.go | 13 +- .../serving/pkg/apis/istio/register.go | 2 +- .../serving/pkg/apis/istio/v1alpha2/doc.go | 23 ++ .../pkg/apis/istio/v1alpha2/register.go | 53 +++++ .../apis/istio/v1alpha2/routerule_types.go | 101 ++++++++ .../istio/v1alpha2/zz_generated.deepcopy.go | 217 ++++++++++++++++++ .../serving/v1alpha1/configuration_types.go | 99 +------- .../apis/serving/v1alpha1/revision_types.go | 214 +---------------- .../pkg/apis/serving/v1alpha1/route_types.go | 84 +------ .../apis/serving/v1alpha1/service_types.go | 115 +--------- .../serving/v1alpha1/zz_generated.deepcopy.go | 15 +- .../client/clientset/versioned/clientset.go | 28 +-- .../clientset/versioned/scheme/register.go | 4 +- .../typed/istio/{v1alpha3 => v1alpha2}/doc.go | 2 +- .../istio/v1alpha2/generated_expansion.go | 18 ++ .../typed/istio/v1alpha2/istio_client.go | 87 +++++++ .../typed/istio/v1alpha2/routerule.go | 154 +++++++++++++ .../informers/externalversions/factory.go | 4 +- .../informers/externalversions/generic.go | 10 +- .../externalversions/istio/interface.go | 14 +- .../istio/v1alpha2/interface.go | 42 ++++ .../istio/v1alpha2/routerule.go | 86 +++++++ .../istio/v1alpha2/expansion_generated.go | 24 ++ .../listers/istio/v1alpha2/routerule.go | 91 ++++++++ .../monitoring/{common => }/istio/LICENSE | 0 .../{common => }/kubernetes/LICENSE | 0 .../{common => }/prometheus-operator/LICENSE | 0 .../{common => }/prometheus-operator/NOTICE | 0 .../elasticsearch => istio-0.6.0}/LICENSE | 5 +- 64 files changed, 1510 insertions(+), 704 deletions(-) create mode 100644 pkg/apis/istio/register.go rename {vendor/github.com/knative/serving/pkg => pkg}/apis/istio/v1alpha3/doc.go (100%) rename {vendor/github.com/knative/serving/pkg => pkg}/apis/istio/v1alpha3/gateway_types.go (100%) rename {vendor/github.com/knative/serving/pkg => pkg}/apis/istio/v1alpha3/register.go (96%) rename {vendor/github.com/knative/serving/pkg => pkg}/apis/istio/v1alpha3/virtualservice_types.go (100%) rename {vendor/github.com/knative/serving/pkg => pkg}/apis/istio/v1alpha3/zz_generated.deepcopy.go (98%) create mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go create mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/doc.go create mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_gateway.go create mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_istio_client.go create mode 100644 pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_virtualservice.go rename {vendor/github.com/knative/serving/pkg => pkg}/client/clientset/versioned/typed/istio/v1alpha3/gateway.go (95%) rename {vendor/github.com/knative/serving/pkg => pkg}/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go (86%) rename {vendor/github.com/knative/serving/pkg => pkg}/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go (91%) rename {vendor/github.com/knative/serving/pkg => pkg}/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go (95%) create mode 100644 pkg/client/informers/externalversions/istio/interface.go rename {vendor/github.com/knative/serving/pkg => pkg}/client/informers/externalversions/istio/v1alpha3/gateway.go (88%) rename {vendor/github.com/knative/serving/pkg => pkg}/client/informers/externalversions/istio/v1alpha3/interface.go (89%) rename {vendor/github.com/knative/serving/pkg => pkg}/client/informers/externalversions/istio/v1alpha3/virtualservice.go (88%) rename {vendor/github.com/knative/serving/pkg => pkg}/client/listers/istio/v1alpha3/expansion_generated.go (92%) rename {vendor/github.com/knative/serving/pkg => pkg}/client/listers/istio/v1alpha3/gateway.go (94%) rename {vendor/github.com/knative/serving/pkg => pkg}/client/listers/istio/v1alpha3/virtualservice.go (95%) create mode 100644 vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/doc.go create mode 100644 vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/register.go create mode 100644 vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/routerule_types.go create mode 100644 vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go rename vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/{v1alpha3 => v1alpha2}/doc.go (97%) create mode 100644 vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/generated_expansion.go create mode 100644 vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/istio_client.go create mode 100644 vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go create mode 100644 vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/interface.go create mode 100644 vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/routerule.go create mode 100644 vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/expansion_generated.go create mode 100644 vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/routerule.go rename vendor/github.com/knative/serving/third_party/config/monitoring/{common => }/istio/LICENSE (100%) rename vendor/github.com/knative/serving/third_party/config/monitoring/{common => }/kubernetes/LICENSE (100%) rename vendor/github.com/knative/serving/third_party/config/monitoring/{common => }/prometheus-operator/LICENSE (100%) rename vendor/github.com/knative/serving/third_party/config/monitoring/{common => }/prometheus-operator/NOTICE (100%) rename vendor/github.com/knative/serving/third_party/{config/monitoring/elasticsearch => istio-0.6.0}/LICENSE (99%) diff --git a/Gopkg.lock b/Gopkg.lock index 7b8c38c20d2..6a38a60790b 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -247,31 +247,29 @@ "pkg/apis/build", "pkg/apis/build/v1alpha1" ] - revision = "8624fda54557ac4461d35921765b7bf48e5aba6d" + revision = "bfc0222e894da677b45fd63828a89676aa706589" [[projects]] - branch = "gateway" name = "github.com/knative/serving" packages = [ "pkg/apis/istio", - "pkg/apis/istio/v1alpha3", + "pkg/apis/istio/v1alpha2", "pkg/apis/serving", "pkg/apis/serving/v1alpha1", "pkg/client/clientset/versioned", "pkg/client/clientset/versioned/scheme", - "pkg/client/clientset/versioned/typed/istio/v1alpha3", + "pkg/client/clientset/versioned/typed/istio/v1alpha2", "pkg/client/clientset/versioned/typed/serving/v1alpha1", "pkg/client/informers/externalversions", "pkg/client/informers/externalversions/internalinterfaces", "pkg/client/informers/externalversions/istio", - "pkg/client/informers/externalversions/istio/v1alpha3", + "pkg/client/informers/externalversions/istio/v1alpha2", "pkg/client/informers/externalversions/serving", "pkg/client/informers/externalversions/serving/v1alpha1", - "pkg/client/listers/istio/v1alpha3", + "pkg/client/listers/istio/v1alpha2", "pkg/client/listers/serving/v1alpha1" ] - revision = "d7e75ae644274202658d5e2e4aa996ba3e5a8f67" - source = "git@github.com:tcnghia/serving.git" + revision = "a67361c49ec4a957f60d86de05f168a4b41b72ba" [[projects]] name = "github.com/magiconair/properties" @@ -863,6 +861,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "48e69066d374d21cfeb0690eb5d6c6ca7aed703a66623e62b1ff12af37cf9745" + inputs-digest = "a2faefe914d55104c1cff466274b267f2f32eda137c5f4339d1f29e8026dfbd5" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index da0f555c49e..1a594e7e571 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -84,5 +84,5 @@ required = [ [[constraint]] name = "github.com/knative/serving" - source = "git@github.com:tcnghia/serving.git" - branch = "gateway" + # HEAD as of 2018-06-01 + revision = "a67361c49ec4a957f60d86de05f168a4b41b72ba" diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 635c41964c8..ac4051f8ed9 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -27,7 +27,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge # instead of the $GOPATH directly. For normal projects this can be dropped. ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \ github.com/knative/eventing/pkg/client github.com/knative/eventing/pkg/apis \ - "channels:v1alpha1 feeds:v1alpha1" \ + "channels:v1alpha1 feeds:v1alpha1, istio:v1alpha3" \ --go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.go.txt # Make sure our dependencies are up-to-date diff --git a/pkg/apis/istio/register.go b/pkg/apis/istio/register.go new file mode 100644 index 00000000000..c5accd838e6 --- /dev/null +++ b/pkg/apis/istio/register.go @@ -0,0 +1,21 @@ +/* +Copyright 2018 Google LLC + +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/serving/pkg/apis/istio/v1alpha3/doc.go b/pkg/apis/istio/v1alpha3/doc.go similarity index 100% rename from vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/doc.go rename to pkg/apis/istio/v1alpha3/doc.go diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/gateway_types.go b/pkg/apis/istio/v1alpha3/gateway_types.go similarity index 100% rename from vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/gateway_types.go rename to pkg/apis/istio/v1alpha3/gateway_types.go diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/register.go b/pkg/apis/istio/v1alpha3/register.go similarity index 96% rename from vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/register.go rename to pkg/apis/istio/v1alpha3/register.go index 55a105c0f83..3ffcc209788 100644 --- a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/register.go +++ b/pkg/apis/istio/v1alpha3/register.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha3 import ( - istio "github.com/knative/serving/pkg/apis/istio" + istio "github.com/knative/eventing/pkg/apis/istio" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/virtualservice_types.go b/pkg/apis/istio/v1alpha3/virtualservice_types.go similarity index 100% rename from vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/virtualservice_types.go rename to pkg/apis/istio/v1alpha3/virtualservice_types.go diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go b/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go similarity index 98% rename from vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go rename to pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go index 91f5e9418e0..8fde0cd8007 100644 --- a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go +++ b/pkg/apis/istio/v1alpha3/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2018 Google LLC +Copyright 2018 Google, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package v1alpha3 @@ -117,9 +117,8 @@ func (in *Gateway) DeepCopy() *Gateway { func (in *Gateway) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -151,9 +150,8 @@ func (in *GatewayList) DeepCopy() *GatewayList { func (in *GatewayList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -621,9 +619,8 @@ func (in *VirtualService) DeepCopy() *VirtualService { func (in *VirtualService) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -655,9 +652,8 @@ func (in *VirtualServiceList) DeepCopy() *VirtualServiceList { func (in *VirtualServiceList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 2bb329f08bb..a0c79475406 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -22,6 +22,7 @@ import ( glog "github.com/golang/glog" channelsv1alpha1 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/channels/v1alpha1" feedsv1alpha1 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/feeds/v1alpha1" + networkingv1alpha3 "github.com/knative/eventing/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" @@ -35,14 +36,18 @@ type Interface interface { FeedsV1alpha1() feedsv1alpha1.FeedsV1alpha1Interface // Deprecated: please explicitly pick a version if possible. Feeds() feedsv1alpha1.FeedsV1alpha1Interface + 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 - channelsV1alpha1 *channelsv1alpha1.ChannelsV1alpha1Client - feedsV1alpha1 *feedsv1alpha1.FeedsV1alpha1Client + channelsV1alpha1 *channelsv1alpha1.ChannelsV1alpha1Client + feedsV1alpha1 *feedsv1alpha1.FeedsV1alpha1Client + networkingV1alpha3 *networkingv1alpha3.NetworkingV1alpha3Client } // ChannelsV1alpha1 retrieves the ChannelsV1alpha1Client @@ -67,6 +72,17 @@ func (c *Clientset) Feeds() feedsv1alpha1.FeedsV1alpha1Interface { return c.feedsV1alpha1 } +// 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 { @@ -91,6 +107,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.networkingV1alpha3, err = networkingv1alpha3.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -106,6 +126,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.channelsV1alpha1 = channelsv1alpha1.NewForConfigOrDie(c) cs.feedsV1alpha1 = feedsv1alpha1.NewForConfigOrDie(c) + cs.networkingV1alpha3 = networkingv1alpha3.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -116,6 +137,7 @@ func New(c rest.Interface) *Clientset { var cs Clientset cs.channelsV1alpha1 = channelsv1alpha1.New(c) cs.feedsV1alpha1 = feedsv1alpha1.New(c) + cs.networkingV1alpha3 = networkingv1alpha3.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 058a67ea1ef..6063fb22691 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -24,6 +24,8 @@ import ( fakechannelsv1alpha1 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/channels/v1alpha1/fake" feedsv1alpha1 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/feeds/v1alpha1" fakefeedsv1alpha1 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/feeds/v1alpha1/fake" + networkingv1alpha3 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/istio/v1alpha3" + fakenetworkingv1alpha3 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -91,3 +93,13 @@ func (c *Clientset) FeedsV1alpha1() feedsv1alpha1.FeedsV1alpha1Interface { func (c *Clientset) Feeds() feedsv1alpha1.FeedsV1alpha1Interface { return &fakefeedsv1alpha1.FakeFeedsV1alpha1{Fake: &c.Fake} } + +// NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client +func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface { + return &fakenetworkingv1alpha3.FakeNetworkingV1alpha3{Fake: &c.Fake} +} + +// Networking retrieves the NetworkingV1alpha3Client +func (c *Clientset) Networking() networkingv1alpha3.NetworkingV1alpha3Interface { + return &fakenetworkingv1alpha3.FakeNetworkingV1alpha3{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 362e6da3b0b..0119be1fa56 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -21,6 +21,7 @@ package fake import ( channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" feedsv1alpha1 "github.com/knative/eventing/pkg/apis/feeds/v1alpha1" + networkingv1alpha3 "github.com/knative/eventing/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" @@ -53,4 +54,5 @@ func init() { func AddToScheme(scheme *runtime.Scheme) { channelsv1alpha1.AddToScheme(scheme) feedsv1alpha1.AddToScheme(scheme) + networkingv1alpha3.AddToScheme(scheme) } diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 4fa4736083c..b2217c61d37 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -21,6 +21,7 @@ package scheme import ( channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" feedsv1alpha1 "github.com/knative/eventing/pkg/apis/feeds/v1alpha1" + networkingv1alpha3 "github.com/knative/eventing/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" @@ -53,4 +54,5 @@ func init() { func AddToScheme(scheme *runtime.Scheme) { channelsv1alpha1.AddToScheme(scheme) feedsv1alpha1.AddToScheme(scheme) + networkingv1alpha3.AddToScheme(scheme) } diff --git a/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go b/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go new file mode 100644 index 00000000000..727f5c05683 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 Google, Inc. All rights reserved. + +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/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/doc.go b/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/doc.go new file mode 100644 index 00000000000..2195046d473 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 Google, Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_gateway.go b/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_gateway.go new file mode 100644 index 00000000000..a42634d98a0 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_gateway.go @@ -0,0 +1,128 @@ +/* +Copyright 2018 Google, Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "github.com/knative/eventing/pkg/apis/istio/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeGateways implements GatewayInterface +type FakeGateways struct { + Fake *FakeNetworkingV1alpha3 + ns string +} + +var gatewaysResource = schema.GroupVersionResource{Group: "networking.istio.io", Version: "v1alpha3", Resource: "gateways"} + +var gatewaysKind = schema.GroupVersionKind{Group: "networking.istio.io", Version: "v1alpha3", Kind: "Gateway"} + +// Get takes name of the gateway, and returns the corresponding gateway object, and an error if there is any. +func (c *FakeGateways) Get(name string, options v1.GetOptions) (result *v1alpha3.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(gatewaysResource, c.ns, name), &v1alpha3.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Gateway), err +} + +// List takes label and field selectors, and returns the list of Gateways that match those selectors. +func (c *FakeGateways) List(opts v1.ListOptions) (result *v1alpha3.GatewayList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(gatewaysResource, gatewaysKind, c.ns, opts), &v1alpha3.GatewayList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha3.GatewayList{} + for _, item := range obj.(*v1alpha3.GatewayList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested gateways. +func (c *FakeGateways) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(gatewaysResource, c.ns, opts)) + +} + +// 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 *FakeGateways) Create(gateway *v1alpha3.Gateway) (result *v1alpha3.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(gatewaysResource, c.ns, gateway), &v1alpha3.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Gateway), err +} + +// 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 *FakeGateways) Update(gateway *v1alpha3.Gateway) (result *v1alpha3.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(gatewaysResource, c.ns, gateway), &v1alpha3.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Gateway), err +} + +// Delete takes name of the gateway and deletes it. Returns an error if one occurs. +func (c *FakeGateways) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(gatewaysResource, c.ns, name), &v1alpha3.Gateway{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeGateways) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(gatewaysResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha3.GatewayList{}) + return err +} + +// Patch applies the patch and returns the patched gateway. +func (c *FakeGateways) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(gatewaysResource, c.ns, name, data, subresources...), &v1alpha3.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Gateway), err +} diff --git a/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_istio_client.go b/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_istio_client.go new file mode 100644 index 00000000000..1bff47a1a15 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_istio_client.go @@ -0,0 +1,44 @@ +/* +Copyright 2018 Google, Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "github.com/knative/eventing/pkg/client/clientset/versioned/typed/istio/v1alpha3" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeNetworkingV1alpha3 struct { + *testing.Fake +} + +func (c *FakeNetworkingV1alpha3) Gateways(namespace string) v1alpha3.GatewayInterface { + return &FakeGateways{c, namespace} +} + +func (c *FakeNetworkingV1alpha3) VirtualServices(namespace string) v1alpha3.VirtualServiceInterface { + return &FakeVirtualServices{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeNetworkingV1alpha3) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_virtualservice.go b/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_virtualservice.go new file mode 100644 index 00000000000..dd0130bbcdf --- /dev/null +++ b/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake/fake_virtualservice.go @@ -0,0 +1,128 @@ +/* +Copyright 2018 Google, Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "github.com/knative/eventing/pkg/apis/istio/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeVirtualServices implements VirtualServiceInterface +type FakeVirtualServices struct { + Fake *FakeNetworkingV1alpha3 + ns string +} + +var virtualservicesResource = schema.GroupVersionResource{Group: "networking.istio.io", Version: "v1alpha3", Resource: "virtualservices"} + +var virtualservicesKind = schema.GroupVersionKind{Group: "networking.istio.io", Version: "v1alpha3", Kind: "VirtualService"} + +// Get takes name of the virtualService, and returns the corresponding virtualService object, and an error if there is any. +func (c *FakeVirtualServices) Get(name string, options v1.GetOptions) (result *v1alpha3.VirtualService, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(virtualservicesResource, c.ns, name), &v1alpha3.VirtualService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.VirtualService), err +} + +// List takes label and field selectors, and returns the list of VirtualServices that match those selectors. +func (c *FakeVirtualServices) List(opts v1.ListOptions) (result *v1alpha3.VirtualServiceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(virtualservicesResource, virtualservicesKind, c.ns, opts), &v1alpha3.VirtualServiceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha3.VirtualServiceList{} + for _, item := range obj.(*v1alpha3.VirtualServiceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested virtualServices. +func (c *FakeVirtualServices) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(virtualservicesResource, c.ns, opts)) + +} + +// 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 *FakeVirtualServices) Create(virtualService *v1alpha3.VirtualService) (result *v1alpha3.VirtualService, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(virtualservicesResource, c.ns, virtualService), &v1alpha3.VirtualService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.VirtualService), err +} + +// 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 *FakeVirtualServices) Update(virtualService *v1alpha3.VirtualService) (result *v1alpha3.VirtualService, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(virtualservicesResource, c.ns, virtualService), &v1alpha3.VirtualService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.VirtualService), err +} + +// Delete takes name of the virtualService and deletes it. Returns an error if one occurs. +func (c *FakeVirtualServices) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(virtualservicesResource, c.ns, name), &v1alpha3.VirtualService{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVirtualServices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(virtualservicesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha3.VirtualServiceList{}) + return err +} + +// Patch applies the patch and returns the patched virtualService. +func (c *FakeVirtualServices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.VirtualService, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualservicesResource, c.ns, name, data, subresources...), &v1alpha3.VirtualService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.VirtualService), err +} diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go b/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go similarity index 95% rename from vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go rename to pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go index e90f626a114..a1bbe00c60b 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go +++ b/pkg/client/clientset/versioned/typed/istio/v1alpha3/gateway.go @@ -1,5 +1,5 @@ /* -Copyright 2018 Google LLC +Copyright 2018 Google, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,11 +13,14 @@ 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/serving/pkg/apis/istio/v1alpha3" - scheme "github.com/knative/serving/pkg/client/clientset/versioned/scheme" + v1alpha3 "github.com/knative/eventing/pkg/apis/istio/v1alpha3" + scheme "github.com/knative/eventing/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" diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go b/pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go similarity index 86% rename from vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go rename to pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go index 793f5793ac9..63fe55562a0 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/istio/v1alpha3/generated_expansion.go @@ -1,5 +1,5 @@ /* -Copyright 2018 Google LLC +Copyright 2018 Google, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,6 +13,9 @@ 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{} diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go b/pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go similarity index 91% rename from vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go rename to pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go index 34111f53c9c..7e1b6b03ed9 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go +++ b/pkg/client/clientset/versioned/typed/istio/v1alpha3/istio_client.go @@ -1,5 +1,5 @@ /* -Copyright 2018 Google LLC +Copyright 2018 Google, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,11 +13,14 @@ 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/serving/pkg/apis/istio/v1alpha3" - "github.com/knative/serving/pkg/client/clientset/versioned/scheme" + v1alpha3 "github.com/knative/eventing/pkg/apis/istio/v1alpha3" + "github.com/knative/eventing/pkg/client/clientset/versioned/scheme" serializer "k8s.io/apimachinery/pkg/runtime/serializer" rest "k8s.io/client-go/rest" ) diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go b/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go similarity index 95% rename from vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go rename to pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go index e28488373b1..1cd0fedb676 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go +++ b/pkg/client/clientset/versioned/typed/istio/v1alpha3/virtualservice.go @@ -1,5 +1,5 @@ /* -Copyright 2018 Google LLC +Copyright 2018 Google, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,11 +13,14 @@ 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/serving/pkg/apis/istio/v1alpha3" - scheme "github.com/knative/serving/pkg/client/clientset/versioned/scheme" + v1alpha3 "github.com/knative/eventing/pkg/apis/istio/v1alpha3" + scheme "github.com/knative/eventing/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" diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index f13b067e1c3..ae5e614883d 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -27,6 +27,7 @@ import ( channels "github.com/knative/eventing/pkg/client/informers/externalversions/channels" feeds "github.com/knative/eventing/pkg/client/informers/externalversions/feeds" internalinterfaces "github.com/knative/eventing/pkg/client/informers/externalversions/internalinterfaces" + istio "github.com/knative/eventing/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" @@ -126,6 +127,7 @@ type SharedInformerFactory interface { Channels() channels.Interface Feeds() feeds.Interface + Networking() istio.Interface } func (f *sharedInformerFactory) Channels() channels.Interface { @@ -135,3 +137,7 @@ func (f *sharedInformerFactory) Channels() channels.Interface { func (f *sharedInformerFactory) Feeds() feeds.Interface { return feeds.New(f, f.namespace, f.tweakListOptions) } + +func (f *sharedInformerFactory) Networking() istio.Interface { + return istio.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index a39ce5f1d21..5e0742cbf58 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -23,6 +23,7 @@ import ( v1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" feeds_v1alpha1 "github.com/knative/eventing/pkg/apis/feeds/v1alpha1" + v1alpha3 "github.com/knative/eventing/pkg/apis/istio/v1alpha3" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -69,6 +70,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case feeds_v1alpha1.SchemeGroupVersion.WithResource("eventtypes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Feeds().V1alpha1().EventTypes().Informer()}, nil + // 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/pkg/client/informers/externalversions/istio/interface.go b/pkg/client/informers/externalversions/istio/interface.go new file mode 100644 index 00000000000..094e89c5ee0 --- /dev/null +++ b/pkg/client/informers/externalversions/istio/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 2018 Google, Inc. All rights reserved. + +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/eventing/pkg/client/informers/externalversions/internalinterfaces" + v1alpha3 "github.com/knative/eventing/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/serving/pkg/client/informers/externalversions/istio/v1alpha3/gateway.go b/pkg/client/informers/externalversions/istio/v1alpha3/gateway.go similarity index 88% rename from vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/gateway.go rename to pkg/client/informers/externalversions/istio/v1alpha3/gateway.go index 535d8eae612..edb5c4c40af 100644 --- a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/gateway.go +++ b/pkg/client/informers/externalversions/istio/v1alpha3/gateway.go @@ -1,5 +1,5 @@ /* -Copyright 2018 Google LLC +Copyright 2018 Google, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,15 +13,18 @@ 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" - istio_v1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" - versioned "github.com/knative/serving/pkg/client/clientset/versioned" - internalinterfaces "github.com/knative/serving/pkg/client/informers/externalversions/internalinterfaces" - v1alpha3 "github.com/knative/serving/pkg/client/listers/istio/v1alpha3" + istio_v1alpha3 "github.com/knative/eventing/pkg/apis/istio/v1alpha3" + versioned "github.com/knative/eventing/pkg/client/clientset/versioned" + internalinterfaces "github.com/knative/eventing/pkg/client/informers/externalversions/internalinterfaces" + v1alpha3 "github.com/knative/eventing/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" diff --git a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/interface.go b/pkg/client/informers/externalversions/istio/v1alpha3/interface.go similarity index 89% rename from vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/interface.go rename to pkg/client/informers/externalversions/istio/v1alpha3/interface.go index 949e9e52cc8..68745b2dbb4 100644 --- a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/interface.go +++ b/pkg/client/informers/externalversions/istio/v1alpha3/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2018 Google LLC +Copyright 2018 Google, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,10 +13,13 @@ 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/serving/pkg/client/informers/externalversions/internalinterfaces" + internalinterfaces "github.com/knative/eventing/pkg/client/informers/externalversions/internalinterfaces" ) // Interface provides access to all the informers in this group version. diff --git a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go b/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go similarity index 88% rename from vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go rename to pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go index e907a0ccbe2..be8fd9634d1 100644 --- a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go +++ b/pkg/client/informers/externalversions/istio/v1alpha3/virtualservice.go @@ -1,5 +1,5 @@ /* -Copyright 2018 Google LLC +Copyright 2018 Google, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,15 +13,18 @@ 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" - istio_v1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" - versioned "github.com/knative/serving/pkg/client/clientset/versioned" - internalinterfaces "github.com/knative/serving/pkg/client/informers/externalversions/internalinterfaces" - v1alpha3 "github.com/knative/serving/pkg/client/listers/istio/v1alpha3" + istio_v1alpha3 "github.com/knative/eventing/pkg/apis/istio/v1alpha3" + versioned "github.com/knative/eventing/pkg/client/clientset/versioned" + internalinterfaces "github.com/knative/eventing/pkg/client/informers/externalversions/internalinterfaces" + v1alpha3 "github.com/knative/eventing/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" diff --git a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/expansion_generated.go b/pkg/client/listers/istio/v1alpha3/expansion_generated.go similarity index 92% rename from vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/expansion_generated.go rename to pkg/client/listers/istio/v1alpha3/expansion_generated.go index 56c5e06274d..a0441ca4a07 100644 --- a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/expansion_generated.go +++ b/pkg/client/listers/istio/v1alpha3/expansion_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2018 Google LLC +Copyright 2018 Google, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,6 +13,9 @@ 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 diff --git a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/gateway.go b/pkg/client/listers/istio/v1alpha3/gateway.go similarity index 94% rename from vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/gateway.go rename to pkg/client/listers/istio/v1alpha3/gateway.go index 42beaee6663..9fbb636e2cb 100644 --- a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/gateway.go +++ b/pkg/client/listers/istio/v1alpha3/gateway.go @@ -1,5 +1,5 @@ /* -Copyright 2018 Google LLC +Copyright 2018 Google, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,10 +13,13 @@ 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/serving/pkg/apis/istio/v1alpha3" + v1alpha3 "github.com/knative/eventing/pkg/apis/istio/v1alpha3" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/virtualservice.go b/pkg/client/listers/istio/v1alpha3/virtualservice.go similarity index 95% rename from vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/virtualservice.go rename to pkg/client/listers/istio/v1alpha3/virtualservice.go index 9c052e01b38..7534e03ae60 100644 --- a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha3/virtualservice.go +++ b/pkg/client/listers/istio/v1alpha3/virtualservice.go @@ -1,5 +1,5 @@ /* -Copyright 2018 Google LLC +Copyright 2018 Google, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,10 +13,13 @@ 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/serving/pkg/apis/istio/v1alpha3" + v1alpha3 "github.com/knative/eventing/pkg/apis/istio/v1alpha3" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/pkg/controller/bus/controller.go b/pkg/controller/bus/controller.go index 8e3ec0c4540..a2c6417b3bb 100644 --- a/pkg/controller/bus/controller.go +++ b/pkg/controller/bus/controller.go @@ -49,7 +49,7 @@ import ( listers "github.com/knative/eventing/pkg/client/listers/channels/v1alpha1" servingclientset "github.com/knative/serving/pkg/client/clientset/versioned" - elainformers "github.com/knative/serving/pkg/client/informers/externalversions" + servinginformers "github.com/knative/serving/pkg/client/informers/externalversions" channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" ) @@ -107,7 +107,7 @@ func NewController( servingclientset servingclientset.Interface, kubeInformerFactory kubeinformers.SharedInformerFactory, busInformerFactory informers.SharedInformerFactory, - routeInformerFactory elainformers.SharedInformerFactory) controller.Interface { + routeInformerFactory servinginformers.SharedInformerFactory) controller.Interface { // obtain references to shared index informers for the Bus, Deployment and Service // types. diff --git a/pkg/controller/channel/controller.go b/pkg/controller/channel/controller.go index e476f6c1b61..c637485fbae 100644 --- a/pkg/controller/channel/controller.go +++ b/pkg/controller/channel/controller.go @@ -21,8 +21,8 @@ import ( "time" "github.com/golang/glog" + istiolisters "github.com/knative/eventing/pkg/client/listers/istio/v1alpha3" "github.com/knative/eventing/pkg/controller" - istiolisters "github.com/knative/serving/pkg/client/listers/istio/v1alpha3" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -43,10 +43,10 @@ import ( informers "github.com/knative/eventing/pkg/client/informers/externalversions" listers "github.com/knative/eventing/pkg/client/listers/channels/v1alpha1" servingclientset "github.com/knative/serving/pkg/client/clientset/versioned" - elainformers "github.com/knative/serving/pkg/client/informers/externalversions" + servinginformers "github.com/knative/serving/pkg/client/informers/externalversions" channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" - istiov1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" + istiov1alpha3 "github.com/knative/eventing/pkg/apis/istio/v1alpha3" ) const controllerAgentName = "channel-controller" @@ -67,10 +67,8 @@ const ( ) const ( - PortNumber = 80 - PortName = "http" - IstioSelectorKey = "istio" - IstioIngressGateway = "ingressgateway" + PortNumber = 80 + PortName = "http" ) // Controller is the controller implementation for Channel resources @@ -82,8 +80,6 @@ type Controller struct { // channelclientset is a clientset for our own API group channelclientset clientset.Interface - gatewaysLister istiolisters.GatewayLister - gatewaysSynced cache.InformerSynced virtualservicesLister istiolisters.VirtualServiceLister virtualservicesSynced cache.InformerSynced servicesLister corelisters.ServiceLister @@ -109,12 +105,10 @@ func NewController( servingclientset servingclientset.Interface, kubeInformerFactory kubeinformers.SharedInformerFactory, channelInformerFactory informers.SharedInformerFactory, - routeInformerFactory elainformers.SharedInformerFactory) controller.Interface { + routeInformerFactory servinginformers.SharedInformerFactory) controller.Interface { - // obtain references to shared index informers for the Gateway, Service and Channel - // types. - gatewayInformer := routeInformerFactory.Networking().V1alpha3().Gateways() - virtualserviceInformer := routeInformerFactory.Networking().V1alpha3().VirtualServices() + // obtain references to shared index informers for the Service and Channel types. + virtualserviceInformer := channelInformerFactory.Networking().V1alpha3().VirtualServices() serviceInformer := kubeInformerFactory.Core().V1().Services() channelInformer := channelInformerFactory.Channels().V1alpha1().Channels() @@ -132,8 +126,6 @@ func NewController( kubeclientset: kubeclientset, channelclientset: channelclientset, servingclientset: servingclientset, - gatewaysLister: gatewayInformer.Lister(), - gatewaysSynced: gatewayInformer.Informer().HasSynced, virtualservicesLister: virtualserviceInformer.Lister(), virtualservicesSynced: virtualserviceInformer.Informer().HasSynced, servicesLister: serviceInformer.Lister(), @@ -189,7 +181,7 @@ func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error { // Wait for the caches to be synced before starting workers glog.Info("Waiting for informer caches to sync") - if ok := cache.WaitForCacheSync(stopCh, c.gatewaysSynced, c.servicesSynced, c.channelsSynced); !ok { + if ok := cache.WaitForCacheSync(stopCh, c.servicesSynced, c.channelsSynced); !ok { return fmt.Errorf("failed to wait for caches to sync") } @@ -303,15 +295,9 @@ func (c *Controller) syncHandler(key string) error { return err } - // Sync Gateway derived from the Channel - gateway, err := c.syncChannelGateway(channel) - if err != nil { - return err - } - // Finally, we update the status block of the Channel resource to reflect the // current state of the world - err = c.updateChannelStatus(channel, service, gateway, virtualService) + err = c.updateChannelStatus(channel, service, virtualService) if err != nil { return err } @@ -354,7 +340,7 @@ func (c *Controller) syncChannelVirtualService(channel *channelsv1alpha1.Channel // If the resource doesn't exist, we'll create it if errors.IsNotFound(err) { - virtualservice, err = c.servingclientset.NetworkingV1alpha3().VirtualServices(channel.Namespace).Create(newVirtualService(channel)) + virtualservice, err = c.channelclientset.NetworkingV1alpha3().VirtualServices(channel.Namespace).Create(newVirtualService(channel)) } // If an error occurs during Get/Create, we'll requeue the item so we can @@ -375,36 +361,7 @@ func (c *Controller) syncChannelVirtualService(channel *channelsv1alpha1.Channel return virtualservice, nil } -func (c *Controller) syncChannelGateway(channel *channelsv1alpha1.Channel) (*istiov1alpha3.Gateway, error) { - // TODO make gateway optional - - // Get the gateway with the specified gateway name - gatewayName := controller.ChannelGatewayName(channel.ObjectMeta.Name) - gateway, err := c.gatewaysLister.Gateways(channel.Namespace).Get(gatewayName) - // If the resource doesn't exist, we'll create it - if errors.IsNotFound(err) { - gateway, err = c.servingclientset.NetworkingV1alpha3().Gateways(channel.Namespace).Create(newGateway(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 Gateway is not controlled by this Channel resource, we should log - // a warning to the event recorder and return - if !metav1.IsControlledBy(gateway, channel) { - msg := fmt.Sprintf(MessageResourceExists, gateway.Name) - c.recorder.Event(channel, corev1.EventTypeWarning, ErrResourceExists, msg) - return nil, fmt.Errorf(msg) - } - - return gateway, nil -} - -func (c *Controller) updateChannelStatus(channel *channelsv1alpha1.Channel, service *corev1.Service, gateway *istiov1alpha3.Gateway, virtualService *istiov1alpha3.VirtualService) error { +func (c *Controller) updateChannelStatus(channel *channelsv1alpha1.Channel, service *corev1.Service, virtualService *istiov1alpha3.VirtualService) 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 @@ -520,12 +477,7 @@ func newVirtualService(channel *channelsv1alpha1.Channel) *istiov1alpha3.Virtual }, }, Spec: istiov1alpha3.VirtualServiceSpec{ - Gateways: []string{ - "mesh", - controller.ChannelGatewayName(channel.Name), - }, Hosts: []string{ - // TODO make host name configurable controller.ServiceHostName(controller.ChannelServiceName(channel.Name), channel.Namespace), controller.ChannelHostName(channel.Name, channel.Namespace), }, @@ -546,44 +498,3 @@ func newVirtualService(channel *channelsv1alpha1.Channel) *istiov1alpha3.Virtual }, } } - -// newGateway creates a new Gateway for a Channel resource. It also sets -// the appropriate OwnerReferences on the resource so handleObject can discover -// the Channel resource that 'owns' it. -func newGateway(channel *channelsv1alpha1.Channel) *istiov1alpha3.Gateway { - labels := map[string]string{ - "channel": channel.Name, - } - return &istiov1alpha3.Gateway{ - ObjectMeta: metav1.ObjectMeta{ - Name: controller.ChannelGatewayName(channel.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: istiov1alpha3.GatewaySpec{ - Selector: map[string]string{ - IstioSelectorKey: IstioIngressGateway, - }, - Servers: []istiov1alpha3.Server{ - { - Port: istiov1alpha3.Port{ - Number: PortNumber, - Name: PortName, - Protocol: istiov1alpha3.ProtocolHTTP, - }, - Hosts: []string{ - // TODO make host name configurable - controller.ChannelHostName(channel.Name, channel.Namespace), - }, - }, - }, - }, - } -} diff --git a/pkg/controller/names.go b/pkg/controller/names.go index b80af862e59..3b8a90e89d4 100644 --- a/pkg/controller/names.go +++ b/pkg/controller/names.go @@ -42,10 +42,6 @@ func ChannelVirtualServiceName(channelName string) string { return fmt.Sprintf("%s-channel", channelName) } -func ChannelGatewayName(channelName string) string { - return fmt.Sprintf("%s-channel", channelName) -} - func ChannelServiceName(channelName string) string { return fmt.Sprintf("%s-channel", channelName) } diff --git a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go index 64b64421408..4fcba3e30b7 100644 --- a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go +++ b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go @@ -49,8 +49,6 @@ type BuildTemplateConditionType string const ( // BuildTemplateInvalid specifies that the given specification is invalid. - // - // TODO(jasonhall): Remove when webhook validation rejects invalid build templates. BuildTemplateInvalid BuildTemplateConditionType = "Invalid" ) diff --git a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go index 52ff1ae7776..988be73c370 100644 --- a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go +++ b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go @@ -147,16 +147,11 @@ type GoogleSpec struct { type BuildConditionType string const ( - // BuildSucceeded is set when the build is running, and becomes True - // when the build finishes successfully. - // - // If the build is ongoing, its status will be Unknown. If it fails, - // its status will be False. - BuildSucceeded BuildConditionType = "Succeeded" - + // BuildComplete specifies that the build has completed successfully. + BuildComplete BuildConditionType = "Complete" + // BuildFailed specifies that the build has failed. + BuildFailed BuildConditionType = "Failed" // BuildInvalid specifies that the given build specification is invalid. - // - // TODO(jasonhall): Remove when webhook validation rejects invalid builds. BuildInvalid BuildConditionType = "Invalid" ) diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/register.go b/vendor/github.com/knative/serving/pkg/apis/istio/register.go index c5accd838e6..73deef9d07c 100644 --- a/vendor/github.com/knative/serving/pkg/apis/istio/register.go +++ b/vendor/github.com/knative/serving/pkg/apis/istio/register.go @@ -17,5 +17,5 @@ limitations under the License. package istio const ( - GroupName = "networking.istio.io" + GroupName = "config.istio.io" ) diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/doc.go b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/doc.go new file mode 100644 index 00000000000..e7284fcf40f --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2018 Google LLC + +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=config.istio.io +package v1alpha2 diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/register.go b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/register.go new file mode 100644 index 00000000000..b4ee69cfb34 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/register.go @@ -0,0 +1,53 @@ +/* +Copyright 2018 Google LLC + +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 v1alpha2 + +import ( + "github.com/knative/serving/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: "v1alpha2"} + +// 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, + &RouteRule{}, + &RouteRuleList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/routerule_types.go b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/routerule_types.go new file mode 100644 index 00000000000..2a9f339c993 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/routerule_types.go @@ -0,0 +1,101 @@ +/* +Copyright 2018 Google LLC + +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 v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// RouteRule +type RouteRule struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec RouteRuleSpec `json:"spec,omitempty"` +} + +// Istio route looks like so, but couldn't find a k8s/go definition for it +// so we'll just create one. This is terrible, but it just might work for +// now, but if things change on their end, this will most certainly break :( +// spec: +// destination: +// # this matches what's in the ingress rule as a placeholder k8s service +// name: k8s-placeholder-service +// route: +// - destination: +// name: revision-service-1 +// match: +// request: +// headers: +// authority: +// regex: foo.example.com +// weight: 90 +// - destination: +// name: revision-service-2 +// namespace: revision-2-namespace +// weight: 10 +// # https://github.com/istio/istio/blob/master/tests/helm/templates/rule-default-route-append-headers.yaml +// appendHeaders: +// istio-custom-header: user-defined-value +type DestinationWeight struct { + Destination IstioService `json:"destination"` + Weight int `json:"weight"` +} + +type IstioService struct { + Name string `json:"name"` + Namespace string `json:"namespace"` + Domain string `json:"domain"` +} + +type Match struct { + Request MatchRequest `json:"request"` +} + +type MatchRequest struct { + Headers Headers `json:"headers"` +} + +type Headers struct { + Authority MatchString `json:"authority"` +} + +type MatchString struct { + Exact string `json:"exact,omitempty"` + Regex string `json:"regex,omitempty"` + Prefix string `json:"prefix,omitempty"` +} + +type RouteRuleSpec struct { + Destination IstioService `json:"destination"` + Match Match `json:"match,omitempty"` + Route []DestinationWeight `json:"route"` + AppendHeaders map[string]string `json:"appendHeaders"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// RouteRuleList is a list of RouteRule resources +type RouteRuleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []RouteRule `json:"items"` +} diff --git a/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go new file mode 100644 index 00000000000..ca2779b6f13 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go @@ -0,0 +1,217 @@ +// +build !ignore_autogenerated + +/* +Copyright 2018 Google LLC + +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. +*/ + +// This file was autogenerated by deepcopy-gen. Do not edit it manually! + +package v1alpha2 + +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 *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 *Headers) DeepCopyInto(out *Headers) { + *out = *in + out.Authority = in.Authority + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Headers. +func (in *Headers) DeepCopy() *Headers { + if in == nil { + return nil + } + out := new(Headers) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IstioService) DeepCopyInto(out *IstioService) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IstioService. +func (in *IstioService) DeepCopy() *IstioService { + if in == nil { + return nil + } + out := new(IstioService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Match) DeepCopyInto(out *Match) { + *out = *in + out.Request = in.Request + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Match. +func (in *Match) DeepCopy() *Match { + if in == nil { + return nil + } + out := new(Match) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MatchRequest) DeepCopyInto(out *MatchRequest) { + *out = *in + out.Headers = in.Headers + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchRequest. +func (in *MatchRequest) DeepCopy() *MatchRequest { + if in == nil { + return nil + } + out := new(MatchRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MatchString) DeepCopyInto(out *MatchString) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchString. +func (in *MatchString) DeepCopy() *MatchString { + if in == nil { + return nil + } + out := new(MatchString) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteRule) DeepCopyInto(out *RouteRule) { + *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 RouteRule. +func (in *RouteRule) DeepCopy() *RouteRule { + if in == nil { + return nil + } + out := new(RouteRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteRule) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteRuleList) DeepCopyInto(out *RouteRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RouteRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteRuleList. +func (in *RouteRuleList) DeepCopy() *RouteRuleList { + if in == nil { + return nil + } + out := new(RouteRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteRuleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteRuleSpec) DeepCopyInto(out *RouteRuleSpec) { + *out = *in + out.Destination = in.Destination + out.Match = in.Match + if in.Route != nil { + in, out := &in.Route, &out.Route + *out = make([]DestinationWeight, len(*in)) + copy(*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 + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteRuleSpec. +func (in *RouteRuleSpec) DeepCopy() *RouteRuleSpec { + if in == nil { + return nil + } + out := new(RouteRuleSpec) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/configuration_types.go b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/configuration_types.go index f8310f0208f..76923be6d29 100644 --- a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/configuration_types.go +++ b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/configuration_types.go @@ -18,9 +18,6 @@ package v1alpha1 import ( "encoding/json" - "fmt" - "reflect" - "time" build "github.com/knative/build/pkg/apis/build/v1alpha1" @@ -38,16 +35,13 @@ import ( // "latest ready" revision's name. // See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#configuration type Configuration struct { - metav1.TypeMeta `json:",inline"` - // +optional + metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` // Spec holds the desired state of the Configuration (from the client). - // +optional Spec ConfigurationSpec `json:"spec,omitempty"` // Status communicates the observed state of the Configuration (from the controller). - // +optional Status ConfigurationStatus `json:"status,omitempty"` } @@ -57,19 +51,16 @@ type ConfigurationSpec struct { // by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778) // So, we add Generation here. Once that gets fixed, remove this and use // ObjectMeta.Generation instead. - // +optional Generation int64 `json:"generation,omitempty"` // Build optionally holds the specification for the build to // perform to produce the Revision's container image. - // +optional Build *build.BuildSpec `json:"build,omitempty"` // RevisionTemplate holds the latest specification for the Revision to // be stamped out. If a Build specification is provided, then the // RevisionTemplate's BuildName field will be populated with the name of // the Build object created to produce the container for the Revision. - // +optional RevisionTemplate RevisionTemplateSpec `json:"revisionTemplate"` } @@ -93,9 +84,6 @@ type ConfigurationCondition struct { Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"` - // +optional - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"` - // +optional Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"` @@ -108,23 +96,19 @@ type ConfigurationStatus struct { // Conditions communicates information about ongoing/complete // reconciliation processes that bring the "spec" inline with the observed // state of the world. - // +optional Conditions []ConfigurationCondition `json:"conditions,omitempty"` // LatestReadyRevisionName holds the name of the latest Revision stamped out // from this Configuration that has had its "Ready" condition become "True". - // +optional LatestReadyRevisionName string `json:"latestReadyRevisionName,omitempty"` // LatestCreatedRevisionName is the last revision that was created from this // Configuration. It might not be ready yet, for that use LatestReadyRevisionName. - // +optional LatestCreatedRevisionName string `json:"latestCreatedRevisionName,omitempty"` // ObservedGeneration is the 'Generation' of the Configuration that // was last processed by the controller. The observed generation is updated // even if the controller failed to process the spec and create the Revision. - // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` } @@ -152,8 +136,8 @@ func (r *Configuration) GetSpecJSON() ([]byte, error) { // IsReady looks at the conditions on the ConfigurationStatus. // ConfigurationConditionReady returns true if ConditionStatus is True -func (cs *ConfigurationStatus) IsReady() bool { - if c := cs.GetCondition(ConfigurationConditionReady); c != nil { +func (configStatus *ConfigurationStatus) IsReady() bool { + if c := configStatus.GetCondition(ConfigurationConditionReady); c != nil { return c.Status == corev1.ConditionTrue } return false @@ -162,9 +146,9 @@ func (cs *ConfigurationStatus) IsReady() bool { // IsLatestReadyRevisionNameUpToDate returns true if the Configuration is ready // and LatestCreateRevisionName is equal to LatestReadyRevisionName. Otherwise // it returns false. -func (cs *ConfigurationStatus) IsLatestReadyRevisionNameUpToDate() bool { - return cs.IsReady() && - cs.LatestCreatedRevisionName == cs.LatestReadyRevisionName +func (configStatus *ConfigurationStatus) IsLatestReadyRevisionNameUpToDate() bool { + return configStatus.IsReady() && + configStatus.LatestCreatedRevisionName == configStatus.LatestReadyRevisionName } func (config *ConfigurationStatus) GetCondition(t ConfigurationConditionType) *ConfigurationCondition { @@ -176,87 +160,28 @@ func (config *ConfigurationStatus) GetCondition(t ConfigurationConditionType) *C return nil } -func (cs *ConfigurationStatus) setCondition(new *ConfigurationCondition) { +func (configStatus *ConfigurationStatus) SetCondition(new *ConfigurationCondition) { if new == nil { return } t := new.Type var conditions []ConfigurationCondition - for _, cond := range cs.Conditions { + for _, cond := range configStatus.Conditions { if cond.Type != t { conditions = append(conditions, cond) - } else { - // If we'd only update the LastTransitionTime, then return. - new.LastTransitionTime = cond.LastTransitionTime - if reflect.DeepEqual(new, &cond) { - return - } } } - new.LastTransitionTime = metav1.NewTime(time.Now()) conditions = append(conditions, *new) - cs.Conditions = conditions + configStatus.Conditions = conditions } -func (cs *ConfigurationStatus) RemoveCondition(t ConfigurationConditionType) { +func (configStatus *ConfigurationStatus) RemoveCondition(t ConfigurationConditionType) { var conditions []ConfigurationCondition - for _, cond := range cs.Conditions { + for _, cond := range configStatus.Conditions { if cond.Type != t { conditions = append(conditions, cond) } } - cs.Conditions = conditions -} - -func (cs *ConfigurationStatus) InitializeConditions() { - for _, cond := range []ConfigurationConditionType{ - ConfigurationConditionLatestRevisionReady, - ConfigurationConditionReady, - } { - if rc := cs.GetCondition(cond); rc == nil { - cs.setCondition(&ConfigurationCondition{ - Type: cond, - Status: corev1.ConditionUnknown, - }) - } - } -} - -func (cs *ConfigurationStatus) SetLatestCreatedRevisionName(name string) { - cs.LatestCreatedRevisionName = name - if cs.LatestReadyRevisionName != name { - cs.setCondition(&ConfigurationCondition{ - Type: ConfigurationConditionLatestRevisionReady, - Status: corev1.ConditionUnknown, - }) - } -} - -func (cs *ConfigurationStatus) SetLatestReadyRevisionName(name string) { - cs.LatestReadyRevisionName = name - for _, cond := range []ConfigurationConditionType{ - ConfigurationConditionLatestRevisionReady, - ConfigurationConditionReady, - } { - cs.setCondition(&ConfigurationCondition{ - Type: cond, - Status: corev1.ConditionTrue, - }) - } -} - -func (cs *ConfigurationStatus) MarkLatestCreatedFailed(name, message string) { - cct := []ConfigurationConditionType{ConfigurationConditionLatestRevisionReady} - if cs.LatestReadyRevisionName == "" { - cct = append(cct, ConfigurationConditionReady) - } - for _, cond := range cct { - cs.setCondition(&ConfigurationCondition{ - Type: cond, - Status: corev1.ConditionFalse, - Reason: "RevisionFailed", - Message: fmt.Sprintf("revision %q failed with message: %s", name, message), - }) - } + configStatus.Conditions = conditions } diff --git a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/revision_types.go b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/revision_types.go index 663f49259f1..4b21668ffa4 100644 --- a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/revision_types.go +++ b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/revision_types.go @@ -18,13 +18,11 @@ package v1alpha1 import ( "encoding/json" - "reflect" "time" corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - buildv1alpha1 "github.com/knative/build/pkg/apis/build/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // +genclient @@ -33,25 +31,21 @@ import ( // Revision is an immutable snapshot of code and configuration. // See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#revision type Revision struct { - metav1.TypeMeta `json:",inline"` - // +optional + metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` // Spec holds the desired state of the Revision (from the client). - // +optional Spec RevisionSpec `json:"spec,omitempty"` // Status communicates the observed state of the Revision (from the controller). - // +optional Status RevisionStatus `json:"status,omitempty"` } // RevisionTemplateSpec describes the data a revision should have when created from a template. // Based on: https://github.com/kubernetes/api/blob/e771f807/core/v1/types.go#L3179-L3190 type RevisionTemplateSpec struct { - // +optional metav1.ObjectMeta `json:"metadata,omitempty"` - // +optional + Spec RevisionSpec `json:"spec,omitempty"` } @@ -95,20 +89,17 @@ type RevisionSpec struct { // by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778) // So, we add Generation here. Once that gets fixed, remove this and use // ObjectMeta.Generation instead. - // +optional Generation int64 `json:"generation,omitempty"` // ServingState holds a value describing the desired state the Kubernetes // resources should be in for this Revision. // Users must not specify this when creating a revision. It is expected // that the system will manipulate this based on routability and load. - // +optional ServingState RevisionServingStateType `json:"servingState,omitempty"` // ConcurrencyModel specifies the desired concurrency model - // (Single or Multi) for the - // Revision. Defaults to Multi. - // +optional + // (SingleConcurrency or MultiConcurrency) for the + // Revision. Defaults to MultiConcurrency. ConcurrencyModel RevisionRequestConcurrencyModelType `json:"concurrencyModel,omitempty"` // ServiceAccountName holds the name of the Kubernetes service account @@ -118,12 +109,10 @@ type RevisionSpec struct { // This may be used to provide access to private container images by // following: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account // TODO(ZhiminXiang): verify the corresponding service account exists. - // +optional ServiceAccountName string `json:"serviceAccountName,omitempty"` // BuildName optionally holds the name of the Build responsible for // producing the container image for its Revision. - // +optional BuildName string `json:"buildName,omitempty"` // Container defines the unit of execution for this Revision. @@ -131,7 +120,6 @@ type RevisionSpec struct { // this Container, including: name, resources, ports, and volumeMounts. // TODO(mattmoor): Link to the runtime contract tracked by: // https://github.com/knative/serving/issues/627 - // +optional Container corev1.Container `json:"container,omitempty"` } @@ -176,24 +164,20 @@ type RevisionStatus struct { // load balances over the pods backing this Revision. When the Revision // is Active, this service would be an appropriate ingress target for // targeting the revision. - // +optional ServiceName string `json:"serviceName,omitempty"` // Conditions communicates information about ongoing/complete // reconciliation processes that bring the "spec" inline with the observed // state of the world. - // +optional Conditions []RevisionCondition `json:"conditions,omitempty"` // ObservedGeneration is the 'Generation' of the Configuration that // was last processed by the controller. The observed generation is updated // even if the controller failed to process the spec and create the Revision. - // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` // LogURL specifies the generated logging url for this particular revision // based on the revision url template specified in the controller's config. - // +optional LogURL string `json:"logUrl,omitempty"` } @@ -228,20 +212,6 @@ func (rs *RevisionStatus) IsReady() bool { return false } -func (rs *RevisionStatus) IsInactive() bool { - cond := rs.GetCondition(RevisionConditionReady) - return (cond.Reason == "Inactive" && cond.Status == corev1.ConditionFalse) || - (cond.Reason == "Activating" && cond.Status == corev1.ConditionUnknown) -} - -func (rs *RevisionStatus) IsActive() bool { - return rs.IsReady() && !rs.IsInactive() -} - -func (rs *RevisionStatus) IsRoutable() bool { - return rs.IsReady() || rs.IsInactive() -} - // IsFailed looks to all non-Ready conditions; if any are false, then // this node is in a terminal failure state. func (rs *RevisionStatus) IsFailed() bool { @@ -262,7 +232,7 @@ func (rs *RevisionStatus) GetCondition(t RevisionConditionType) *RevisionConditi return nil } -func (rs *RevisionStatus) setCondition(new *RevisionCondition) { +func (rs *RevisionStatus) SetCondition(new *RevisionCondition) { if new == nil { return } @@ -272,12 +242,6 @@ func (rs *RevisionStatus) setCondition(new *RevisionCondition) { for _, cond := range rs.Conditions { if cond.Type != t { conditions = append(conditions, cond) - } else { - // If we'd only update the LastTransitionTime, then return. - new.LastTransitionTime = cond.LastTransitionTime - if reflect.DeepEqual(new, &cond) { - return - } } } new.LastTransitionTime = metav1.NewTime(time.Now()) @@ -294,169 +258,3 @@ func (rs *RevisionStatus) RemoveCondition(t RevisionConditionType) { } rs.Conditions = conditions } - -func (rs *RevisionStatus) InitializeConditions() { - // We don't include BuildSucceeded here because it could confuse users if - // no `buildName` was specified. - for _, cond := range []RevisionConditionType{ - RevisionConditionResourcesAvailable, - RevisionConditionContainerHealthy, - RevisionConditionReady, - } { - if rc := rs.GetCondition(cond); rc == nil { - rs.setCondition(&RevisionCondition{ - Type: cond, - Status: corev1.ConditionUnknown, - }) - } - } -} - -func (rs *RevisionStatus) InitializeBuildCondition() { - if rc := rs.GetCondition(RevisionConditionBuildSucceeded); rc == nil { - rs.setCondition(&RevisionCondition{ - Type: RevisionConditionBuildSucceeded, - Status: corev1.ConditionUnknown, - }) - } -} - -func (rs *RevisionStatus) MarkBuilding() { - for _, cond := range []RevisionConditionType{ - RevisionConditionBuildSucceeded, - RevisionConditionReady, - } { - rs.setCondition(&RevisionCondition{ - Type: cond, - Status: corev1.ConditionUnknown, - Reason: "Building", - }) - } -} - -func (rs *RevisionStatus) MarkBuildSucceeded() { - rs.setCondition(&RevisionCondition{ - Type: RevisionConditionBuildSucceeded, - Status: corev1.ConditionTrue, - }) - // Clear "Reason: Building". There is a risk this could reset a "Ready: False" state, - // but not as things exist today. - rs.setCondition(&RevisionCondition{ - Type: RevisionConditionReady, - Status: corev1.ConditionUnknown, - }) -} - -func (rs *RevisionStatus) MarkBuildFailed(bc *buildv1alpha1.BuildCondition) { - for _, cond := range []RevisionConditionType{ - RevisionConditionBuildSucceeded, - RevisionConditionReady, - } { - rs.setCondition(&RevisionCondition{ - Type: cond, - Status: corev1.ConditionFalse, - Reason: bc.Reason, - Message: bc.Message, - }) - } -} - -func (rs *RevisionStatus) MarkDeploying(reason string) { - for _, cond := range []RevisionConditionType{ - RevisionConditionResourcesAvailable, - RevisionConditionContainerHealthy, - RevisionConditionReady, - } { - rs.setCondition(&RevisionCondition{ - Type: cond, - Status: corev1.ConditionUnknown, - Reason: reason, - }) - } -} - -func (rs *RevisionStatus) MarkServiceTimeout() { - for _, cond := range []RevisionConditionType{ - RevisionConditionResourcesAvailable, - RevisionConditionReady, - } { - rs.setCondition(&RevisionCondition{ - Type: cond, - Status: corev1.ConditionFalse, - Reason: "ServiceTimeout", - Message: "Timed out waiting for a service endpoint to become ready", - }) - } -} - -func (rs *RevisionStatus) MarkProgressDeadlineExceeded(message string) { - for _, cond := range []RevisionConditionType{ - RevisionConditionResourcesAvailable, - RevisionConditionReady, - } { - rs.setCondition(&RevisionCondition{ - Type: cond, - Status: corev1.ConditionFalse, - Reason: "ProgressDeadlineExceeded", - Message: message, - }) - } -} - -func (rs *RevisionStatus) MarkContainerHealthy() { - rs.setCondition(&RevisionCondition{ - Type: RevisionConditionContainerHealthy, - Status: corev1.ConditionTrue, - }) - rs.checkAndMarkReady() -} - -func (rs *RevisionStatus) MarkResourcesAvailable() { - rs.setCondition(&RevisionCondition{ - Type: RevisionConditionResourcesAvailable, - Status: corev1.ConditionTrue, - }) - rs.checkAndMarkReady() -} - -func (rs *RevisionStatus) MarkInactive() { - rs.setCondition(&RevisionCondition{ - Type: RevisionConditionReady, - Status: corev1.ConditionFalse, - Reason: "Inactive", - }) -} - -func (rs *RevisionStatus) MarkContainerMissing(message string) { - for _, cond := range []RevisionConditionType{ - RevisionConditionContainerHealthy, - RevisionConditionReady, - } { - rs.setCondition(&RevisionCondition{ - Type: cond, - Status: corev1.ConditionFalse, - Reason: "ContainerMissing", - Message: message, - }) - } -} - -func (rs *RevisionStatus) checkAndMarkReady() { - for _, cond := range []RevisionConditionType{ - RevisionConditionContainerHealthy, - RevisionConditionResourcesAvailable, - } { - c := rs.GetCondition(cond) - if c == nil || c.Status != corev1.ConditionTrue { - return - } - } - rs.markReady() -} - -func (rs *RevisionStatus) markReady() { - rs.setCondition(&RevisionCondition{ - Type: RevisionConditionReady, - Status: corev1.ConditionTrue, - }) -} diff --git a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/route_types.go b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/route_types.go index ba02b2d46a1..ed0dbe899e5 100644 --- a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/route_types.go +++ b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/route_types.go @@ -18,9 +18,6 @@ package v1alpha1 import ( "encoding/json" - "fmt" - "reflect" - "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -36,16 +33,13 @@ import ( // "latest ready" revision changes, and smoothly rolling out latest revisions. // See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#route type Route struct { - metav1.TypeMeta `json:",inline"` - // +optional + metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` // Spec holds the desired state of the Route (from the client). - // +optional Spec RouteSpec `json:"spec,omitempty"` // Status communicates the observed state of the Route (from the controller). - // +optional Status RouteStatus `json:"status,omitempty"` } @@ -81,11 +75,9 @@ type RouteSpec struct { // by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778) // So, we add Generation here. Once that gets fixed, remove this and use // ObjectMeta.Generation instead. - // +optional Generation int64 `json:"generation,omitempty"` - // Traffic specifies how to distribute traffic over a collection of Knative Serving Revisions and Configurations. - // +optional + // Traffic specifies how to distribute traffic over a collection of Elafros Revisions and Configurations. Traffic []TrafficTarget `json:"traffic,omitempty"` } @@ -96,9 +88,6 @@ type RouteCondition struct { Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"` - // +optional - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"` - // +optional Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"` // +optional @@ -113,7 +102,6 @@ const ( // RouteConditionReady is set when the service is configured // and has available backends ready to receive traffic. RouteConditionReady RouteConditionType = "Ready" - // RouteConditionAllTrafficAssigned is set to False when the // service is not configured properly or has no available // backends ready to receive traffic. @@ -124,26 +112,22 @@ const ( type RouteStatus struct { // Domain holds the top-level domain that will distribute traffic over the provided targets. // It generally has the form {route-name}.{route-namespace}.{cluster-level-suffix} - // +optional Domain string `json:"domain,omitempty"` // Traffic holds the configured traffic distribution. // These entries will always contain RevisionName references. // When ConfigurationName appears in the spec, this will hold the // LatestReadyRevisionName that we last observed. - // +optional Traffic []TrafficTarget `json:"traffic,omitempty"` // Conditions communicates information about ongoing/complete // reconciliation processes that bring the "spec" inline with the observed // state of the world. - // +optional Conditions []RouteCondition `json:"conditions,omitempty"` // ObservedGeneration is the 'Generation' of the Configuration that // was last processed by the controller. The observed generation is updated // even if the controller failed to process the spec and create the Revision. - // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` } @@ -185,7 +169,7 @@ func (rs *RouteStatus) GetCondition(t RouteConditionType) *RouteCondition { return nil } -func (rs *RouteStatus) setCondition(new *RouteCondition) { +func (rs *RouteStatus) SetCondition(new *RouteCondition) { if new == nil { return } @@ -195,15 +179,8 @@ func (rs *RouteStatus) setCondition(new *RouteCondition) { for _, cond := range rs.Conditions { if cond.Type != t { conditions = append(conditions, cond) - } else { - // If we'd only update the LastTransitionTime, then return. - new.LastTransitionTime = cond.LastTransitionTime - if reflect.DeepEqual(new, &cond) { - return - } } } - new.LastTransitionTime = metav1.NewTime(time.Now()) conditions = append(conditions, *new) rs.Conditions = conditions } @@ -217,58 +194,3 @@ func (rs *RouteStatus) RemoveCondition(t RouteConditionType) { } rs.Conditions = conditions } - -func (rs *RouteStatus) InitializeConditions() { - for _, cond := range []RouteConditionType{ - RouteConditionAllTrafficAssigned, - RouteConditionReady, - } { - if rc := rs.GetCondition(cond); rc == nil { - rs.setCondition(&RouteCondition{ - Type: cond, - Status: corev1.ConditionUnknown, - }) - } - } -} - -func (rs *RouteStatus) MarkTrafficAssigned() { - rs.setCondition(&RouteCondition{ - Type: RouteConditionAllTrafficAssigned, - Status: corev1.ConditionTrue, - }) - rs.checkAndMarkReady() -} - -func (rs *RouteStatus) MarkTrafficNotAssigned(kind, name string) { - for _, cond := range []RouteConditionType{ - RouteConditionAllTrafficAssigned, - RouteConditionReady, - } { - rs.setCondition(&RouteCondition{ - Type: cond, - Status: corev1.ConditionFalse, - Reason: kind + "Missing", - Message: fmt.Sprintf("Referenced %s %q not found", kind, name), - }) - } -} - -func (rs *RouteStatus) checkAndMarkReady() { - for _, cond := range []RouteConditionType{ - RouteConditionAllTrafficAssigned, - } { - ata := rs.GetCondition(cond) - if ata == nil || ata.Status != corev1.ConditionTrue { - return - } - } - rs.markReady() -} - -func (rs *RouteStatus) markReady() { - rs.setCondition(&RouteCondition{ - Type: RouteConditionReady, - Status: corev1.ConditionTrue, - }) -} diff --git a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/service_types.go b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/service_types.go index 9a46ebb3581..a76fbf1b7bc 100644 --- a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/service_types.go +++ b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/service_types.go @@ -18,8 +18,6 @@ package v1alpha1 import ( "encoding/json" - "reflect" - "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -30,12 +28,10 @@ import ( // Service type Service struct { - metav1.TypeMeta `json:",inline"` - // +optional + metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - // +optional - Spec ServiceSpec `json:"spec,omitempty"` - // +optional + + Spec ServiceSpec `json:"spec,omitempty"` Status ServiceStatus `json:"status,omitempty"` } @@ -46,7 +42,6 @@ type ServiceSpec struct { // by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778) // So, we add Generation here. Once that gets fixed, remove this and use // ObjectMeta.Generation instead. - // +optional Generation int64 `json:"generation,omitempty"` // RunLatest defines a simple Service. It will automatically @@ -63,18 +58,15 @@ type ServiceSpec struct { type RunLatestType struct { // The configuration for this service. - // +optional Configuration ConfigurationSpec `json:"configuration,omitempty"` } type PinnedType struct { // The revision name to pin this service to until changed // to a different service type. - // +optional RevisionName string `json:"revisionName,omitempty"` // The configuration for this service. - // +optional Configuration ConfigurationSpec `json:"configuration,omitempty"` } @@ -83,9 +75,6 @@ type ServiceCondition struct { Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"` - // +optional - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"` - // +optional Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"` // +optional @@ -99,21 +88,13 @@ const ( // ServiceConditionReady is set when the service is configured // and has available backends ready to receive traffic. ServiceConditionReady ServiceConditionType = "Ready" - // ServiceConditionRouteReady is set when the service's underlying - // route has reported readiness. - ServiceConditionRouteReady ServiceConditionType = "RouteReady" - // ServiceConditionConfigurationReady is set when the service's underlying - // configuration has reported readiness. - ServiceConditionConfigurationReady ServiceConditionType = "ConfigurationReady" ) type ServiceStatus struct { - // +optional Conditions []ServiceCondition `json:"conditions,omitempty"` // ObservedGeneration is the 'Generation' of the Service that // was last processed by the controller. - // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` } @@ -155,7 +136,7 @@ func (ss *ServiceStatus) GetCondition(t ServiceConditionType) *ServiceCondition return nil } -func (ss *ServiceStatus) setCondition(new *ServiceCondition) { +func (ss *ServiceStatus) SetCondition(new *ServiceCondition) { if new == nil { return } @@ -165,15 +146,8 @@ func (ss *ServiceStatus) setCondition(new *ServiceCondition) { for _, cond := range ss.Conditions { if cond.Type != t { conditions = append(conditions, cond) - } else { - // If we'd only update the LastTransitionTime, then return. - new.LastTransitionTime = cond.LastTransitionTime - if reflect.DeepEqual(new, &cond) { - return - } } } - new.LastTransitionTime = metav1.NewTime(time.Now()) conditions = append(conditions, *new) ss.Conditions = conditions } @@ -187,84 +161,3 @@ func (ss *ServiceStatus) RemoveCondition(t ServiceConditionType) { } ss.Conditions = conditions } - -func (ss *ServiceStatus) InitializeConditions() { - for _, cond := range []ServiceConditionType{ - ServiceConditionReady, - ServiceConditionConfigurationReady, - ServiceConditionRouteReady, - } { - if rc := ss.GetCondition(cond); rc == nil { - ss.setCondition(&ServiceCondition{ - Type: cond, - Status: corev1.ConditionUnknown, - }) - } - } -} - -func (ss *ServiceStatus) PropagateConfigurationStatus(cs ConfigurationStatus) { - cc := cs.GetCondition(ConfigurationConditionReady) - if cc == nil { - return - } - sct := []ServiceConditionType{ServiceConditionConfigurationReady} - // If the underlying Configuration reported failure, then bubble it up. - if cc.Status == corev1.ConditionFalse { - sct = append(sct, ServiceConditionReady) - } - for _, cond := range sct { - ss.setCondition(&ServiceCondition{ - Type: cond, - Status: cc.Status, - Reason: cc.Reason, - Message: cc.Message, - }) - } - if cc.Status == corev1.ConditionTrue { - ss.checkAndMarkReady() - } -} - -func (ss *ServiceStatus) PropagateRouteStatus(rs RouteStatus) { - rc := rs.GetCondition(RouteConditionReady) - if rc == nil { - return - } - sct := []ServiceConditionType{ServiceConditionRouteReady} - // If the underlying Route reported failure, then bubble it up. - if rc.Status == corev1.ConditionFalse { - sct = append(sct, ServiceConditionReady) - } - for _, cond := range sct { - ss.setCondition(&ServiceCondition{ - Type: cond, - Status: rc.Status, - Reason: rc.Reason, - Message: rc.Message, - }) - } - if rc.Status == corev1.ConditionTrue { - ss.checkAndMarkReady() - } -} - -func (ss *ServiceStatus) checkAndMarkReady() { - for _, cond := range []ServiceConditionType{ - ServiceConditionConfigurationReady, - ServiceConditionRouteReady, - } { - c := ss.GetCondition(cond) - if c == nil || c.Status != corev1.ConditionTrue { - return - } - } - ss.markReady() -} - -func (ss *ServiceStatus) markReady() { - ss.setCondition(&ServiceCondition{ - Type: ServiceConditionReady, - Status: corev1.ConditionTrue, - }) -} diff --git a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go index a8fbe520b5e..cb4256eb2b7 100644 --- a/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/knative/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go @@ -57,7 +57,6 @@ func (in *Configuration) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ConfigurationCondition) DeepCopyInto(out *ConfigurationCondition) { *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } @@ -137,9 +136,7 @@ func (in *ConfigurationStatus) DeepCopyInto(out *ConfigurationStatus) { if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make([]ConfigurationCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + copy(*out, *in) } return } @@ -341,7 +338,6 @@ func (in *Route) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RouteCondition) DeepCopyInto(out *RouteCondition) { *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } @@ -421,9 +417,7 @@ func (in *RouteStatus) DeepCopyInto(out *RouteStatus) { if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make([]RouteCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + copy(*out, *in) } return } @@ -487,7 +481,6 @@ func (in *Service) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServiceCondition) DeepCopyInto(out *ServiceCondition) { *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } @@ -575,9 +568,7 @@ func (in *ServiceStatus) DeepCopyInto(out *ServiceStatus) { if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make([]ServiceCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + copy(*out, *in) } return } diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/clientset.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/clientset.go index 25d69bc661c..7be974c10af 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/clientset.go +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/clientset.go @@ -17,7 +17,7 @@ package versioned import ( glog "github.com/golang/glog" - networkingv1alpha3 "github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3" + configv1alpha2 "github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2" servingv1alpha1 "github.com/knative/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" @@ -26,9 +26,9 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface + ConfigV1alpha2() configv1alpha2.ConfigV1alpha2Interface // Deprecated: please explicitly pick a version if possible. - Networking() networkingv1alpha3.NetworkingV1alpha3Interface + Config() configv1alpha2.ConfigV1alpha2Interface ServingV1alpha1() servingv1alpha1.ServingV1alpha1Interface // Deprecated: please explicitly pick a version if possible. Serving() servingv1alpha1.ServingV1alpha1Interface @@ -38,19 +38,19 @@ type Interface interface { // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - networkingV1alpha3 *networkingv1alpha3.NetworkingV1alpha3Client - servingV1alpha1 *servingv1alpha1.ServingV1alpha1Client + configV1alpha2 *configv1alpha2.ConfigV1alpha2Client + servingV1alpha1 *servingv1alpha1.ServingV1alpha1Client } -// NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client -func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface { - return c.networkingV1alpha3 +// ConfigV1alpha2 retrieves the ConfigV1alpha2Client +func (c *Clientset) ConfigV1alpha2() configv1alpha2.ConfigV1alpha2Interface { + return c.configV1alpha2 } -// Deprecated: Networking retrieves the default version of NetworkingClient. +// Deprecated: Config retrieves the default version of ConfigClient. // Please explicitly pick a version. -func (c *Clientset) Networking() networkingv1alpha3.NetworkingV1alpha3Interface { - return c.networkingV1alpha3 +func (c *Clientset) Config() configv1alpha2.ConfigV1alpha2Interface { + return c.configV1alpha2 } // ServingV1alpha1 retrieves the ServingV1alpha1Client @@ -80,7 +80,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error - cs.networkingV1alpha3, err = networkingv1alpha3.NewForConfig(&configShallowCopy) + cs.configV1alpha2, err = configv1alpha2.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -101,7 +101,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset - cs.networkingV1alpha3 = networkingv1alpha3.NewForConfigOrDie(c) + cs.configV1alpha2 = configv1alpha2.NewForConfigOrDie(c) cs.servingV1alpha1 = servingv1alpha1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) @@ -111,7 +111,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.networkingV1alpha3 = networkingv1alpha3.New(c) + cs.configV1alpha2 = configv1alpha2.New(c) cs.servingV1alpha1 = servingv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/scheme/register.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/scheme/register.go index fae0f9ae6b5..ac5900b2c3d 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/scheme/register.go +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/scheme/register.go @@ -16,7 +16,7 @@ limitations under the License. package scheme import ( - networkingv1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" + configv1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" servingv1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -48,6 +48,6 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { - networkingv1alpha3.AddToScheme(scheme) + configv1alpha2.AddToScheme(scheme) servingv1alpha1.AddToScheme(scheme) } diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/doc.go similarity index 97% rename from vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go rename to vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/doc.go index e594c0f20b6..bebde544855 100644 --- a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha3/doc.go +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/doc.go @@ -14,4 +14,4 @@ See the License for the specific language governing permissions and limitations under the License. */ // This package has the automatically generated typed clients. -package v1alpha3 +package v1alpha2 diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/generated_expansion.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/generated_expansion.go new file mode 100644 index 00000000000..58b93d91a00 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/generated_expansion.go @@ -0,0 +1,18 @@ +/* +Copyright 2018 Google LLC + +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 v1alpha2 + +type RouteRuleExpansion interface{} diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/istio_client.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/istio_client.go new file mode 100644 index 00000000000..effeee68c7a --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/istio_client.go @@ -0,0 +1,87 @@ +/* +Copyright 2018 Google LLC + +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 v1alpha2 + +import ( + v1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" + "github.com/knative/serving/pkg/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type ConfigV1alpha2Interface interface { + RESTClient() rest.Interface + RouteRulesGetter +} + +// ConfigV1alpha2Client is used to interact with features provided by the config.istio.io group. +type ConfigV1alpha2Client struct { + restClient rest.Interface +} + +func (c *ConfigV1alpha2Client) RouteRules(namespace string) RouteRuleInterface { + return newRouteRules(c, namespace) +} + +// NewForConfig creates a new ConfigV1alpha2Client for the given config. +func NewForConfig(c *rest.Config) (*ConfigV1alpha2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ConfigV1alpha2Client{client}, nil +} + +// NewForConfigOrDie creates a new ConfigV1alpha2Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ConfigV1alpha2Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ConfigV1alpha2Client for the given RESTClient. +func New(c rest.Interface) *ConfigV1alpha2Client { + return &ConfigV1alpha2Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha2.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 *ConfigV1alpha2Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go new file mode 100644 index 00000000000..6dda2077811 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/clientset/versioned/typed/istio/v1alpha2/routerule.go @@ -0,0 +1,154 @@ +/* +Copyright 2018 Google LLC + +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 v1alpha2 + +import ( + v1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" + scheme "github.com/knative/serving/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" +) + +// RouteRulesGetter has a method to return a RouteRuleInterface. +// A group's client should implement this interface. +type RouteRulesGetter interface { + RouteRules(namespace string) RouteRuleInterface +} + +// RouteRuleInterface has methods to work with RouteRule resources. +type RouteRuleInterface interface { + Create(*v1alpha2.RouteRule) (*v1alpha2.RouteRule, error) + Update(*v1alpha2.RouteRule) (*v1alpha2.RouteRule, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha2.RouteRule, error) + List(opts v1.ListOptions) (*v1alpha2.RouteRuleList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.RouteRule, err error) + RouteRuleExpansion +} + +// routeRules implements RouteRuleInterface +type routeRules struct { + client rest.Interface + ns string +} + +// newRouteRules returns a RouteRules +func newRouteRules(c *ConfigV1alpha2Client, namespace string) *routeRules { + return &routeRules{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the routeRule, and returns the corresponding routeRule object, and an error if there is any. +func (c *routeRules) Get(name string, options v1.GetOptions) (result *v1alpha2.RouteRule, err error) { + result = &v1alpha2.RouteRule{} + err = c.client.Get(). + Namespace(c.ns). + Resource("routerules"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of RouteRules that match those selectors. +func (c *routeRules) List(opts v1.ListOptions) (result *v1alpha2.RouteRuleList, err error) { + result = &v1alpha2.RouteRuleList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("routerules"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested routeRules. +func (c *routeRules) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("routerules"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a routeRule and creates it. Returns the server's representation of the routeRule, and an error, if there is any. +func (c *routeRules) Create(routeRule *v1alpha2.RouteRule) (result *v1alpha2.RouteRule, err error) { + result = &v1alpha2.RouteRule{} + err = c.client.Post(). + Namespace(c.ns). + Resource("routerules"). + Body(routeRule). + Do(). + Into(result) + return +} + +// Update takes the representation of a routeRule and updates it. Returns the server's representation of the routeRule, and an error, if there is any. +func (c *routeRules) Update(routeRule *v1alpha2.RouteRule) (result *v1alpha2.RouteRule, err error) { + result = &v1alpha2.RouteRule{} + err = c.client.Put(). + Namespace(c.ns). + Resource("routerules"). + Name(routeRule.Name). + Body(routeRule). + Do(). + Into(result) + return +} + +// Delete takes name of the routeRule and deletes it. Returns an error if one occurs. +func (c *routeRules) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("routerules"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *routeRules) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("routerules"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched routeRule. +func (c *routeRules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.RouteRule, err error) { + result = &v1alpha2.RouteRule{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("routerules"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/factory.go b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/factory.go index df03f3cbe5a..ea4b2ea58a0 100644 --- a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/factory.go +++ b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/factory.go @@ -121,11 +121,11 @@ type SharedInformerFactory interface { ForResource(resource schema.GroupVersionResource) (GenericInformer, error) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - Networking() istio.Interface + Config() istio.Interface Serving() serving.Interface } -func (f *sharedInformerFactory) Networking() istio.Interface { +func (f *sharedInformerFactory) Config() istio.Interface { return istio.New(f, f.namespace, f.tweakListOptions) } diff --git a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/generic.go b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/generic.go index 0f7da296d89..9547f925d2e 100644 --- a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/generic.go +++ b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/generic.go @@ -18,7 +18,7 @@ package externalversions import ( "fmt" - v1alpha3 "github.com/knative/serving/pkg/apis/istio/v1alpha3" + v1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" v1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" @@ -50,11 +50,9 @@ func (f *genericInformer) Lister() cache.GenericLister { // 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 + // Group=config.istio.io, Version=v1alpha2 + case v1alpha2.SchemeGroupVersion.WithResource("routerules"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1alpha2().RouteRules().Informer()}, nil // Group=serving.knative.dev, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithResource("configurations"): diff --git a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/interface.go b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/interface.go index dcfbac86216..50a8177604f 100644 --- a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/interface.go +++ b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/interface.go @@ -13,17 +13,17 @@ 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 networking +package config import ( internalinterfaces "github.com/knative/serving/pkg/client/informers/externalversions/internalinterfaces" - v1alpha3 "github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha3" + v1alpha2 "github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2" ) // 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 + // V1alpha2 provides access to shared informers for resources in V1alpha2. + V1alpha2() v1alpha2.Interface } type group struct { @@ -37,7 +37,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList 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) +// V1alpha2 returns a new v1alpha2.Interface. +func (g *group) V1alpha2() v1alpha2.Interface { + return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) } diff --git a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/interface.go b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/interface.go new file mode 100644 index 00000000000..e45718784c2 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/interface.go @@ -0,0 +1,42 @@ +/* +Copyright 2018 Google LLC + +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 v1alpha2 + +import ( + internalinterfaces "github.com/knative/serving/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // RouteRules returns a RouteRuleInformer. + RouteRules() RouteRuleInformer +} + +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} +} + +// RouteRules returns a RouteRuleInformer. +func (v *version) RouteRules() RouteRuleInformer { + return &routeRuleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/routerule.go b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/routerule.go new file mode 100644 index 00000000000..b923794dabc --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/informers/externalversions/istio/v1alpha2/routerule.go @@ -0,0 +1,86 @@ +/* +Copyright 2018 Google LLC + +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 v1alpha2 + +import ( + time "time" + + istio_v1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" + versioned "github.com/knative/serving/pkg/client/clientset/versioned" + internalinterfaces "github.com/knative/serving/pkg/client/informers/externalversions/internalinterfaces" + v1alpha2 "github.com/knative/serving/pkg/client/listers/istio/v1alpha2" + 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" +) + +// RouteRuleInformer provides access to a shared informer and lister for +// RouteRules. +type RouteRuleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.RouteRuleLister +} + +type routeRuleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRouteRuleInformer constructs a new informer for RouteRule 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 NewRouteRuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRouteRuleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRouteRuleInformer constructs a new informer for RouteRule 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 NewFilteredRouteRuleInformer(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.ConfigV1alpha2().RouteRules(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ConfigV1alpha2().RouteRules(namespace).Watch(options) + }, + }, + &istio_v1alpha2.RouteRule{}, + resyncPeriod, + indexers, + ) +} + +func (f *routeRuleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRouteRuleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *routeRuleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&istio_v1alpha2.RouteRule{}, f.defaultInformer) +} + +func (f *routeRuleInformer) Lister() v1alpha2.RouteRuleLister { + return v1alpha2.NewRouteRuleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/expansion_generated.go b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/expansion_generated.go new file mode 100644 index 00000000000..63c0e424cf1 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/expansion_generated.go @@ -0,0 +1,24 @@ +/* +Copyright 2018 Google LLC + +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 v1alpha2 + +// RouteRuleListerExpansion allows custom methods to be added to +// RouteRuleLister. +type RouteRuleListerExpansion interface{} + +// RouteRuleNamespaceListerExpansion allows custom methods to be added to +// RouteRuleNamespaceLister. +type RouteRuleNamespaceListerExpansion interface{} diff --git a/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/routerule.go b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/routerule.go new file mode 100644 index 00000000000..353d6e01e50 --- /dev/null +++ b/vendor/github.com/knative/serving/pkg/client/listers/istio/v1alpha2/routerule.go @@ -0,0 +1,91 @@ +/* +Copyright 2018 Google LLC + +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 v1alpha2 + +import ( + v1alpha2 "github.com/knative/serving/pkg/apis/istio/v1alpha2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RouteRuleLister helps list RouteRules. +type RouteRuleLister interface { + // List lists all RouteRules in the indexer. + List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) + // RouteRules returns an object that can list and get RouteRules. + RouteRules(namespace string) RouteRuleNamespaceLister + RouteRuleListerExpansion +} + +// routeRuleLister implements the RouteRuleLister interface. +type routeRuleLister struct { + indexer cache.Indexer +} + +// NewRouteRuleLister returns a new RouteRuleLister. +func NewRouteRuleLister(indexer cache.Indexer) RouteRuleLister { + return &routeRuleLister{indexer: indexer} +} + +// List lists all RouteRules in the indexer. +func (s *routeRuleLister) List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.RouteRule)) + }) + return ret, err +} + +// RouteRules returns an object that can list and get RouteRules. +func (s *routeRuleLister) RouteRules(namespace string) RouteRuleNamespaceLister { + return routeRuleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RouteRuleNamespaceLister helps list and get RouteRules. +type RouteRuleNamespaceLister interface { + // List lists all RouteRules in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) + // Get retrieves the RouteRule from the indexer for a given namespace and name. + Get(name string) (*v1alpha2.RouteRule, error) + RouteRuleNamespaceListerExpansion +} + +// routeRuleNamespaceLister implements the RouteRuleNamespaceLister +// interface. +type routeRuleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RouteRules in the indexer for a given namespace. +func (s routeRuleNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.RouteRule, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.RouteRule)) + }) + return ret, err +} + +// Get retrieves the RouteRule from the indexer for a given namespace and name. +func (s routeRuleNamespaceLister) Get(name string) (*v1alpha2.RouteRule, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("routerule"), name) + } + return obj.(*v1alpha2.RouteRule), nil +} diff --git a/vendor/github.com/knative/serving/third_party/config/monitoring/common/istio/LICENSE b/vendor/github.com/knative/serving/third_party/config/monitoring/istio/LICENSE similarity index 100% rename from vendor/github.com/knative/serving/third_party/config/monitoring/common/istio/LICENSE rename to vendor/github.com/knative/serving/third_party/config/monitoring/istio/LICENSE diff --git a/vendor/github.com/knative/serving/third_party/config/monitoring/common/kubernetes/LICENSE b/vendor/github.com/knative/serving/third_party/config/monitoring/kubernetes/LICENSE similarity index 100% rename from vendor/github.com/knative/serving/third_party/config/monitoring/common/kubernetes/LICENSE rename to vendor/github.com/knative/serving/third_party/config/monitoring/kubernetes/LICENSE diff --git a/vendor/github.com/knative/serving/third_party/config/monitoring/common/prometheus-operator/LICENSE b/vendor/github.com/knative/serving/third_party/config/monitoring/prometheus-operator/LICENSE similarity index 100% rename from vendor/github.com/knative/serving/third_party/config/monitoring/common/prometheus-operator/LICENSE rename to vendor/github.com/knative/serving/third_party/config/monitoring/prometheus-operator/LICENSE diff --git a/vendor/github.com/knative/serving/third_party/config/monitoring/common/prometheus-operator/NOTICE b/vendor/github.com/knative/serving/third_party/config/monitoring/prometheus-operator/NOTICE similarity index 100% rename from vendor/github.com/knative/serving/third_party/config/monitoring/common/prometheus-operator/NOTICE rename to vendor/github.com/knative/serving/third_party/config/monitoring/prometheus-operator/NOTICE diff --git a/vendor/github.com/knative/serving/third_party/config/monitoring/elasticsearch/LICENSE b/vendor/github.com/knative/serving/third_party/istio-0.6.0/LICENSE similarity index 99% rename from vendor/github.com/knative/serving/third_party/config/monitoring/elasticsearch/LICENSE rename to vendor/github.com/knative/serving/third_party/istio-0.6.0/LICENSE index 8dada3edaf5..2c45691e883 100644 --- a/vendor/github.com/knative/serving/third_party/config/monitoring/elasticsearch/LICENSE +++ b/vendor/github.com/knative/serving/third_party/istio-0.6.0/LICENSE @@ -1,4 +1,5 @@ - Apache License + + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -186,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright 2016 Istio Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From e28bb1bb62f2b794a6612f91e9e6dcf6507c63a9 Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Wed, 20 Jun 2018 18:19:46 -0400 Subject: [PATCH 3/3] Remove servingInformer from Controller interface --- cmd/controller/main.go | 2 +- pkg/controller/bind/controller.go | 2 -- pkg/controller/bus/controller.go | 2 -- pkg/controller/channel/controller.go | 5 ----- pkg/controller/controller.go | 3 +-- 5 files changed, 2 insertions(+), 12 deletions(-) diff --git a/cmd/controller/main.go b/cmd/controller/main.go index acdf1603307..d4ba762c0b8 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -95,7 +95,7 @@ func main() { controllers := make([]controller.Interface, 0, len(ctors)) for _, ctor := range ctors { controllers = append(controllers, - ctor(kubeClient, client, servingClient, kubeInformerFactory, informerFactory, servingInformerFactory)) + ctor(kubeClient, client, kubeInformerFactory, informerFactory, servingInformerFactory)) } go kubeInformerFactory.Start(stopCh) diff --git a/pkg/controller/bind/controller.go b/pkg/controller/bind/controller.go index 40cda1266eb..f0e1c84cd85 100644 --- a/pkg/controller/bind/controller.go +++ b/pkg/controller/bind/controller.go @@ -40,7 +40,6 @@ import ( "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" - servingclientset "github.com/knative/serving/pkg/client/clientset/versioned" servinginformers "github.com/knative/serving/pkg/client/informers/externalversions" servinglisters "github.com/knative/serving/pkg/client/listers/serving/v1alpha1" @@ -101,7 +100,6 @@ type Controller struct { func NewController( kubeclientset kubernetes.Interface, feedsclientset clientset.Interface, - servingclientset servingclientset.Interface, kubeInformerFactory kubeinformers.SharedInformerFactory, feedsInformerFactory informers.SharedInformerFactory, routeInformerFactory servinginformers.SharedInformerFactory) controller.Interface { diff --git a/pkg/controller/bus/controller.go b/pkg/controller/bus/controller.go index a2c6417b3bb..acde824c29b 100644 --- a/pkg/controller/bus/controller.go +++ b/pkg/controller/bus/controller.go @@ -48,7 +48,6 @@ import ( informers "github.com/knative/eventing/pkg/client/informers/externalversions" listers "github.com/knative/eventing/pkg/client/listers/channels/v1alpha1" - servingclientset "github.com/knative/serving/pkg/client/clientset/versioned" servinginformers "github.com/knative/serving/pkg/client/informers/externalversions" channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" @@ -104,7 +103,6 @@ type Controller struct { func NewController( kubeclientset kubernetes.Interface, busclientset clientset.Interface, - servingclientset servingclientset.Interface, kubeInformerFactory kubeinformers.SharedInformerFactory, busInformerFactory informers.SharedInformerFactory, routeInformerFactory servinginformers.SharedInformerFactory) controller.Interface { diff --git a/pkg/controller/channel/controller.go b/pkg/controller/channel/controller.go index c637485fbae..45eb39850ee 100644 --- a/pkg/controller/channel/controller.go +++ b/pkg/controller/channel/controller.go @@ -42,7 +42,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" - servingclientset "github.com/knative/serving/pkg/client/clientset/versioned" servinginformers "github.com/knative/serving/pkg/client/informers/externalversions" channelsv1alpha1 "github.com/knative/eventing/pkg/apis/channels/v1alpha1" @@ -75,8 +74,6 @@ const ( type Controller struct { // kubeclientset is a standard kubernetes clientset kubeclientset kubernetes.Interface - // knative service clientset - servingclientset servingclientset.Interface // channelclientset is a clientset for our own API group channelclientset clientset.Interface @@ -102,7 +99,6 @@ type Controller struct { func NewController( kubeclientset kubernetes.Interface, channelclientset clientset.Interface, - servingclientset servingclientset.Interface, kubeInformerFactory kubeinformers.SharedInformerFactory, channelInformerFactory informers.SharedInformerFactory, routeInformerFactory servinginformers.SharedInformerFactory) controller.Interface { @@ -125,7 +121,6 @@ func NewController( controller := &Controller{ kubeclientset: kubeclientset, channelclientset: channelclientset, - servingclientset: servingclientset, virtualservicesLister: virtualserviceInformer.Lister(), virtualservicesSynced: virtualserviceInformer.Informer().HasSynced, servicesLister: serviceInformer.Lister(), diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 5c5b69e4d61..febd6595601 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -20,7 +20,6 @@ import ( kubeinformers "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" - servingclientset "github.com/knative/serving/pkg/client/clientset/versioned" servinginformers "github.com/knative/serving/pkg/client/informers/externalversions" clientset "github.com/knative/eventing/pkg/client/clientset/versioned" @@ -31,4 +30,4 @@ type Interface interface { Run(threadiness int, stopCh <-chan struct{}) error } -type Constructor func(kubernetes.Interface, clientset.Interface, servingclientset.Interface, kubeinformers.SharedInformerFactory, informers.SharedInformerFactory, servinginformers.SharedInformerFactory) Interface +type Constructor func(kubernetes.Interface, clientset.Interface, kubeinformers.SharedInformerFactory, informers.SharedInformerFactory, servinginformers.SharedInformerFactory) Interface