Auto-update dependencies (#141)

Produced via:
  `dep ensure -update knative.dev/test-infra knative.dev/pkg`
/assign n3wscott
This commit is contained in:
Matt Moore 2019-11-27 07:50:22 -08:00 committed by Knative Prow Robot
parent e1d118d28c
commit 3feb9f69e8
97 changed files with 1895 additions and 4654 deletions

6
Gopkg.lock generated
View File

@ -933,7 +933,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:4835d8c504bc12fd7e44d97f9e6ab5e84e0384be0ffba1f264efc61043c733c5" digest = "1:02bb033254628cebfbb92810a742f7a60e51ec685c7e2987c04ff4b97e1de058"
name = "knative.dev/pkg" name = "knative.dev/pkg"
packages = [ packages = [
"apis", "apis",
@ -952,7 +952,7 @@
"metrics/metricskey", "metrics/metricskey",
] ]
pruneopts = "T" pruneopts = "T"
revision = "6305a6322febad96fdb4f0d879d0e2b34c8a79b1" revision = "06d6b25dd6e10d1c02f31ecb7d953d98481715cf"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -963,7 +963,7 @@
"tools/dep-collector", "tools/dep-collector",
] ]
pruneopts = "UT" pruneopts = "UT"
revision = "4aaba3b76d04d8bbb0b3289ec05df0ee6051fa52" revision = "2c4cd9df33c648a86d95bdd4119386cba04cde56"
[[projects]] [[projects]]
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c" digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"

37
vendor/knative.dev/pkg/Gopkg.lock generated vendored
View File

@ -139,15 +139,19 @@
version = "v1.7.0" version = "v1.7.0"
[[projects]] [[projects]]
digest = "1:a1b2a5e38f79688ee8250942d5fa960525fceb1024c855c7bc76fa77b0f3cca2" digest = "1:b38ab1b8cf42d089d9f31d4918c57c2dd47d42f3e7fc50e12142140228cf81a9"
name = "github.com/gogo/protobuf" name = "github.com/gogo/protobuf"
packages = [ packages = [
"gogoproto",
"jsonpb",
"proto", "proto",
"protoc-gen-gogo/descriptor",
"sortkeys", "sortkeys",
"types",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "ba06b47c162d49f2af050fb4c75bcbc86a159d5c" revision = "5628607bb4c51c3157aacc3a50f0ab707582b805"
version = "v1.2.1" version = "v1.3.1"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -856,6 +860,30 @@
revision = "f221b8435cfb71e54062f6c6e99e9ade30b124d5" revision = "f221b8435cfb71e54062f6c6e99e9ade30b124d5"
version = "v2.2.4" version = "v2.2.4"
[[projects]]
digest = "1:9579dd8b1ccd8cf54ed576af68438b69588cc136eac90b10aa7c8d1a1c8334ff"
name = "istio.io/api"
packages = ["networking/v1alpha3"]
pruneopts = "NUT"
revision = "35e06ef8d83858a2ccabd7a0d57128879b40a586"
version = "1.4.0-beta.5"
[[projects]]
digest = "1:a4549838d0466ee623b1aee6220d14978e5ddbd7a65bbf40185b63b26c645fbf"
name = "istio.io/client-go"
packages = ["pkg/apis/networking/v1alpha3"]
pruneopts = "NUT"
revision = "9bd0ba57c3d24745eac756d3df8411d969f94d34"
version = "1.4.0-beta.5"
[[projects]]
digest = "1:9c9f11af1b1f2ae03d897ba5de27103ec1c9c43605663ccdef67831d6a462a30"
name = "istio.io/gogo-genproto"
packages = ["googleapis/google/api"]
pruneopts = "NUT"
revision = "f7d19ec0141d49ac9efc83b5e61fa81ba103b445"
version = "1.4.0-beta.5"
[[projects]] [[projects]]
digest = "1:2b55f57d7b6d9f0f23478f2432b03273073f1bf93aed18620472e7117eb4451e" digest = "1:2b55f57d7b6d9f0f23478f2432b03273073f1bf93aed18620472e7117eb4451e"
name = "k8s.io/api" name = "k8s.io/api"
@ -1298,6 +1326,7 @@
"github.com/davecgh/go-spew/spew", "github.com/davecgh/go-spew/spew",
"github.com/evanphx/json-patch", "github.com/evanphx/json-patch",
"github.com/ghodss/yaml", "github.com/ghodss/yaml",
"github.com/gogo/protobuf/proto",
"github.com/golang/glog", "github.com/golang/glog",
"github.com/golang/protobuf/jsonpb", "github.com/golang/protobuf/jsonpb",
"github.com/golang/protobuf/proto", "github.com/golang/protobuf/proto",
@ -1342,6 +1371,8 @@
"google.golang.org/api/option", "google.golang.org/api/option",
"google.golang.org/grpc", "google.golang.org/grpc",
"gopkg.in/yaml.v2", "gopkg.in/yaml.v2",
"istio.io/api/networking/v1alpha3",
"istio.io/client-go/pkg/apis/networking/v1alpha3",
"k8s.io/api/admission/v1beta1", "k8s.io/api/admission/v1beta1",
"k8s.io/api/admissionregistration/v1beta1", "k8s.io/api/admissionregistration/v1beta1",
"k8s.io/api/apps/v1", "k8s.io/api/apps/v1",

View File

@ -13,6 +13,9 @@ required = [
"knative.dev/test-infra/scripts", "knative.dev/test-infra/scripts",
"knative.dev/test-infra/tools/dep-collector", "knative.dev/test-infra/tools/dep-collector",
"github.com/pkg/errors", "github.com/pkg/errors",
"github.com/gogo/protobuf/proto",
"istio.io/api/networking/v1alpha3",
"istio.io/client-go/pkg/apis/networking/v1alpha3",
] ]
[[constraint]] [[constraint]]
@ -35,6 +38,18 @@ required = [
name = "k8s.io/code-generator" name = "k8s.io/code-generator"
version = "kubernetes-1.15.3" version = "kubernetes-1.15.3"
[[constraint]]
name = "github.com/gogo/protobuf"
version = "v1.3.1"
[[constraint]]
name = "istio.io/api"
version = "1.4.0-beta.4"
[[constraint]]
name = "istio.io/client-go"
version = "1.4.0-beta.2"
[[override]] [[override]]
name = "gopkg.in/yaml.v2" name = "gopkg.in/yaml.v2"
version = "v2.2.4" version = "v2.2.4"

View File

@ -46,6 +46,12 @@ var _ InformerFactory = (*TypedInformerFactory)(nil)
// Get implements InformerFactory. // Get implements InformerFactory.
func (dif *TypedInformerFactory) Get(gvr schema.GroupVersionResource) (cache.SharedIndexInformer, cache.GenericLister, error) { func (dif *TypedInformerFactory) Get(gvr schema.GroupVersionResource) (cache.SharedIndexInformer, cache.GenericLister, error) {
// Avoid error cases, like the GVR does not exist.
// It is not a full check. Some RBACs might sneak by, but the window is very small.
if _, err := dif.Client.Resource(gvr).List(metav1.ListOptions{}); err != nil {
return nil, nil, err
}
listObj := dif.Type.GetListType() listObj := dif.Type.GetListType()
lw := &cache.ListWatch{ lw := &cache.ListWatch{
ListFunc: asStructuredLister(dif.Client.Resource(gvr).List, listObj), ListFunc: asStructuredLister(dif.Client.Resource(gvr).List, listObj),

View File

@ -18,16 +18,49 @@ package duck
import ( import (
"encoding/json" "encoding/json"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"knative.dev/pkg/kmeta"
) )
// Marshallable is implementated by the Unstructured K8s types. // OneOfOurs is the union of our Accessor interface and the OwnerRefable interface
type Marshalable interface { // that is implemented by our resources that implement the kmeta.Accessor.
MarshalJSON() ([]byte, error) type OneOfOurs interface {
kmeta.Accessor
kmeta.OwnerRefable
}
// ToUnstructured takes an instance of a OneOfOurs compatible type and
// converts it to unstructured.Unstructured. We take OneOfOurs in place
// or runtime.Object because sometimes we get resources that do not have their
// TypeMeta populated but that is required for unstructured.Unstructured to
// deserialize things, so we leverage our content-agnostic GroupVersionKind()
// method to populate this as-needed (in a copy, so that we don't modify the
// informer's copy, if that is what we are passed).
func ToUnstructured(desired OneOfOurs) (*unstructured.Unstructured, error) {
// If the TypeMeta is not populated, then unmarshalling will fail, so ensure
// the TypeMeta is populated. See also EnsureTypeMeta.
if gvk := desired.GroupVersionKind(); gvk.Version == "" || gvk.Kind == "" {
gvk = desired.GetGroupVersionKind()
desired = desired.DeepCopyObject().(OneOfOurs)
desired.SetGroupVersionKind(gvk)
}
// Convert desired to unstructured.Unstructured
b, err := json.Marshal(desired)
if err != nil {
return nil, err
}
ud := &unstructured.Unstructured{}
if err := json.Unmarshal(b, ud); err != nil {
return nil, err
}
return ud, nil
} }
// FromUnstructured takes unstructured object from (say from client-go/dynamic) and // FromUnstructured takes unstructured object from (say from client-go/dynamic) and
// converts it into our duck types. // converts it into our duck types.
func FromUnstructured(obj Marshalable, target interface{}) error { func FromUnstructured(obj json.Marshaler, target interface{}) error {
// Use the unstructured marshaller to ensure it's proper JSON // Use the unstructured marshaller to ensure it's proper JSON
raw, err := obj.MarshalJSON() raw, err := obj.MarshalJSON()
if err != nil { if err != nil {

View File

@ -1,21 +0,0 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package authentication
const (
GroupName = "authentication.istio.io"
)

View File

@ -1,22 +0,0 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Api versions allow the api contract for a resource to be changed while keeping
// backward compatibility by support multiple concurrent versions
// of the same resource
// +k8s:deepcopy-gen=package
// +groupName=authentication.istio.io
package v1alpha1

View File

@ -1,345 +0,0 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis/istio/common/v1alpha1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// VirtualService
type Policy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec PolicySpec `json:"spec"`
}
// Policy defines what authentication methods can be accepted on workload(s),
// and if authenticated, which method/certificate will set the request principal
// (i.e request.auth.principal attribute).
//
// Authentication policy is composed of 2-part authentication:
// - peer: verify caller service credentials. This part will set source.user
// (peer identity).
// - origin: verify the origin credentials. This part will set request.auth.user
// (origin identity), as well as other attributes like request.auth.presenter,
// request.auth.audiences and raw claims. Note that the identity could be
// end-user, service account, device etc.
//
// Last but not least, the principal binding rule defines which identity (peer
// or origin) should be used as principal. By default, it uses peer.
//
// Examples:
//
// Policy to enable mTLS for all services in namespace frod
//
// apiVersion: authentication.istio.io/v1alpha1
// kind: Policy
// metadata:
// name: mTLS_enable
// namespace: frod
// spec:
// peers:
// - mtls:
//
// Policy to disable mTLS for "productpage" service
//
// apiVersion: authentication.istio.io/v1alpha1
// kind: Policy
// metadata:
// name: mTLS_disable
// namespace: frod
// spec:
// targets:
// - name: productpage
//
// Policy to require mTLS for peer authentication, and JWT for origin authenticationn
// for productpage:9000. Principal is set from origin identity.
//
// apiVersion: authentication.istio.io/v1alpha1
// kind: Policy
// metadata:
// name: mTLS_enable
// namespace: frod
// spec:
// target:
// - name: productpage
// ports:
// - number: 9000
// peers:
// - mtls:
// origins:
// - jwt:
// issuer: "https://securetoken.google.com"
// audiences:
// - "productpage"
// jwksUri: "https://www.googleapis.com/oauth2/v1/certs"
// jwt_headers:
// - "x-goog-iap-jwt-assertion"
// principaBinding: USE_ORIGIN
//
// Policy to require mTLS for peer authentication, and JWT for origin authenticationn
// for productpage:9000, but allow origin authentication failed. Principal is set
// from origin identity.
// Note: this example can be used for use cases when we want to allow request from
// certain peers, given it comes with an approperiate authorization poicy to check
// and reject request accoridingly.
//
// apiVersion: authentication.istio.io/v1alpha1
// kind: Policy
// metadata:
// name: mTLS_enable
// namespace: frod
// spec:
// target:
// - name: productpage
// ports:
// - number: 9000
// peers:
// - mtls:
// origins:
// - jwt:
// issuer: "https://securetoken.google.com"
// audiences:
// - "productpage"
// jwksUri: "https://www.googleapis.com/oauth2/v1/certs"
// jwt_headers:
// - "x-goog-iap-jwt-assertion"
// originIsOptional: true
// principalBinding: USE_ORIGIN
type PolicySpec struct {
// List rules to select destinations that the policy should be applied on.
// If empty, policy will be used on all destinations in the same namespace.
Targets []TargetSelector `json:"targets,omitempty"`
// List of authentication methods that can be used for peer authentication.
// They will be evaluated in order; the first validate one will be used to
// set peer identity (source.user) and other peer attributes. If none of
// these methods pass, and peer_is_optional flag is false (see below),
// request will be rejected with authentication failed error (401).
// Leave the list empty if peer authentication is not required
Peers []PeerAuthenticationMethod `json:"peers,omitempty"`
// Set this flag to true to accept request (for peer authentication perspective),
// even when none of the peer authentication methods defined above satisfied.
// Typically, this is used to delay the rejection decision to next layer (e.g
// authorization).
// This flag is ignored if no authentication defined for peer (peers field is empty).
PeerIsOptional bool `json:"peerIsOptional,omitempty"`
// List of authentication methods that can be used for origin authentication.
// Similar to peers, these will be evaluated in order; the first validate one
// will be used to set origin identity and attributes (i.e request.auth.user,
// request.auth.issuer etc). If none of these methods pass, and origin_is_optional
// is false (see below), request will be rejected with authentication failed
// error (401).
// Leave the list empty if origin authentication is not required.
Origins []OriginAuthenticationMethod `json:"origins,omitempty"`
// Set this flag to true to accept request (for origin authentication perspective),
// even when none of the origin authentication methods defined above satisfied.
// Typically, this is used to delay the rejection decision to next layer (e.g
// authorization).
// This flag is ignored if no authentication defined for origin (origins field is empty).
OriginIsOptional bool `json:"originIsOptional,omitempty"`
// Define whether peer or origin identity should be use for principal. Default
// value is USE_PEER.
// If peer (or origin) identity is not available, either because of peer/origin
// authentication is not defined, or failed, principal will be left unset.
// In other words, binding rule does not affect the decision to accept or
// reject request.
PrincipalBinding PrincipalBinding `json:"principalBinding,omitempty"`
}
// TargetSelector defines a matching rule to a service/destination.
type TargetSelector struct {
// REQUIRED. The name must be a short name from the service registry. The
// fully qualified domain name will be resolved in a platform specific manner.
Name string `json:"name"`
// Specifies the ports on the destination. Leave empty to match all ports
// that are exposed.
Ports []PortSelector `json:"ports,omitempty"`
}
// PortSelector specifies the name or number of a port to be used for
// matching targets for authenticationn policy. This is copied from
// networking API to avoid dependency.
type PortSelector struct {
// It is required to specify exactly one of the fields:
// Number or Name
// Valid port number
Number uint32 `json:"number,omitempty"`
// Port name
Name string `json:"name,omitempty"`
}
// PeerAuthenticationMethod defines one particular type of authentication, e.g
// mutual TLS, JWT etc, (no authentication is one type by itself) that can
// be used for peer authentication.
// The type can be progammatically determine by checking the type of the
// "params" field.
type PeerAuthenticationMethod struct {
// It is required to specify exactly one of the fields:
// Mtls or Jwt
// Set if mTLS is used.
Mtls *MutualTLS `json:"mtls,omitempty"`
// Set if JWT is used. This option is not yet available.
Jwt *Jwt `json:"jwt,omitempty"`
}
// Defines the acceptable connection TLS mode.
type Mode string
const (
// Client cert must be presented, connection is in TLS.
ModeStrict Mode = "STRICT"
// Connection can be either plaintext or TLS, and client cert can be omitted.
ModePermissive Mode = "PERMISSIVE"
)
// TLS authentication params.
type MutualTLS struct {
// WILL BE DEPRECATED, if set, will translates to `TLS_PERMISSIVE` mode.
// Set this flag to true to allow regular TLS (i.e without client x509
// certificate). If request carries client certificate, identity will be
// extracted and used (set to peer identity). Otherwise, peer identity will
// be left unset.
// When the flag is false (default), request must have client certificate.
AllowTLS bool `json:"allowTls,omitempty"`
// Defines the mode of mTLS authentication.
Mode Mode `json:"mode,omitempty"`
}
// JSON Web Token (JWT) token format for authentication as defined by
// https://tools.ietf.org/html/rfc7519. See [OAuth
// 2.0](https://tools.ietf.org/html/rfc6749) and [OIDC
// 1.0](http://openid.net/connect) for how this is used in the whole
// authentication flow.
//
// Example,
//
// issuer: https://example.com
// audiences:
// - bookstore_android.apps.googleusercontent.com
// bookstore_web.apps.googleusercontent.com
// jwksUri: https://example.com/.well-known/jwks.json
//
type Jwt struct {
// Identifies the issuer that issued the JWT. See
// [issuer](https://tools.ietf.org/html/rfc7519#section-4.1.1)
// Usually a URL or an email address.
//
// Example: https://securetoken.google.com
// Example: 1234567-compute@developer.gserviceaccount.com
Issuer string `json:"issuer,omitempty"`
// The list of JWT
// [audiences](https://tools.ietf.org/html/rfc7519#section-4.1.3).
// that are allowed to access. A JWT containing any of these
// audiences will be accepted.
//
// The service name will be accepted if audiences is empty.
//
// Example:
//
// ```yaml
// audiences:
// - bookstore_android.apps.googleusercontent.com
// bookstore_web.apps.googleusercontent.com
// ```
Audiences []string `json:"audiences,omitempty"`
// URL of the provider's public key set to validate signature of the
// JWT. See [OpenID
// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
//
// Optional if the key set document can either (a) be retrieved from
// [OpenID
// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html) of
// the issuer or (b) inferred from the email domain of the issuer (e.g. a
// Google service account).
//
// Example: https://www.googleapis.com/oauth2/v1/certs
JwksURI string `json:"jwksUri,omitempty"`
// Two fields below define where to extract the JWT from an HTTP request.
//
// If no explicit location is specified the following default
// locations are tried in order:
//
// 1) The Authorization header using the Bearer schema,
// e.g. Authorization: Bearer <token>. (see
// [Authorization Request Header
// Field](https://tools.ietf.org/html/rfc6750#section-2.1))
//
// 2) `access_token` query parameter (see
// [URI Query Parameter](https://tools.ietf.org/html/rfc6750#section-2.3))
// JWT is sent in a request header. `header` represents the
// header name.
//
// For example, if `header=x-goog-iap-jwt-assertion`, the header
// format will be x-goog-iap-jwt-assertion: <JWT>.
JwtHeaders []string `json:"jwtHeaders,omitempty"`
// JWT is sent in a query parameter. `query` represents the
// query parameter name.
//
// For example, `query=jwt_token`.
JwtParams []string `json:"jwtParams,omitempty"`
// URL paths that should be excluded from the JWT validation. If the request path is matched,
// the JWT validation will be skipped and the request will proceed regardless.
// This is useful to keep a couple of URLs public for external health checks.
// Example: "/health_check", "/status/cpu_usage".
ExcludedPaths []v1alpha1.StringMatch `json:"excludedPaths,omitempty"`
}
// OriginAuthenticationMethod defines authentication method/params for origin
// authentication. Origin could be end-user, device, delegate service etc.
// Currently, only JWT is supported for origin authentication.
type OriginAuthenticationMethod struct {
// Jwt params for the method.
Jwt *Jwt `json:"jwt,omitempty"`
}
// Associates authentication with request principal.
type PrincipalBinding string
const (
// Principal will be set to the identity from peer authentication.
PrincipalBindingUserPeer PrincipalBinding = "USE_PEER"
// Principal will be set to the identity from peer authentication.
PrincipalBindingUserOrigin PrincipalBinding = "USE_ORIGIN"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PolicyLIst is a list of Policy resources
type PolicyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []Policy `json:"items"`
}

View File

@ -1,52 +0,0 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"knative.dev/pkg/apis/istio/authentication"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: authentication.GroupName, Version: "v1alpha1"}
// 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,
&Policy{},
&PolicyList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

View File

@ -1,259 +0,0 @@
// +build !ignore_autogenerated
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1alpha1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
commonv1alpha1 "knative.dev/pkg/apis/istio/common/v1alpha1"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Jwt) DeepCopyInto(out *Jwt) {
*out = *in
if in.Audiences != nil {
in, out := &in.Audiences, &out.Audiences
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.JwtHeaders != nil {
in, out := &in.JwtHeaders, &out.JwtHeaders
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.JwtParams != nil {
in, out := &in.JwtParams, &out.JwtParams
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.ExcludedPaths != nil {
in, out := &in.ExcludedPaths, &out.ExcludedPaths
*out = make([]commonv1alpha1.StringMatch, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Jwt.
func (in *Jwt) DeepCopy() *Jwt {
if in == nil {
return nil
}
out := new(Jwt)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MutualTLS) DeepCopyInto(out *MutualTLS) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutualTLS.
func (in *MutualTLS) DeepCopy() *MutualTLS {
if in == nil {
return nil
}
out := new(MutualTLS)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OriginAuthenticationMethod) DeepCopyInto(out *OriginAuthenticationMethod) {
*out = *in
if in.Jwt != nil {
in, out := &in.Jwt, &out.Jwt
*out = new(Jwt)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OriginAuthenticationMethod.
func (in *OriginAuthenticationMethod) DeepCopy() *OriginAuthenticationMethod {
if in == nil {
return nil
}
out := new(OriginAuthenticationMethod)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PeerAuthenticationMethod) DeepCopyInto(out *PeerAuthenticationMethod) {
*out = *in
if in.Mtls != nil {
in, out := &in.Mtls, &out.Mtls
*out = new(MutualTLS)
**out = **in
}
if in.Jwt != nil {
in, out := &in.Jwt, &out.Jwt
*out = new(Jwt)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PeerAuthenticationMethod.
func (in *PeerAuthenticationMethod) DeepCopy() *PeerAuthenticationMethod {
if in == nil {
return nil
}
out := new(PeerAuthenticationMethod)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Policy) DeepCopyInto(out *Policy) {
*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 Policy.
func (in *Policy) DeepCopy() *Policy {
if in == nil {
return nil
}
out := new(Policy)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Policy) 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 *PolicyList) DeepCopyInto(out *PolicyList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Policy, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyList.
func (in *PolicyList) DeepCopy() *PolicyList {
if in == nil {
return nil
}
out := new(PolicyList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PolicyList) 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 *PolicySpec) DeepCopyInto(out *PolicySpec) {
*out = *in
if in.Targets != nil {
in, out := &in.Targets, &out.Targets
*out = make([]TargetSelector, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Peers != nil {
in, out := &in.Peers, &out.Peers
*out = make([]PeerAuthenticationMethod, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Origins != nil {
in, out := &in.Origins, &out.Origins
*out = make([]OriginAuthenticationMethod, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicySpec.
func (in *PolicySpec) DeepCopy() *PolicySpec {
if in == nil {
return nil
}
out := new(PolicySpec)
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 *TargetSelector) DeepCopyInto(out *TargetSelector) {
*out = *in
if in.Ports != nil {
in, out := &in.Ports, &out.Ports
*out = make([]PortSelector, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetSelector.
func (in *TargetSelector) DeepCopy() *TargetSelector {
if in == nil {
return nil
}
out := new(TargetSelector)
in.DeepCopyInto(out)
return out
}

View File

@ -1,35 +0,0 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
// 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"`
// suffix-based match.
Suffix string `json:"suffix,omitempty"`
// ECMAscript style regex-based match
Regex string `json:"regex,omitempty"`
}

View File

@ -1,21 +0,0 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package istio
const (
GroupName = "networking.istio.io"
)

View File

@ -1,17 +0,0 @@
# What are these files?
These are Go structs for Istio CRD. We translated them from proto files in
https://github.com/istio/api/tree/master/networking/v1alpha3 .
# Why do we hand-translate from proto? i.e Why can't we vendor these?
Istio needs to run on many platforms and as a reason they represent their
objects internally as proto. On Kubernetes, their API take in JSON objects and
convert to proto before processing them.
So they have nothing we can vendor, except for the Go files that are generated
by the proto compiler, which is not compatible with K8s API code-generator at
all.
We may be able to donate our translation so they can maintain it themselves. See
https://github.com/istio/istio/issues/6084.

View File

@ -1,566 +0,0 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha3
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// DestinationRule
type DestinationRule struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DestinationRuleSpec `json:"spec"`
}
// DestinationRule defines policies that apply to traffic intended for a
// service after routing has occurred. These rules specify configuration
// for load balancing, connection pool size from the sidecar, and outlier
// detection settings to detect and evict unhealthy hosts from the load
// balancing pool. For example, a simple load balancing policy for the
// ratings service would look as follows:
//
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: bookinfo-ratings
// spec:
// host: ratings.prod.svc.cluster.local
// trafficPolicy:
// loadBalancer:
// simple: LEAST_CONN
//
//
// Version specific policies can be specified by defining a named
// subset and overriding the settings specified at the service level. The
// following rule uses a round robin load balancing policy for all traffic
// going to a subset named testversion that is composed of endpoints (e.g.,
// pods) with labels (version:v3).
//
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: bookinfo-ratings
// spec:
// host: ratings.prod.svc.cluster.local
// trafficPolicy:
// loadBalancer:
// simple: LEAST_CONN
// subsets:
// - name: testversion
// labels:
// version: v3
// trafficPolicy:
// loadBalancer:
// simple: ROUND_ROBIN
//
//
// **Note:** Policies specified for subsets will not take effect until
// a route rule explicitly sends traffic to this subset.
//
// Traffic policies can be customized to specific ports as well. The
// following rule uses the least connection load balancing policy for all
// traffic to port 80, while uses a round robin load balancing setting for
// traffic to the port 9080.
//
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: bookinfo-ratings-port
// spec:
// host: ratings.prod.svc.cluster.local
// trafficPolicy: # Apply to all ports
// portLevelSettings:
// - port:
// number: 80
// loadBalancer:
// simple: LEAST_CONN
// - port:
// number: 9080
// loadBalancer:
// simple: ROUND_ROBIN
//
type DestinationRuleSpec 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 [ServiceEntries](#ServiceEntry). Rules defined for
// services that do not exist in the service registry will be ignored.
//
// *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._
//
// Note that the host field applies to both HTTP and TCP services.
Host string `json:"host"`
// Traffic policies to apply (load balancing policy, connection pool
// sizes, outlier detection).
TrafficPolicy *TrafficPolicy `json:"trafficPolicy,omitempty"`
// One or more named sets that represent individual versions of a
// service. Traffic policies can be overridden at subset level.
Subsets []Subset `json:"subsets,omitempty"`
// A list of namespaces to which this destination rule is exported.
// The resolution of a destination rule to apply to a service occurs in the
// context of a hierarchy of namespaces. Exporting a destination rule allows
// it to be included in the resolution hierarchy for services in
// other namespaces. This feature provides a mechanism for service owners
// and mesh administrators to control the visibility of destination rules
// across namespace boundaries.
//
// If no namespaces are specified then the destination rule is exported to all
// namespaces by default.
//
// The value "." is reserved and defines an export to the same namespace that
// the destination rule is declared in. Similarly, the value "*" is reserved and
// defines an export to all namespaces.
//
// NOTE: in the current release, the `exportTo` value is restricted to
// "." or "*" (i.e., the current namespace or all namespaces).
ExportTo []string `json:"exportTo,omitempty"`
}
// Traffic policies to apply for a specific destination, across all
// destination ports. See DestinationRule for examples.
type TrafficPolicy struct {
// Settings controlling the load balancer algorithms.
LoadBalancer *LoadBalancerSettings `json:"loadBalancer,omitempty"`
// Settings controlling the volume of connections to an upstream service
ConnectionPool *ConnectionPoolSettings `json:"connectionPool,omitempty"`
// Settings controlling eviction of unhealthy hosts from the load balancing pool
OutlierDetection *OutlierDetection `json:"outlierDetection,omitempty"`
// TLS related settings for connections to the upstream service.
TLS *TLSSettings `json:"tls,omitempty"`
// Traffic policies specific to individual ports. Note that port level
// settings will override the destination-level settings. Traffic
// settings specified at the destination-level will not be inherited when
// overridden by port-level settings, i.e. default values will be applied
// to fields omitted in port-level traffic policies.
PortLevelSettings []PortTrafficPolicy `json:"portLevelSettings,omitempty"`
}
// Traffic policies that apply to specific ports of the service
type PortTrafficPolicy struct {
// Specifies the port name or number of a port on the destination service
// on which this policy is being applied.
//
// Names must comply with DNS label syntax (rfc1035) and therefore cannot
// collide with numbers. If there are multiple ports on a service with
// the same protocol the names should be of the form <protocol-name>-<DNS
// label>.
Port PortSelector `json:"port"`
// Settings controlling the load balancer algorithms.
LoadBalancer *LoadBalancerSettings `json:"loadBalancer,omitempty"`
// Settings controlling the volume of connections to an upstream service
ConnectionPool *ConnectionPoolSettings `json:"connectionPool,omitempty"`
// Settings controlling eviction of unhealthy hosts from the load balancing pool
OutlierDetection *OutlierDetection `json:"outlierDetection,omitempty"`
// TLS related settings for connections to the upstream service.
TLS *TLSSettings `json:"tls,omitempty"`
}
// A subset of endpoints of a service. Subsets can be used for scenarios
// like A/B testing, or routing to a specific version of a service. Refer
// to [VirtualService](#VirtualService) documentation for examples of using
// subsets in these scenarios. In addition, traffic policies defined at the
// service-level can be overridden at a subset-level. The following rule
// uses a round robin load balancing policy for all traffic going to a
// subset named testversion that is composed of endpoints (e.g., pods) with
// labels (version:v3).
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: bookinfo-ratings
// spec:
// host: ratings.prod.svc.cluster.local
// trafficPolicy:
// loadBalancer:
// simple: LEAST_CONN
// subsets:
// - name: testversion
// labels:
// version: v3
// trafficPolicy:
// loadBalancer:
// simple: ROUND_ROBIN
//
// **Note:** Policies specified for subsets will not take effect until
// a route rule explicitly sends traffic to this subset.
type Subset struct {
// REQUIRED. Name of the subset. The service name and the subset name can
// be used for traffic splitting in a route rule.
Name string `json:"name"`
// REQUIRED. Labels apply a filter over the endpoints of a service in the
// service registry. See route rules for examples of usage.
Labels map[string]string `json:"labels"`
// Traffic policies that apply to this subset. Subsets inherit the
// traffic policies specified at the DestinationRule level. Settings
// specified at the subset level will override the corresponding settings
// specified at the DestinationRule level.
TrafficPolicy *TrafficPolicy `json:"trafficPolicy,omitempty"`
}
// Load balancing policies to apply for a specific destination. See Envoy's
// load balancing
// [documentation](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/load_balancing.html)
// for more details.
//
// For example, the following rule uses a round robin load balancing policy
// for all traffic going to the ratings service.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: bookinfo-ratings
// spec:
// host: ratings.prod.svc.cluster.local
// trafficPolicy:
// loadBalancer:
// simple: ROUND_ROBIN
//
// The following example sets up sticky sessions for the ratings service
// hashing-based load balancer for the same ratings service using the
// the User cookie as the hash key.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: bookinfo-ratings
// spec:
// host: ratings.prod.svc.cluster.local
// trafficPolicy:
// loadBalancer:
// consistentHash:
// httpCookie:
// name: user
// ttl: 0s
type LoadBalancerSettings struct {
// It is required to specify exactly one of the fields:
// Simple or ConsistentHash
Simple SimpleLB `json:"simple,omitempty"`
ConsistentHash *ConsistentHashLB `json:"consistentHash,omitempty"`
}
// Standard load balancing algorithms that require no tuning.
type SimpleLB string
const (
// Round Robin policy. Default
SimpleLBRoundRobin SimpleLB = "ROUND_ROBIN"
// The least request load balancer uses an O(1) algorithm which selects
// two random healthy hosts and picks the host which has fewer active
// requests.
SimpleLBLeastConn SimpleLB = "LEAST_CONN"
// The random load balancer selects a random healthy host. The random
// load balancer generally performs better than round robin if no health
// checking policy is configured.
SimpleLBRandom SimpleLB = "RANDOM"
// This option will forward the connection to the original IP address
// requested by the caller without doing any form of load
// balancing. This option must be used with care. It is meant for
// advanced use cases. Refer to Original Destination load balancer in
// Envoy for further details.
SimpleLBPassthrough SimpleLB = "PASSTHROUGH"
)
// Consistent Hash-based load balancing can be used to provide soft
// session affinity based on HTTP headers, cookies or other
// properties. This load balancing policy is applicable only for HTTP
// connections. The affinity to a particular destination host will be
// lost when one or more hosts are added/removed from the destination
// service.
type ConsistentHashLB struct {
// It is required to specify exactly one of the fields as hash key:
// HTTPHeaderName, HTTPCookie, or UseSourceIP.
// Hash based on a specific HTTP header.
HTTPHeaderName string `json:"httpHeaderName,omitempty"`
// Hash based on HTTP cookie.
HTTPCookie *HTTPCookie `json:"httpCookie,omitempty"`
// Hash based on the source IP address.
UseSourceIP bool `json:"useSourceIp,omitempty"`
// The minimum number of virtual nodes to use for the hash
// ring. Defaults to 1024. Larger ring sizes result in more granular
// load distributions. If the number of hosts in the load balancing
// pool is larger than the ring size, each host will be assigned a
// single virtual node.
MinimumRingSize uint64 `json:"minimumRingSize,omitempty"`
}
// Describes a HTTP cookie that will be used as the hash key for the
// Consistent Hash load balancer. If the cookie is not present, it will
// be generated.
type HTTPCookie struct {
// REQUIRED. Name of the cookie.
Name string `json:"name"`
// Path to set for the cookie.
Path string `json:"path,omitempty"`
// REQUIRED. Lifetime of the cookie.
TTL string `json:"ttl"`
}
// Connection pool settings for an upstream host. The settings apply to
// each individual host in the upstream service. See Envoy's [circuit
// breaker](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/circuit_breaking)
// for more details. Connection pool settings can be applied at the TCP
// level as well as at HTTP level.
//
// For example, the following rule sets a limit of 100 connections to redis
// service called myredissrv with a connect timeout of 30ms
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: bookinfo-redis
// spec:
// host: myredissrv.prod.svc.cluster.local
// trafficPolicy:
// connectionPool:
// tcp:
// maxConnections: 100
// connectTimeout: 30ms
type ConnectionPoolSettings struct {
// Settings common to both HTTP and TCP upstream connections.
TCP *TCPSettings `json:"tcp,omitempty"`
// HTTP connection pool settings.
HTTP *HTTPSettings `json:"http,omitempty"`
}
// Settings common to both HTTP and TCP upstream connections.
type TCPSettings struct {
// Maximum number of HTTP1 /TCP connections to a destination host.
MaxConnections int32 `json:"maxConnections,omitempty"`
// TCP connection timeout.
ConnectTimeout string `json:"connectTimeout,omitempty"`
}
// Settings applicable to HTTP1.1/HTTP2/GRPC connections.
type HTTPSettings struct {
// Maximum number of pending HTTP requests to a destination. Default 1024.
HTTP1MaxPendingRequests int32 `json:"http1MaxPendingRequests,omitempty"`
// Maximum number of requests to a backend. Default 1024.
HTTP2MaxRequests int32 `json:"http2MaxRequests,omitempty"`
// Maximum number of requests per connection to a backend. Setting this
// parameter to 1 disables keep alive.
MaxRequestsPerConnection int32 `json:"maxRequestsPerConnection,omitempty"`
// Maximum number of retries that can be outstanding to all hosts in a
// cluster at a given time. Defaults to 3.
MaxRetries int32 `json:"maxRetries,omitempty"`
}
// A Circuit breaker implementation that tracks the status of each
// individual host in the upstream service. Applicable to both HTTP and
// TCP services. For HTTP services, hosts that continually return 5xx
// errors for API calls are ejected from the pool for a pre-defined period
// of time. For TCP services, connection timeouts or connection
// failures to a given host counts as an error when measuring the
// consecutive errors metric. See Envoy's [outlier
// detection](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/outlier)
// for more details.
//
// The following rule sets a connection pool size of 100 connections and
// 1000 concurrent HTTP2 requests, with no more than 10 req/connection to
// "reviews" service. In addition, it configures upstream hosts to be
// scanned every 5 mins, such that any host that fails 7 consecutive times
// with 5XX error code will be ejected for 15 minutes.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: reviews-cb-policy
// spec:
// host: reviews.prod.svc.cluster.local
// trafficPolicy:
// connectionPool:
// tcp:
// maxConnections: 100
// http:
// http2MaxRequests: 1000
// maxRequestsPerConnection: 10
// outlierDetection:
// consecutiveErrors: 7
// interval: 5m
// baseEjectionTime: 15m
type OutlierDetection struct {
// Number of errors before a host is ejected from the connection
// pool. Defaults to 5. When the upstream host is accessed over HTTP, a
// 5xx return code qualifies as an error. When the upstream host is
// accessed over an opaque TCP connection, connect timeouts and
// connection error/failure events qualify as an error.
ConsecutiveErrors int32 `json:"consecutiveErrors,omitempty"`
// Time interval between ejection sweep analysis. format:
// 1h/1m/1s/1ms. MUST BE >=1ms. Default is 10s.
Interval string `json:"interval,omitempty"`
// Minimum ejection duration. A host will remain ejected for a period
// equal to the product of minimum ejection duration and the number of
// times the host has been ejected. This technique allows the system to
// automatically increase the ejection period for unhealthy upstream
// servers. format: 1h/1m/1s/1ms. MUST BE >=1ms. Default is 30s.
BaseEjectionTime string `json:"baseEjectionTime,omitempty"`
// Maximum % of hosts in the load balancing pool for the upstream
// service that can be ejected. Defaults to 10%.
MaxEjectionPercent int32 `json:"maxEjectionPercent,omitempty"`
}
// SSL/TLS related settings for upstream connections. See Envoy's [TLS
// context](https://www.envoyproxy.io/docs/envoy/latest/api-v1/cluster_manager/cluster_ssl.html#config-cluster-manager-cluster-ssl)
// for more details. These settings are common to both HTTP and TCP upstreams.
//
// For example, the following rule configures a client to use mutual TLS
// for connections to upstream database cluster.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: db-mtls
// spec:
// host: mydbserver.prod.svc.cluster.local
// trafficPolicy:
// tls:
// mode: MUTUAL
// clientCertificate: /etc/certs/myclientcert.pem
// privateKey: /etc/certs/client_private_key.pem
// caCertificates: /etc/certs/rootcacerts.pem
//
// The following rule configures a client to use TLS when talking to a
// foreign service whose domain matches *.foo.com.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: tls-foo
// spec:
// host: "*.foo.com"
// trafficPolicy:
// tls:
// mode: SIMPLE
//
// The following rule configures a client to use Istio mutual TLS when talking
// to rating services.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: ratings-istio-mtls
// spec:
// host: ratings.prod.svc.cluster.local
// trafficPolicy:
// tls:
// mode: ISTIO_MUTUAL
type TLSSettings struct {
// REQUIRED: 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"`
// REQUIRED if mode is `MUTUAL`. The path to the file holding the
// client-side TLS certificate to use.
// Should be empty if mode is `ISTIO_MUTUAL`.
ClientCertificate string `json:"clientCertificate,omitempty"`
// REQUIRED if mode is `MUTUAL`. The path to the file holding the
// client's private key.
// Should be empty if mode is `ISTIO_MUTUAL`.
PrivateKey string `json:"privateKey,omitempty"`
// OPTIONAL: The path to the file containing certificate authority
// certificates to use in verifying a presented server certificate. If
// omitted, the proxy will not verify the server's certificate.
// Should be empty if mode is `ISTIO_MUTUAL`.
CaCertificates string `json:"caCertificates,omitempty"`
// A list of alternate names to verify the subject identity in the
// certificate. If specified, the proxy will verify that the server
// certificate's subject alt name matches one of the specified values.
// Should be empty if mode is `ISTIO_MUTUAL`.
SubjectAltNames []string `json:"subjectAltNames,omitempty"`
// SNI string to present to the server during TLS handshake.
// Should be empty if mode is `ISTIO_MUTUAL`.
Sni string `json:"sni,omitempty"`
}
// TLS connection mode
type TLSmode string
const (
// Do not setup a TLS connection to the upstream endpoint.
TLSmodeDisable TLSmode = "DISABLE"
// Originate a TLS connection to the upstream endpoint.
TLSmodeSimple TLSmode = "SIMPLE"
// Secure connections to the upstream using mutual TLS by presenting
// client certificates for authentication.
TLSmodeMutual TLSmode = "MUTUAL"
// Secure connections to the upstream using mutual TLS by presenting
// client certificates for authentication.
// Compared to Mutual mode, this mode uses certificates generated
// automatically by Istio for mTLS authentication. When this mode is
// used, all other fields in `TLSSettings` should be empty.
TLSmodeIstioMutual TLSmode = "ISTIO_MUTUAL"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// DestinationRuleList is a list of DestinationRule resources
type DestinationRuleList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []DestinationRule `json:"items"`
}

View File

@ -1,23 +0,0 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Api versions allow the api contract for a resource to be changed while keeping
// backward compatibility by support multiple concurrent versions
// of the same resource
// +k8s:deepcopy-gen=package
// +groupName=networking.istio.io
package v1alpha3

View File

@ -1,336 +0,0 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha3
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Gateway describes a load balancer operating at the edge of the mesh
// receiving incoming or outgoing HTTP/TCP connections. The specification
// describes a set of ports that should be exposed, the type of protocol to
// use, SNI configuration for the load balancer, etc.
//
// For example, the following gateway spec sets up a proxy to act as a load
// balancer exposing port 80 and 9080 (http), 443 (https), and port 2379
// (TCP) for ingress. The gateway will be applied to the proxy running on
// a pod with labels "app: my-gateway-controller". While Istio will configure the
// proxy to listen on these ports, it is the responsibility of the user to
// ensure that external traffic to these ports are allowed into the mesh.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: Gateway
// metadata:
// name: my-gateway
// spec:
// selector:
// app: my-gatweway-controller
// servers:
// - port:
// number: 80
// name: http
// protocol: HTTP
// hosts:
// - uk.bookinfo.com
// - eu.bookinfo.com
// tls:
// httpsRedirect: true # sends 302 redirect for http requests
// - port:
// number: 443
// name: https
// protocol: HTTPS
// hosts:
// - uk.bookinfo.com
// - eu.bookinfo.com
// tls:
// mode: SIMPLE #enables HTTPS on this port
// serverCertificate: /etc/certs/servercert.pem
// privateKey: /etc/certs/privatekey.pem
// - port:
// number: 9080
// name: http-wildcard
// protocol: HTTP
// # no hosts implies wildcard match
// - port:
// number: 2379 #to expose internal service via external port 2379
// name: mongo
// protocol: MONGO
//
// The gateway specification above describes the L4-L6 properties of a load
// balancer. A VirtualService can then be bound to a gateway to control
// the forwarding of traffic arriving at a particular host or gateway port.
//
// For example, the following VirtualService splits traffic for
// https://uk.bookinfo.com/reviews, https://eu.bookinfo.com/reviews,
// http://uk.bookinfo.com:9080/reviews, http://eu.bookinfo.com:9080/reviews
// into two versions (prod and qa) of an internal reviews service on port
// 9080. In addition, requests containing the cookie user: dev-123 will be
// sent to special port 7777 in the qa version. The same rule is also
// applicable inside the mesh for requests to the reviews.prod
// service. This rule is applicable across ports 443, 9080. Note that
// http://uk.bookinfo.com gets redirected to https://uk.bookinfo.com
// (i.e. 80 redirects to 443).
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: bookinfo-rule
// spec:
// hosts:
// - reviews.prod
// - uk.bookinfo.com
// - eu.bookinfo.com
// gateways:
// - my-gateway
// - mesh # applies to all the sidecars in the mesh
// http:
// - match:
// - headers:
// cookie:
// user: dev-123
// route:
// - destination:
// port:
// number: 7777
// name: reviews.qa
// - match:
// uri:
// prefix: /reviews/
// route:
// - destination:
// port:
// number: 9080 # can be omitted if its the only port for reviews
// name: reviews.prod
// weight: 80
// - destination:
// name: reviews.qa
// weight: 20
//
// The following VirtualService forwards traffic arriving at (external) port
// 2379 from 172.17.16.0/24 subnet to internal Mongo server on port 5555. This
// rule is not applicable internally in the mesh as the gateway list omits
// the reserved name "mesh".
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: bookinfo-Mongo
// spec:
// hosts:
// - mongosvr #name of Mongo service
// gateways:
// - my-gateway
// tcp:
// - match:
// - port:
// number: 2379
// sourceSubnet: "172.17.16.0/24"
// route:
// - destination:
// name: mongo.prod
//
type Gateway struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec GatewaySpec `json:"spec"`
}
type GatewaySpec struct {
// REQUIRED: A list of server specifications.
Servers []Server `json:"servers"`
// One or more labels that indicate a specific set of pods/VMs
// on which this gateway configuration should be applied.
// If no selectors are provided, the gateway will be implemented by
// the default istio-ingress controller.
Selector map[string]string `json:"selector,omitempty"`
}
// Server describes the properties of the proxy on a given load balancer port.
// For example,
//
// apiVersion: networking.istio.io/v1alpha3
// kind: Gateway
// metadata:
// name: my-ingress
// spec:
// selector:
// app: my-ingress-controller
// servers:
// - port:
// number: 80
// name: http2
// protocol: HTTP2
//
// Another example
//
// apiVersion: networking.istio.io/v1alpha3
// kind: Gateway
// metadata:
// name: my-tcp-ingress
// spec:
// selector:
// app: my-tcp-ingress-controller
// servers:
// - port:
// number: 27018
// name: mongo
// protocol: MONGO
//
// The following is an example of TLS configuration for port 443
//
// apiVersion: networking.istio.io/v1alpha3
// kind: Gateway
// metadata:
// name: my-tls-ingress
// spec:
// selector:
// app: my-tls-ingress-controller
// servers:
// - port:
// number: 443
// name: https
// protocol: HTTPS
// tls:
// mode: SIMPLE
// serverCertificate: /etc/certs/server.pem
// privateKey: /etc/certs/privatekey.pem
//
type Server struct {
// REQUIRED: The Port on which the proxy should listen for incoming
// connections
Port Port `json:"port"`
// A list of hosts exposed by this gateway. While
// typically applicable to HTTP services, it can also be used for TCP
// services using TLS with SNI. Standard DNS wildcard prefix syntax
// is permitted.
//
// A VirtualService that is bound to a gateway must having a matching host
// in its default destination. Specifically one of the VirtualService
// destination hosts is a strict suffix of a gateway host or
// a gateway host is a suffix of one of the VirtualService hosts.
Hosts []string `json:"hosts,omitempty"`
// Set of TLS related options that govern the server's behavior. Use
// these options to control if all http requests should be redirected to
// https, and the TLS modes to use.
TLS *TLSOptions `json:"tls,omitempty"`
}
type TLSOptions struct {
// If set to true, the load balancer will send a 302 redirect for all
// http connections, asking the clients to use HTTPS.
HTTPSRedirect bool `json:"httpsRedirect"`
// Optional: Indicates whether connections to this port should be
// secured using TLS. The value of this field determines how TLS is
// enforced.
Mode TLSMode `json:"mode,omitempty"`
// REQUIRED if mode is "SIMPLE" or "MUTUAL". The path to the file
// holding the server-side TLS certificate to use.
ServerCertificate string `json:"serverCertificate"`
// REQUIRED if mode is "SIMPLE" or "MUTUAL". The path to the file
// holding the server's private key.
PrivateKey string `json:"privateKey"`
// REQUIRED if mode is "MUTUAL". The path to a file containing
// certificate authority certificates to use in verifying a presented
// client side certificate.
CaCertificates string `json:"caCertificates"`
// The credentialName stands for a unique identifier that can be used
// to identify the serverCertificate and the privateKey. The
// credentialName appended with suffix "-cacert" is used to identify
// the CaCertificates associated with this server. Gateway workloads
// capable of fetching credentials from a remote credential store such
// as Kubernetes secrets, will be configured to retrieve the
// serverCertificate and the privateKey using credentialName, instead
// of using the file system paths specified above. If using mutual TLS,
// gateway workload instances will retrieve the CaCertificates using
// credentialName-cacert. The semantics of the name are platform
// dependent. In Kubernetes, the default Istio supplied credential
// server expects the credentialName to match the name of the
// Kubernetes secret that holds the server certificate, the private
// key, and the CA certificate (if using mutual TLS). Set the
// `ISTIO_META_USER_SDS` metadata variable in the gateway's proxy to
// enable the dynamic credential fetching feature.
CredentialName string `json:"credentialName,omitempty"`
// 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"`
}

View File

@ -1,56 +0,0 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha3
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"knative.dev/pkg/apis/istio"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: istio.GroupName, Version: "v1alpha3"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&VirtualService{},
&Gateway{},
&DestinationRule{},
&VirtualServiceList{},
&GatewayList{},
&DestinationRuleList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

View File

@ -1,901 +0,0 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha3
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis/istio/common/v1alpha1"
)
// +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"`
TLS []TLSRoute `json:"tls,omitempty"`
// A list of namespaces to which this destination rule is exported.
// The resolution of a destination rule to apply to a service occurs in the
// context of a hierarchy of namespaces. Exporting a destination rule allows
// it to be included in the resolution hierarchy for services in
// other namespaces. This feature provides a mechanism for service owners
// and mesh administrators to control the visibility of destination rules
// across namespace boundaries.
//
// If no namespaces are specified then the destination rule is exported to all
// namespaces by default.
//
// The value "." is reserved and defines an export to the same namespace that
// the destination rule is declared in. Similarly, the value "*" is reserved and
// defines an export to all namespaces.
//
// NOTE: in the current release, the `exportTo` value is restricted to
// "." or "*" (i.e., the current namespace or all namespaces).
ExportTo []string `json:"exportTo,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 []HTTPRouteDestination `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.
DeprecatedAppendHeaders map[string]string `json:"appendHeaders,omitempty"`
// Header manipulation rules
Headers *Headers `json:"headers,omitempty"`
// Http headers to remove before returning the response to the caller
RemoveResponseHeaders map[string]string `json:"removeResponseHeaders,omitempty"`
// Cross-Origin Resource Sharing policy
CorsPolicy *CorsPolicy `json:"corsPolicy,omitempty"`
}
// Headers describes header manipulation rules.
type Headers struct {
// Header manipulation rules to apply before forwarding a request
// to the destination service
Request *HeaderOperations `json:"request,omitempty"`
// Header manipulation rules to apply before returning a response
// to the caller
Response *HeaderOperations `json:"response,omitempty"`
}
// HeaderOperations Describes the header manipulations to apply
type HeaderOperations struct {
// Overwrite the headers specified by key with the given values
Set map[string]string `json:"set,omitempty"`
// Append the given values to the headers specified by keys
// (will create a comma-separated list of values)
Add map[string]string `json:"add,omitempty"`
// Remove a the specified headers
Remove []string `json:"remove,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 *v1alpha1.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 *v1alpha1.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 *v1alpha1.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 *v1alpha1.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]v1alpha1.StringMatch `json:"headers,omitempty"`
// Specifies the ports 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 uint32 `json:"port,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.
SourceLabels map[string]string `json:"sourceLabels,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"`
}
type HTTPRouteDestination 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"`
// Header manipulation rules
Headers *Headers `json:"headers,omitempty"`
}
// 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
// <servicename>.<rulenamespace>. 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 destinations to which the connection should be forwarded to. Weights
// must add to 100%.
Route []HTTPRouteDestination `json:"route"`
}
// Describes match conditions and actions for routing unterminated TLS
// traffic (TLS/HTTPS) The following routing rule forwards unterminated TLS
// traffic arriving at port 443 of gateway called mygateway to internal
// services in the mesh based on the SNI value.
//
// ```yaml
// kind: VirtualService
// metadata:
// name: bookinfo-sni
// spec:
// hosts:
// - '*.bookinfo.com'
// gateways:
// - mygateway
// tls:
// - match:
// - port: 443
// sniHosts:
// - login.bookinfo.com
// route:
// - destination:
// host: login.prod.svc.cluster.local
// - match:
// - port: 443
// sniHosts:
// - reviews.bookinfo.com
// route:
// - destination:
// host: reviews.prod.svc.cluster.local
// ```
type TLSRoute struct {
// REQUIRED. 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 []TLSMatchAttributes `json:"match"`
// The destination to which the connection should be forwarded to.
Route []HTTPRouteDestination `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.
DestinationSubnets []string `json:"destinationSubnets,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"`
// 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.
SourceLabels map[string]string `json:"sourceLabels,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"`
}
// TLS connection match attributes.
type TLSMatchAttributes struct {
// REQUIRED. SNI (server name indicator) to match on. Wildcard prefixes
// can be used in the SNI value, e.g., *.com will match foo.example.com
// as well as example.com. An SNI value must be a subset (i.e., fall
// within the domain) of the corresponding virtual service's hosts
SniHosts []string `json:"sniHosts"`
// IPv4 or IPv6 ip addresses of destination with optional subnet. E.g.,
// a.b.c.d/xx form or just a.b.c.d.
DestinationSubnets []string `json:"destinationSubnets,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"`
// 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.
SourceLabels map[string]string `json:"sourceLabels,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 HTTPRouteDestinations. 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 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).
Percent 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"`
}

File diff suppressed because it is too large Load Diff

View File

@ -1,89 +0,0 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
rest "k8s.io/client-go/rest"
v1alpha1 "knative.dev/pkg/apis/istio/authentication/v1alpha1"
"knative.dev/pkg/client/clientset/versioned/scheme"
)
type AuthenticationV1alpha1Interface interface {
RESTClient() rest.Interface
PoliciesGetter
}
// AuthenticationV1alpha1Client is used to interact with features provided by the authentication.istio.io group.
type AuthenticationV1alpha1Client struct {
restClient rest.Interface
}
func (c *AuthenticationV1alpha1Client) Policies(namespace string) PolicyInterface {
return newPolicies(c, namespace)
}
// NewForConfig creates a new AuthenticationV1alpha1Client for the given config.
func NewForConfig(c *rest.Config) (*AuthenticationV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &AuthenticationV1alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new AuthenticationV1alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *AuthenticationV1alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new AuthenticationV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *AuthenticationV1alpha1Client {
return &AuthenticationV1alpha1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
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 *AuthenticationV1alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -1,20 +0,0 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1alpha1

View File

@ -1,40 +0,0 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
v1alpha1 "knative.dev/pkg/client/clientset/versioned/typed/authentication/v1alpha1"
)
type FakeAuthenticationV1alpha1 struct {
*testing.Fake
}
func (c *FakeAuthenticationV1alpha1) Policies(namespace string) v1alpha1.PolicyInterface {
return &FakePolicies{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeAuthenticationV1alpha1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -1,128 +0,0 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
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"
v1alpha1 "knative.dev/pkg/apis/istio/authentication/v1alpha1"
)
// FakePolicies implements PolicyInterface
type FakePolicies struct {
Fake *FakeAuthenticationV1alpha1
ns string
}
var policiesResource = schema.GroupVersionResource{Group: "authentication.istio.io", Version: "v1alpha1", Resource: "policies"}
var policiesKind = schema.GroupVersionKind{Group: "authentication.istio.io", Version: "v1alpha1", Kind: "Policy"}
// Get takes name of the policy, and returns the corresponding policy object, and an error if there is any.
func (c *FakePolicies) Get(name string, options v1.GetOptions) (result *v1alpha1.Policy, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(policiesResource, c.ns, name), &v1alpha1.Policy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Policy), err
}
// List takes label and field selectors, and returns the list of Policies that match those selectors.
func (c *FakePolicies) List(opts v1.ListOptions) (result *v1alpha1.PolicyList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(policiesResource, policiesKind, c.ns, opts), &v1alpha1.PolicyList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.PolicyList{ListMeta: obj.(*v1alpha1.PolicyList).ListMeta}
for _, item := range obj.(*v1alpha1.PolicyList).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 policies.
func (c *FakePolicies) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(policiesResource, c.ns, opts))
}
// Create takes the representation of a policy and creates it. Returns the server's representation of the policy, and an error, if there is any.
func (c *FakePolicies) Create(policy *v1alpha1.Policy) (result *v1alpha1.Policy, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(policiesResource, c.ns, policy), &v1alpha1.Policy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Policy), err
}
// Update takes the representation of a policy and updates it. Returns the server's representation of the policy, and an error, if there is any.
func (c *FakePolicies) Update(policy *v1alpha1.Policy) (result *v1alpha1.Policy, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(policiesResource, c.ns, policy), &v1alpha1.Policy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Policy), err
}
// Delete takes name of the policy and deletes it. Returns an error if one occurs.
func (c *FakePolicies) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(policiesResource, c.ns, name), &v1alpha1.Policy{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakePolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(policiesResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.PolicyList{})
return err
}
// Patch applies the patch and returns the patched policy.
func (c *FakePolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Policy, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(policiesResource, c.ns, name, pt, data, subresources...), &v1alpha1.Policy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Policy), err
}

View File

@ -1,21 +0,0 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
type PolicyExpansion interface{}

View File

@ -1,20 +0,0 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// Package fake has the automatically generated clients.
package fake

View File

@ -1,46 +0,0 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package authentication
import (
v1alpha1 "knative.dev/pkg/client/informers/externalversions/authentication/v1alpha1"
internalinterfaces "knative.dev/pkg/client/informers/externalversions/internalinterfaces"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.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}
}
// V1alpha1 returns a new v1alpha1.Interface.
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
}

View File

@ -1,45 +0,0 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
internalinterfaces "knative.dev/pkg/client/informers/externalversions/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// Policies returns a PolicyInformer.
Policies() PolicyInformer
}
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}
}
// Policies returns a PolicyInformer.
func (v *version) Policies() PolicyInformer {
return &policyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}

View File

@ -1,89 +0,0 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
time "time"
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"
authenticationv1alpha1 "knative.dev/pkg/apis/istio/authentication/v1alpha1"
versioned "knative.dev/pkg/client/clientset/versioned"
internalinterfaces "knative.dev/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "knative.dev/pkg/client/listers/authentication/v1alpha1"
)
// PolicyInformer provides access to a shared informer and lister for
// Policies.
type PolicyInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.PolicyLister
}
type policyInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewPolicyInformer constructs a new informer for Policy 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 NewPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredPolicyInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredPolicyInformer constructs a new informer for Policy 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 NewFilteredPolicyInformer(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.AuthenticationV1alpha1().Policies(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AuthenticationV1alpha1().Policies(namespace).Watch(options)
},
},
&authenticationv1alpha1.Policy{},
resyncPeriod,
indexers,
)
}
func (f *policyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *policyInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&authenticationv1alpha1.Policy{}, f.defaultInformer)
}
func (f *policyInformer) Lister() v1alpha1.PolicyLister {
return v1alpha1.NewPolicyLister(f.Informer().GetIndexer())
}

View File

@ -22,13 +22,11 @@ import (
discovery "k8s.io/client-go/discovery" discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol" flowcontrol "k8s.io/client-go/util/flowcontrol"
authenticationv1alpha1 "knative.dev/pkg/client/clientset/versioned/typed/authentication/v1alpha1" networkingv1alpha3 "knative.dev/pkg/client/istio/clientset/versioned/typed/networking/v1alpha3"
networkingv1alpha3 "knative.dev/pkg/client/clientset/versioned/typed/istio/v1alpha3"
) )
type Interface interface { type Interface interface {
Discovery() discovery.DiscoveryInterface Discovery() discovery.DiscoveryInterface
AuthenticationV1alpha1() authenticationv1alpha1.AuthenticationV1alpha1Interface
NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface
} }
@ -36,15 +34,9 @@ type Interface interface {
// version included in a Clientset. // version included in a Clientset.
type Clientset struct { type Clientset struct {
*discovery.DiscoveryClient *discovery.DiscoveryClient
authenticationV1alpha1 *authenticationv1alpha1.AuthenticationV1alpha1Client
networkingV1alpha3 *networkingv1alpha3.NetworkingV1alpha3Client networkingV1alpha3 *networkingv1alpha3.NetworkingV1alpha3Client
} }
// AuthenticationV1alpha1 retrieves the AuthenticationV1alpha1Client
func (c *Clientset) AuthenticationV1alpha1() authenticationv1alpha1.AuthenticationV1alpha1Interface {
return c.authenticationV1alpha1
}
// NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client // NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client
func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface { func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface {
return c.networkingV1alpha3 return c.networkingV1alpha3
@ -66,10 +58,6 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
} }
var cs Clientset var cs Clientset
var err error var err error
cs.authenticationV1alpha1, err = authenticationv1alpha1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.networkingV1alpha3, err = networkingv1alpha3.NewForConfig(&configShallowCopy) cs.networkingV1alpha3, err = networkingv1alpha3.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
@ -86,7 +74,6 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
// panics if there is an error in the config. // panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset { func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset var cs Clientset
cs.authenticationV1alpha1 = authenticationv1alpha1.NewForConfigOrDie(c)
cs.networkingV1alpha3 = networkingv1alpha3.NewForConfigOrDie(c) cs.networkingV1alpha3 = networkingv1alpha3.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
@ -96,7 +83,6 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
// New creates a new Clientset for the given RESTClient. // New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset { func New(c rest.Interface) *Clientset {
var cs Clientset var cs Clientset
cs.authenticationV1alpha1 = authenticationv1alpha1.New(c)
cs.networkingV1alpha3 = networkingv1alpha3.New(c) cs.networkingV1alpha3 = networkingv1alpha3.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c)

View File

@ -24,11 +24,9 @@ import (
"k8s.io/client-go/discovery" "k8s.io/client-go/discovery"
fakediscovery "k8s.io/client-go/discovery/fake" fakediscovery "k8s.io/client-go/discovery/fake"
"k8s.io/client-go/testing" "k8s.io/client-go/testing"
clientset "knative.dev/pkg/client/clientset/versioned" clientset "knative.dev/pkg/client/istio/clientset/versioned"
authenticationv1alpha1 "knative.dev/pkg/client/clientset/versioned/typed/authentication/v1alpha1" networkingv1alpha3 "knative.dev/pkg/client/istio/clientset/versioned/typed/networking/v1alpha3"
fakeauthenticationv1alpha1 "knative.dev/pkg/client/clientset/versioned/typed/authentication/v1alpha1/fake" fakenetworkingv1alpha3 "knative.dev/pkg/client/istio/clientset/versioned/typed/networking/v1alpha3/fake"
networkingv1alpha3 "knative.dev/pkg/client/clientset/versioned/typed/istio/v1alpha3"
fakenetworkingv1alpha3 "knative.dev/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake"
) )
// NewSimpleClientset returns a clientset that will respond with the provided objects. // NewSimpleClientset returns a clientset that will respond with the provided objects.
@ -78,11 +76,6 @@ func (c *Clientset) Tracker() testing.ObjectTracker {
var _ clientset.Interface = &Clientset{} var _ clientset.Interface = &Clientset{}
// AuthenticationV1alpha1 retrieves the AuthenticationV1alpha1Client
func (c *Clientset) AuthenticationV1alpha1() authenticationv1alpha1.AuthenticationV1alpha1Interface {
return &fakeauthenticationv1alpha1.FakeAuthenticationV1alpha1{Fake: &c.Fake}
}
// NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client // NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client
func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface { func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface {
return &fakenetworkingv1alpha3.FakeNetworkingV1alpha3{Fake: &c.Fake} return &fakenetworkingv1alpha3.FakeNetworkingV1alpha3{Fake: &c.Fake}

View File

@ -19,20 +19,18 @@ limitations under the License.
package fake package fake
import ( import (
networkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema" schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer" serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime"
authenticationv1alpha1 "knative.dev/pkg/apis/istio/authentication/v1alpha1"
networkingv1alpha3 "knative.dev/pkg/apis/istio/v1alpha3"
) )
var scheme = runtime.NewScheme() var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme) var codecs = serializer.NewCodecFactory(scheme)
var parameterCodec = runtime.NewParameterCodec(scheme) var parameterCodec = runtime.NewParameterCodec(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{ var localSchemeBuilder = runtime.SchemeBuilder{
authenticationv1alpha1.AddToScheme,
networkingv1alpha3.AddToScheme, networkingv1alpha3.AddToScheme,
} }

View File

@ -19,20 +19,18 @@ limitations under the License.
package scheme package scheme
import ( import (
networkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema" schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer" serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime"
authenticationv1alpha1 "knative.dev/pkg/apis/istio/authentication/v1alpha1"
networkingv1alpha3 "knative.dev/pkg/apis/istio/v1alpha3"
) )
var Scheme = runtime.NewScheme() var Scheme = runtime.NewScheme()
var Codecs = serializer.NewCodecFactory(Scheme) var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{ var localSchemeBuilder = runtime.SchemeBuilder{
authenticationv1alpha1.AddToScheme,
networkingv1alpha3.AddToScheme, networkingv1alpha3.AddToScheme,
} }

View File

@ -21,12 +21,12 @@ package v1alpha3
import ( import (
"time" "time"
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
v1alpha3 "knative.dev/pkg/apis/istio/v1alpha3" scheme "knative.dev/pkg/client/istio/clientset/versioned/scheme"
scheme "knative.dev/pkg/client/clientset/versioned/scheme"
) )
// DestinationRulesGetter has a method to return a DestinationRuleInterface. // DestinationRulesGetter has a method to return a DestinationRuleInterface.

View File

@ -0,0 +1,174 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha3
import (
"time"
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
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"
scheme "knative.dev/pkg/client/istio/clientset/versioned/scheme"
)
// EnvoyFiltersGetter has a method to return a EnvoyFilterInterface.
// A group's client should implement this interface.
type EnvoyFiltersGetter interface {
EnvoyFilters(namespace string) EnvoyFilterInterface
}
// EnvoyFilterInterface has methods to work with EnvoyFilter resources.
type EnvoyFilterInterface interface {
Create(*v1alpha3.EnvoyFilter) (*v1alpha3.EnvoyFilter, error)
Update(*v1alpha3.EnvoyFilter) (*v1alpha3.EnvoyFilter, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha3.EnvoyFilter, error)
List(opts v1.ListOptions) (*v1alpha3.EnvoyFilterList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.EnvoyFilter, err error)
EnvoyFilterExpansion
}
// envoyFilters implements EnvoyFilterInterface
type envoyFilters struct {
client rest.Interface
ns string
}
// newEnvoyFilters returns a EnvoyFilters
func newEnvoyFilters(c *NetworkingV1alpha3Client, namespace string) *envoyFilters {
return &envoyFilters{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the envoyFilter, and returns the corresponding envoyFilter object, and an error if there is any.
func (c *envoyFilters) Get(name string, options v1.GetOptions) (result *v1alpha3.EnvoyFilter, err error) {
result = &v1alpha3.EnvoyFilter{}
err = c.client.Get().
Namespace(c.ns).
Resource("envoyfilters").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of EnvoyFilters that match those selectors.
func (c *envoyFilters) List(opts v1.ListOptions) (result *v1alpha3.EnvoyFilterList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha3.EnvoyFilterList{}
err = c.client.Get().
Namespace(c.ns).
Resource("envoyfilters").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested envoyFilters.
func (c *envoyFilters) Watch(opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("envoyfilters").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
// Create takes the representation of a envoyFilter and creates it. Returns the server's representation of the envoyFilter, and an error, if there is any.
func (c *envoyFilters) Create(envoyFilter *v1alpha3.EnvoyFilter) (result *v1alpha3.EnvoyFilter, err error) {
result = &v1alpha3.EnvoyFilter{}
err = c.client.Post().
Namespace(c.ns).
Resource("envoyfilters").
Body(envoyFilter).
Do().
Into(result)
return
}
// Update takes the representation of a envoyFilter and updates it. Returns the server's representation of the envoyFilter, and an error, if there is any.
func (c *envoyFilters) Update(envoyFilter *v1alpha3.EnvoyFilter) (result *v1alpha3.EnvoyFilter, err error) {
result = &v1alpha3.EnvoyFilter{}
err = c.client.Put().
Namespace(c.ns).
Resource("envoyfilters").
Name(envoyFilter.Name).
Body(envoyFilter).
Do().
Into(result)
return
}
// Delete takes name of the envoyFilter and deletes it. Returns an error if one occurs.
func (c *envoyFilters) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("envoyfilters").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *envoyFilters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("envoyfilters").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched envoyFilter.
func (c *envoyFilters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.EnvoyFilter, err error) {
result = &v1alpha3.EnvoyFilter{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("envoyfilters").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -19,13 +19,13 @@ limitations under the License.
package fake package fake
import ( import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema" schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
v1alpha3 "knative.dev/pkg/apis/istio/v1alpha3"
) )
// FakeDestinationRules implements DestinationRuleInterface // FakeDestinationRules implements DestinationRuleInterface

View File

@ -0,0 +1,128 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/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"
)
// FakeEnvoyFilters implements EnvoyFilterInterface
type FakeEnvoyFilters struct {
Fake *FakeNetworkingV1alpha3
ns string
}
var envoyfiltersResource = schema.GroupVersionResource{Group: "networking.istio.io", Version: "v1alpha3", Resource: "envoyfilters"}
var envoyfiltersKind = schema.GroupVersionKind{Group: "networking.istio.io", Version: "v1alpha3", Kind: "EnvoyFilter"}
// Get takes name of the envoyFilter, and returns the corresponding envoyFilter object, and an error if there is any.
func (c *FakeEnvoyFilters) Get(name string, options v1.GetOptions) (result *v1alpha3.EnvoyFilter, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(envoyfiltersResource, c.ns, name), &v1alpha3.EnvoyFilter{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.EnvoyFilter), err
}
// List takes label and field selectors, and returns the list of EnvoyFilters that match those selectors.
func (c *FakeEnvoyFilters) List(opts v1.ListOptions) (result *v1alpha3.EnvoyFilterList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(envoyfiltersResource, envoyfiltersKind, c.ns, opts), &v1alpha3.EnvoyFilterList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha3.EnvoyFilterList{ListMeta: obj.(*v1alpha3.EnvoyFilterList).ListMeta}
for _, item := range obj.(*v1alpha3.EnvoyFilterList).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 envoyFilters.
func (c *FakeEnvoyFilters) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(envoyfiltersResource, c.ns, opts))
}
// Create takes the representation of a envoyFilter and creates it. Returns the server's representation of the envoyFilter, and an error, if there is any.
func (c *FakeEnvoyFilters) Create(envoyFilter *v1alpha3.EnvoyFilter) (result *v1alpha3.EnvoyFilter, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(envoyfiltersResource, c.ns, envoyFilter), &v1alpha3.EnvoyFilter{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.EnvoyFilter), err
}
// Update takes the representation of a envoyFilter and updates it. Returns the server's representation of the envoyFilter, and an error, if there is any.
func (c *FakeEnvoyFilters) Update(envoyFilter *v1alpha3.EnvoyFilter) (result *v1alpha3.EnvoyFilter, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(envoyfiltersResource, c.ns, envoyFilter), &v1alpha3.EnvoyFilter{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.EnvoyFilter), err
}
// Delete takes name of the envoyFilter and deletes it. Returns an error if one occurs.
func (c *FakeEnvoyFilters) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(envoyfiltersResource, c.ns, name), &v1alpha3.EnvoyFilter{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeEnvoyFilters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(envoyfiltersResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha3.EnvoyFilterList{})
return err
}
// Patch applies the patch and returns the patched envoyFilter.
func (c *FakeEnvoyFilters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.EnvoyFilter, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(envoyfiltersResource, c.ns, name, pt, data, subresources...), &v1alpha3.EnvoyFilter{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.EnvoyFilter), err
}

View File

@ -19,13 +19,13 @@ limitations under the License.
package fake package fake
import ( import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema" schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
v1alpha3 "knative.dev/pkg/apis/istio/v1alpha3"
) )
// FakeGateways implements GatewayInterface // FakeGateways implements GatewayInterface

View File

@ -21,7 +21,7 @@ package fake
import ( import (
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
v1alpha3 "knative.dev/pkg/client/clientset/versioned/typed/istio/v1alpha3" v1alpha3 "knative.dev/pkg/client/istio/clientset/versioned/typed/networking/v1alpha3"
) )
type FakeNetworkingV1alpha3 struct { type FakeNetworkingV1alpha3 struct {
@ -32,10 +32,22 @@ func (c *FakeNetworkingV1alpha3) DestinationRules(namespace string) v1alpha3.Des
return &FakeDestinationRules{c, namespace} return &FakeDestinationRules{c, namespace}
} }
func (c *FakeNetworkingV1alpha3) EnvoyFilters(namespace string) v1alpha3.EnvoyFilterInterface {
return &FakeEnvoyFilters{c, namespace}
}
func (c *FakeNetworkingV1alpha3) Gateways(namespace string) v1alpha3.GatewayInterface { func (c *FakeNetworkingV1alpha3) Gateways(namespace string) v1alpha3.GatewayInterface {
return &FakeGateways{c, namespace} return &FakeGateways{c, namespace}
} }
func (c *FakeNetworkingV1alpha3) ServiceEntries(namespace string) v1alpha3.ServiceEntryInterface {
return &FakeServiceEntries{c, namespace}
}
func (c *FakeNetworkingV1alpha3) Sidecars(namespace string) v1alpha3.SidecarInterface {
return &FakeSidecars{c, namespace}
}
func (c *FakeNetworkingV1alpha3) VirtualServices(namespace string) v1alpha3.VirtualServiceInterface { func (c *FakeNetworkingV1alpha3) VirtualServices(namespace string) v1alpha3.VirtualServiceInterface {
return &FakeVirtualServices{c, namespace} return &FakeVirtualServices{c, namespace}
} }

View File

@ -0,0 +1,128 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/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"
)
// FakeServiceEntries implements ServiceEntryInterface
type FakeServiceEntries struct {
Fake *FakeNetworkingV1alpha3
ns string
}
var serviceentriesResource = schema.GroupVersionResource{Group: "networking.istio.io", Version: "v1alpha3", Resource: "serviceentries"}
var serviceentriesKind = schema.GroupVersionKind{Group: "networking.istio.io", Version: "v1alpha3", Kind: "ServiceEntry"}
// Get takes name of the serviceEntry, and returns the corresponding serviceEntry object, and an error if there is any.
func (c *FakeServiceEntries) Get(name string, options v1.GetOptions) (result *v1alpha3.ServiceEntry, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(serviceentriesResource, c.ns, name), &v1alpha3.ServiceEntry{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.ServiceEntry), err
}
// List takes label and field selectors, and returns the list of ServiceEntries that match those selectors.
func (c *FakeServiceEntries) List(opts v1.ListOptions) (result *v1alpha3.ServiceEntryList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(serviceentriesResource, serviceentriesKind, c.ns, opts), &v1alpha3.ServiceEntryList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha3.ServiceEntryList{ListMeta: obj.(*v1alpha3.ServiceEntryList).ListMeta}
for _, item := range obj.(*v1alpha3.ServiceEntryList).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 serviceEntries.
func (c *FakeServiceEntries) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(serviceentriesResource, c.ns, opts))
}
// Create takes the representation of a serviceEntry and creates it. Returns the server's representation of the serviceEntry, and an error, if there is any.
func (c *FakeServiceEntries) Create(serviceEntry *v1alpha3.ServiceEntry) (result *v1alpha3.ServiceEntry, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(serviceentriesResource, c.ns, serviceEntry), &v1alpha3.ServiceEntry{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.ServiceEntry), err
}
// Update takes the representation of a serviceEntry and updates it. Returns the server's representation of the serviceEntry, and an error, if there is any.
func (c *FakeServiceEntries) Update(serviceEntry *v1alpha3.ServiceEntry) (result *v1alpha3.ServiceEntry, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(serviceentriesResource, c.ns, serviceEntry), &v1alpha3.ServiceEntry{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.ServiceEntry), err
}
// Delete takes name of the serviceEntry and deletes it. Returns an error if one occurs.
func (c *FakeServiceEntries) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(serviceentriesResource, c.ns, name), &v1alpha3.ServiceEntry{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeServiceEntries) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(serviceentriesResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha3.ServiceEntryList{})
return err
}
// Patch applies the patch and returns the patched serviceEntry.
func (c *FakeServiceEntries) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.ServiceEntry, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(serviceentriesResource, c.ns, name, pt, data, subresources...), &v1alpha3.ServiceEntry{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.ServiceEntry), err
}

View File

@ -0,0 +1,128 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/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"
)
// FakeSidecars implements SidecarInterface
type FakeSidecars struct {
Fake *FakeNetworkingV1alpha3
ns string
}
var sidecarsResource = schema.GroupVersionResource{Group: "networking.istio.io", Version: "v1alpha3", Resource: "sidecars"}
var sidecarsKind = schema.GroupVersionKind{Group: "networking.istio.io", Version: "v1alpha3", Kind: "Sidecar"}
// Get takes name of the sidecar, and returns the corresponding sidecar object, and an error if there is any.
func (c *FakeSidecars) Get(name string, options v1.GetOptions) (result *v1alpha3.Sidecar, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(sidecarsResource, c.ns, name), &v1alpha3.Sidecar{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.Sidecar), err
}
// List takes label and field selectors, and returns the list of Sidecars that match those selectors.
func (c *FakeSidecars) List(opts v1.ListOptions) (result *v1alpha3.SidecarList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(sidecarsResource, sidecarsKind, c.ns, opts), &v1alpha3.SidecarList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha3.SidecarList{ListMeta: obj.(*v1alpha3.SidecarList).ListMeta}
for _, item := range obj.(*v1alpha3.SidecarList).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 sidecars.
func (c *FakeSidecars) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(sidecarsResource, c.ns, opts))
}
// Create takes the representation of a sidecar and creates it. Returns the server's representation of the sidecar, and an error, if there is any.
func (c *FakeSidecars) Create(sidecar *v1alpha3.Sidecar) (result *v1alpha3.Sidecar, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(sidecarsResource, c.ns, sidecar), &v1alpha3.Sidecar{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.Sidecar), err
}
// Update takes the representation of a sidecar and updates it. Returns the server's representation of the sidecar, and an error, if there is any.
func (c *FakeSidecars) Update(sidecar *v1alpha3.Sidecar) (result *v1alpha3.Sidecar, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(sidecarsResource, c.ns, sidecar), &v1alpha3.Sidecar{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.Sidecar), err
}
// Delete takes name of the sidecar and deletes it. Returns an error if one occurs.
func (c *FakeSidecars) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(sidecarsResource, c.ns, name), &v1alpha3.Sidecar{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeSidecars) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(sidecarsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha3.SidecarList{})
return err
}
// Patch applies the patch and returns the patched sidecar.
func (c *FakeSidecars) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Sidecar, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(sidecarsResource, c.ns, name, pt, data, subresources...), &v1alpha3.Sidecar{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.Sidecar), err
}

View File

@ -19,13 +19,13 @@ limitations under the License.
package fake package fake
import ( import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema" schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
v1alpha3 "knative.dev/pkg/apis/istio/v1alpha3"
) )
// FakeVirtualServices implements VirtualServiceInterface // FakeVirtualServices implements VirtualServiceInterface

View File

@ -21,12 +21,12 @@ package v1alpha3
import ( import (
"time" "time"
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
v1alpha3 "knative.dev/pkg/apis/istio/v1alpha3" scheme "knative.dev/pkg/client/istio/clientset/versioned/scheme"
scheme "knative.dev/pkg/client/clientset/versioned/scheme"
) )
// GatewaysGetter has a method to return a GatewayInterface. // GatewaysGetter has a method to return a GatewayInterface.

View File

@ -20,6 +20,12 @@ package v1alpha3
type DestinationRuleExpansion interface{} type DestinationRuleExpansion interface{}
type EnvoyFilterExpansion interface{}
type GatewayExpansion interface{} type GatewayExpansion interface{}
type ServiceEntryExpansion interface{}
type SidecarExpansion interface{}
type VirtualServiceExpansion interface{} type VirtualServiceExpansion interface{}

View File

@ -19,15 +19,18 @@ limitations under the License.
package v1alpha3 package v1alpha3
import ( import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
v1alpha3 "knative.dev/pkg/apis/istio/v1alpha3" "knative.dev/pkg/client/istio/clientset/versioned/scheme"
"knative.dev/pkg/client/clientset/versioned/scheme"
) )
type NetworkingV1alpha3Interface interface { type NetworkingV1alpha3Interface interface {
RESTClient() rest.Interface RESTClient() rest.Interface
DestinationRulesGetter DestinationRulesGetter
EnvoyFiltersGetter
GatewaysGetter GatewaysGetter
ServiceEntriesGetter
SidecarsGetter
VirtualServicesGetter VirtualServicesGetter
} }
@ -40,10 +43,22 @@ func (c *NetworkingV1alpha3Client) DestinationRules(namespace string) Destinatio
return newDestinationRules(c, namespace) return newDestinationRules(c, namespace)
} }
func (c *NetworkingV1alpha3Client) EnvoyFilters(namespace string) EnvoyFilterInterface {
return newEnvoyFilters(c, namespace)
}
func (c *NetworkingV1alpha3Client) Gateways(namespace string) GatewayInterface { func (c *NetworkingV1alpha3Client) Gateways(namespace string) GatewayInterface {
return newGateways(c, namespace) return newGateways(c, namespace)
} }
func (c *NetworkingV1alpha3Client) ServiceEntries(namespace string) ServiceEntryInterface {
return newServiceEntries(c, namespace)
}
func (c *NetworkingV1alpha3Client) Sidecars(namespace string) SidecarInterface {
return newSidecars(c, namespace)
}
func (c *NetworkingV1alpha3Client) VirtualServices(namespace string) VirtualServiceInterface { func (c *NetworkingV1alpha3Client) VirtualServices(namespace string) VirtualServiceInterface {
return newVirtualServices(c, namespace) return newVirtualServices(c, namespace)
} }

View File

@ -0,0 +1,174 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha3
import (
"time"
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
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"
scheme "knative.dev/pkg/client/istio/clientset/versioned/scheme"
)
// ServiceEntriesGetter has a method to return a ServiceEntryInterface.
// A group's client should implement this interface.
type ServiceEntriesGetter interface {
ServiceEntries(namespace string) ServiceEntryInterface
}
// ServiceEntryInterface has methods to work with ServiceEntry resources.
type ServiceEntryInterface interface {
Create(*v1alpha3.ServiceEntry) (*v1alpha3.ServiceEntry, error)
Update(*v1alpha3.ServiceEntry) (*v1alpha3.ServiceEntry, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha3.ServiceEntry, error)
List(opts v1.ListOptions) (*v1alpha3.ServiceEntryList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.ServiceEntry, err error)
ServiceEntryExpansion
}
// serviceEntries implements ServiceEntryInterface
type serviceEntries struct {
client rest.Interface
ns string
}
// newServiceEntries returns a ServiceEntries
func newServiceEntries(c *NetworkingV1alpha3Client, namespace string) *serviceEntries {
return &serviceEntries{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the serviceEntry, and returns the corresponding serviceEntry object, and an error if there is any.
func (c *serviceEntries) Get(name string, options v1.GetOptions) (result *v1alpha3.ServiceEntry, err error) {
result = &v1alpha3.ServiceEntry{}
err = c.client.Get().
Namespace(c.ns).
Resource("serviceentries").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of ServiceEntries that match those selectors.
func (c *serviceEntries) List(opts v1.ListOptions) (result *v1alpha3.ServiceEntryList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha3.ServiceEntryList{}
err = c.client.Get().
Namespace(c.ns).
Resource("serviceentries").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested serviceEntries.
func (c *serviceEntries) Watch(opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("serviceentries").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
// Create takes the representation of a serviceEntry and creates it. Returns the server's representation of the serviceEntry, and an error, if there is any.
func (c *serviceEntries) Create(serviceEntry *v1alpha3.ServiceEntry) (result *v1alpha3.ServiceEntry, err error) {
result = &v1alpha3.ServiceEntry{}
err = c.client.Post().
Namespace(c.ns).
Resource("serviceentries").
Body(serviceEntry).
Do().
Into(result)
return
}
// Update takes the representation of a serviceEntry and updates it. Returns the server's representation of the serviceEntry, and an error, if there is any.
func (c *serviceEntries) Update(serviceEntry *v1alpha3.ServiceEntry) (result *v1alpha3.ServiceEntry, err error) {
result = &v1alpha3.ServiceEntry{}
err = c.client.Put().
Namespace(c.ns).
Resource("serviceentries").
Name(serviceEntry.Name).
Body(serviceEntry).
Do().
Into(result)
return
}
// Delete takes name of the serviceEntry and deletes it. Returns an error if one occurs.
func (c *serviceEntries) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("serviceentries").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *serviceEntries) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("serviceentries").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched serviceEntry.
func (c *serviceEntries) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.ServiceEntry, err error) {
result = &v1alpha3.ServiceEntry{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("serviceentries").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -16,58 +16,58 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT. // Code generated by client-gen. DO NOT EDIT.
package v1alpha1 package v1alpha3
import ( import (
"time" "time"
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
v1alpha1 "knative.dev/pkg/apis/istio/authentication/v1alpha1" scheme "knative.dev/pkg/client/istio/clientset/versioned/scheme"
scheme "knative.dev/pkg/client/clientset/versioned/scheme"
) )
// PoliciesGetter has a method to return a PolicyInterface. // SidecarsGetter has a method to return a SidecarInterface.
// A group's client should implement this interface. // A group's client should implement this interface.
type PoliciesGetter interface { type SidecarsGetter interface {
Policies(namespace string) PolicyInterface Sidecars(namespace string) SidecarInterface
} }
// PolicyInterface has methods to work with Policy resources. // SidecarInterface has methods to work with Sidecar resources.
type PolicyInterface interface { type SidecarInterface interface {
Create(*v1alpha1.Policy) (*v1alpha1.Policy, error) Create(*v1alpha3.Sidecar) (*v1alpha3.Sidecar, error)
Update(*v1alpha1.Policy) (*v1alpha1.Policy, error) Update(*v1alpha3.Sidecar) (*v1alpha3.Sidecar, error)
Delete(name string, options *v1.DeleteOptions) error Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha1.Policy, error) Get(name string, options v1.GetOptions) (*v1alpha3.Sidecar, error)
List(opts v1.ListOptions) (*v1alpha1.PolicyList, error) List(opts v1.ListOptions) (*v1alpha3.SidecarList, error)
Watch(opts v1.ListOptions) (watch.Interface, error) Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Policy, err error) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Sidecar, err error)
PolicyExpansion SidecarExpansion
} }
// policies implements PolicyInterface // sidecars implements SidecarInterface
type policies struct { type sidecars struct {
client rest.Interface client rest.Interface
ns string ns string
} }
// newPolicies returns a Policies // newSidecars returns a Sidecars
func newPolicies(c *AuthenticationV1alpha1Client, namespace string) *policies { func newSidecars(c *NetworkingV1alpha3Client, namespace string) *sidecars {
return &policies{ return &sidecars{
client: c.RESTClient(), client: c.RESTClient(),
ns: namespace, ns: namespace,
} }
} }
// Get takes name of the policy, and returns the corresponding policy object, and an error if there is any. // Get takes name of the sidecar, and returns the corresponding sidecar object, and an error if there is any.
func (c *policies) Get(name string, options v1.GetOptions) (result *v1alpha1.Policy, err error) { func (c *sidecars) Get(name string, options v1.GetOptions) (result *v1alpha3.Sidecar, err error) {
result = &v1alpha1.Policy{} result = &v1alpha3.Sidecar{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns). Namespace(c.ns).
Resource("policies"). Resource("sidecars").
Name(name). Name(name).
VersionedParams(&options, scheme.ParameterCodec). VersionedParams(&options, scheme.ParameterCodec).
Do(). Do().
@ -75,16 +75,16 @@ func (c *policies) Get(name string, options v1.GetOptions) (result *v1alpha1.Pol
return return
} }
// List takes label and field selectors, and returns the list of Policies that match those selectors. // List takes label and field selectors, and returns the list of Sidecars that match those selectors.
func (c *policies) List(opts v1.ListOptions) (result *v1alpha1.PolicyList, err error) { func (c *sidecars) List(opts v1.ListOptions) (result *v1alpha3.SidecarList, err error) {
var timeout time.Duration var timeout time.Duration
if opts.TimeoutSeconds != nil { if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
} }
result = &v1alpha1.PolicyList{} result = &v1alpha3.SidecarList{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns). Namespace(c.ns).
Resource("policies"). Resource("sidecars").
VersionedParams(&opts, scheme.ParameterCodec). VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout). Timeout(timeout).
Do(). Do().
@ -92,8 +92,8 @@ func (c *policies) List(opts v1.ListOptions) (result *v1alpha1.PolicyList, err e
return return
} }
// Watch returns a watch.Interface that watches the requested policies. // Watch returns a watch.Interface that watches the requested sidecars.
func (c *policies) Watch(opts v1.ListOptions) (watch.Interface, error) { func (c *sidecars) Watch(opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration var timeout time.Duration
if opts.TimeoutSeconds != nil { if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -101,42 +101,42 @@ func (c *policies) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true opts.Watch = true
return c.client.Get(). return c.client.Get().
Namespace(c.ns). Namespace(c.ns).
Resource("policies"). Resource("sidecars").
VersionedParams(&opts, scheme.ParameterCodec). VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout). Timeout(timeout).
Watch() Watch()
} }
// Create takes the representation of a policy and creates it. Returns the server's representation of the policy, and an error, if there is any. // Create takes the representation of a sidecar and creates it. Returns the server's representation of the sidecar, and an error, if there is any.
func (c *policies) Create(policy *v1alpha1.Policy) (result *v1alpha1.Policy, err error) { func (c *sidecars) Create(sidecar *v1alpha3.Sidecar) (result *v1alpha3.Sidecar, err error) {
result = &v1alpha1.Policy{} result = &v1alpha3.Sidecar{}
err = c.client.Post(). err = c.client.Post().
Namespace(c.ns). Namespace(c.ns).
Resource("policies"). Resource("sidecars").
Body(policy). Body(sidecar).
Do(). Do().
Into(result) Into(result)
return return
} }
// Update takes the representation of a policy and updates it. Returns the server's representation of the policy, and an error, if there is any. // Update takes the representation of a sidecar and updates it. Returns the server's representation of the sidecar, and an error, if there is any.
func (c *policies) Update(policy *v1alpha1.Policy) (result *v1alpha1.Policy, err error) { func (c *sidecars) Update(sidecar *v1alpha3.Sidecar) (result *v1alpha3.Sidecar, err error) {
result = &v1alpha1.Policy{} result = &v1alpha3.Sidecar{}
err = c.client.Put(). err = c.client.Put().
Namespace(c.ns). Namespace(c.ns).
Resource("policies"). Resource("sidecars").
Name(policy.Name). Name(sidecar.Name).
Body(policy). Body(sidecar).
Do(). Do().
Into(result) Into(result)
return return
} }
// Delete takes name of the policy and deletes it. Returns an error if one occurs. // Delete takes name of the sidecar and deletes it. Returns an error if one occurs.
func (c *policies) Delete(name string, options *v1.DeleteOptions) error { func (c *sidecars) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns). Namespace(c.ns).
Resource("policies"). Resource("sidecars").
Name(name). Name(name).
Body(options). Body(options).
Do(). Do().
@ -144,14 +144,14 @@ func (c *policies) Delete(name string, options *v1.DeleteOptions) error {
} }
// DeleteCollection deletes a collection of objects. // DeleteCollection deletes a collection of objects.
func (c *policies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { func (c *sidecars) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration var timeout time.Duration
if listOptions.TimeoutSeconds != nil { if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
} }
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns). Namespace(c.ns).
Resource("policies"). Resource("sidecars").
VersionedParams(&listOptions, scheme.ParameterCodec). VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout). Timeout(timeout).
Body(options). Body(options).
@ -159,12 +159,12 @@ func (c *policies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.Li
Error() Error()
} }
// Patch applies the patch and returns the patched policy. // Patch applies the patch and returns the patched sidecar.
func (c *policies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Policy, err error) { func (c *sidecars) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Sidecar, err error) {
result = &v1alpha1.Policy{} result = &v1alpha3.Sidecar{}
err = c.client.Patch(pt). err = c.client.Patch(pt).
Namespace(c.ns). Namespace(c.ns).
Resource("policies"). Resource("sidecars").
SubResource(subresources...). SubResource(subresources...).
Name(name). Name(name).
Body(data). Body(data).

View File

@ -21,12 +21,12 @@ package v1alpha3
import ( import (
"time" "time"
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
v1alpha3 "knative.dev/pkg/apis/istio/v1alpha3" scheme "knative.dev/pkg/client/istio/clientset/versioned/scheme"
scheme "knative.dev/pkg/client/clientset/versioned/scheme"
) )
// VirtualServicesGetter has a method to return a VirtualServiceInterface. // VirtualServicesGetter has a method to return a VirtualServiceInterface.

View File

@ -27,10 +27,9 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema" schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache" cache "k8s.io/client-go/tools/cache"
versioned "knative.dev/pkg/client/clientset/versioned" versioned "knative.dev/pkg/client/istio/clientset/versioned"
authentication "knative.dev/pkg/client/informers/externalversions/authentication" internalinterfaces "knative.dev/pkg/client/istio/informers/externalversions/internalinterfaces"
internalinterfaces "knative.dev/pkg/client/informers/externalversions/internalinterfaces" networking "knative.dev/pkg/client/istio/informers/externalversions/networking"
istio "knative.dev/pkg/client/informers/externalversions/istio"
) )
// SharedInformerOption defines the functional option type for SharedInformerFactory. // SharedInformerOption defines the functional option type for SharedInformerFactory.
@ -173,14 +172,9 @@ type SharedInformerFactory interface {
ForResource(resource schema.GroupVersionResource) (GenericInformer, error) ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
Authentication() authentication.Interface Networking() networking.Interface
Networking() istio.Interface
} }
func (f *sharedInformerFactory) Authentication() authentication.Interface { func (f *sharedInformerFactory) Networking() networking.Interface {
return authentication.New(f, f.namespace, f.tweakListOptions) return networking.New(f, f.namespace, f.tweakListOptions)
}
func (f *sharedInformerFactory) Networking() istio.Interface {
return istio.New(f, f.namespace, f.tweakListOptions)
} }

View File

@ -21,10 +21,9 @@ package externalversions
import ( import (
"fmt" "fmt"
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
schema "k8s.io/apimachinery/pkg/runtime/schema" schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache" cache "k8s.io/client-go/tools/cache"
v1alpha1 "knative.dev/pkg/apis/istio/authentication/v1alpha1"
v1alpha3 "knative.dev/pkg/apis/istio/v1alpha3"
) )
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other // GenericInformer is type of SharedIndexInformer which will locate and delegate to other
@ -53,15 +52,17 @@ func (f *genericInformer) Lister() cache.GenericLister {
// TODO extend this to unknown resources with a client pool // TODO extend this to unknown resources with a client pool
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource { switch resource {
// Group=authentication.istio.io, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("policies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Authentication().V1alpha1().Policies().Informer()}, nil
// Group=networking.istio.io, Version=v1alpha3 // Group=networking.istio.io, Version=v1alpha3
case v1alpha3.SchemeGroupVersion.WithResource("destinationrules"): case v1alpha3.SchemeGroupVersion.WithResource("destinationrules"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().DestinationRules().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().DestinationRules().Informer()}, nil
case v1alpha3.SchemeGroupVersion.WithResource("envoyfilters"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().EnvoyFilters().Informer()}, nil
case v1alpha3.SchemeGroupVersion.WithResource("gateways"): case v1alpha3.SchemeGroupVersion.WithResource("gateways"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().Gateways().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().Gateways().Informer()}, nil
case v1alpha3.SchemeGroupVersion.WithResource("serviceentries"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().ServiceEntries().Informer()}, nil
case v1alpha3.SchemeGroupVersion.WithResource("sidecars"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().Sidecars().Informer()}, nil
case v1alpha3.SchemeGroupVersion.WithResource("virtualservices"): case v1alpha3.SchemeGroupVersion.WithResource("virtualservices"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().VirtualServices().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().VirtualServices().Informer()}, nil

View File

@ -24,7 +24,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
cache "k8s.io/client-go/tools/cache" cache "k8s.io/client-go/tools/cache"
versioned "knative.dev/pkg/client/clientset/versioned" versioned "knative.dev/pkg/client/istio/clientset/versioned"
) )
// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer.

View File

@ -19,8 +19,8 @@ limitations under the License.
package networking package networking
import ( import (
internalinterfaces "knative.dev/pkg/client/informers/externalversions/internalinterfaces" internalinterfaces "knative.dev/pkg/client/istio/informers/externalversions/internalinterfaces"
v1alpha3 "knative.dev/pkg/client/informers/externalversions/istio/v1alpha3" v1alpha3 "knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3"
) )
// Interface provides access to each of this group's versions. // Interface provides access to each of this group's versions.

View File

@ -21,14 +21,14 @@ package v1alpha3
import ( import (
time "time" time "time"
networkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache" cache "k8s.io/client-go/tools/cache"
istiov1alpha3 "knative.dev/pkg/apis/istio/v1alpha3" versioned "knative.dev/pkg/client/istio/clientset/versioned"
versioned "knative.dev/pkg/client/clientset/versioned" internalinterfaces "knative.dev/pkg/client/istio/informers/externalversions/internalinterfaces"
internalinterfaces "knative.dev/pkg/client/informers/externalversions/internalinterfaces" v1alpha3 "knative.dev/pkg/client/istio/listers/networking/v1alpha3"
v1alpha3 "knative.dev/pkg/client/listers/istio/v1alpha3"
) )
// DestinationRuleInformer provides access to a shared informer and lister for // DestinationRuleInformer provides access to a shared informer and lister for
@ -70,7 +70,7 @@ func NewFilteredDestinationRuleInformer(client versioned.Interface, namespace st
return client.NetworkingV1alpha3().DestinationRules(namespace).Watch(options) return client.NetworkingV1alpha3().DestinationRules(namespace).Watch(options)
}, },
}, },
&istiov1alpha3.DestinationRule{}, &networkingv1alpha3.DestinationRule{},
resyncPeriod, resyncPeriod,
indexers, indexers,
) )
@ -81,7 +81,7 @@ func (f *destinationRuleInformer) defaultInformer(client versioned.Interface, re
} }
func (f *destinationRuleInformer) Informer() cache.SharedIndexInformer { func (f *destinationRuleInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&istiov1alpha3.DestinationRule{}, f.defaultInformer) return f.factory.InformerFor(&networkingv1alpha3.DestinationRule{}, f.defaultInformer)
} }
func (f *destinationRuleInformer) Lister() v1alpha3.DestinationRuleLister { func (f *destinationRuleInformer) Lister() v1alpha3.DestinationRuleLister {

View File

@ -0,0 +1,89 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha3
import (
time "time"
networkingv1alpha3 "istio.io/client-go/pkg/apis/networking/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"
versioned "knative.dev/pkg/client/istio/clientset/versioned"
internalinterfaces "knative.dev/pkg/client/istio/informers/externalversions/internalinterfaces"
v1alpha3 "knative.dev/pkg/client/istio/listers/networking/v1alpha3"
)
// EnvoyFilterInformer provides access to a shared informer and lister for
// EnvoyFilters.
type EnvoyFilterInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha3.EnvoyFilterLister
}
type envoyFilterInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewEnvoyFilterInformer constructs a new informer for EnvoyFilter 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 NewEnvoyFilterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredEnvoyFilterInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredEnvoyFilterInformer constructs a new informer for EnvoyFilter 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 NewFilteredEnvoyFilterInformer(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().EnvoyFilters(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkingV1alpha3().EnvoyFilters(namespace).Watch(options)
},
},
&networkingv1alpha3.EnvoyFilter{},
resyncPeriod,
indexers,
)
}
func (f *envoyFilterInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredEnvoyFilterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *envoyFilterInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&networkingv1alpha3.EnvoyFilter{}, f.defaultInformer)
}
func (f *envoyFilterInformer) Lister() v1alpha3.EnvoyFilterLister {
return v1alpha3.NewEnvoyFilterLister(f.Informer().GetIndexer())
}

View File

@ -21,14 +21,14 @@ package v1alpha3
import ( import (
time "time" time "time"
networkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache" cache "k8s.io/client-go/tools/cache"
istiov1alpha3 "knative.dev/pkg/apis/istio/v1alpha3" versioned "knative.dev/pkg/client/istio/clientset/versioned"
versioned "knative.dev/pkg/client/clientset/versioned" internalinterfaces "knative.dev/pkg/client/istio/informers/externalversions/internalinterfaces"
internalinterfaces "knative.dev/pkg/client/informers/externalversions/internalinterfaces" v1alpha3 "knative.dev/pkg/client/istio/listers/networking/v1alpha3"
v1alpha3 "knative.dev/pkg/client/listers/istio/v1alpha3"
) )
// GatewayInformer provides access to a shared informer and lister for // GatewayInformer provides access to a shared informer and lister for
@ -70,7 +70,7 @@ func NewFilteredGatewayInformer(client versioned.Interface, namespace string, re
return client.NetworkingV1alpha3().Gateways(namespace).Watch(options) return client.NetworkingV1alpha3().Gateways(namespace).Watch(options)
}, },
}, },
&istiov1alpha3.Gateway{}, &networkingv1alpha3.Gateway{},
resyncPeriod, resyncPeriod,
indexers, indexers,
) )
@ -81,7 +81,7 @@ func (f *gatewayInformer) defaultInformer(client versioned.Interface, resyncPeri
} }
func (f *gatewayInformer) Informer() cache.SharedIndexInformer { func (f *gatewayInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&istiov1alpha3.Gateway{}, f.defaultInformer) return f.factory.InformerFor(&networkingv1alpha3.Gateway{}, f.defaultInformer)
} }
func (f *gatewayInformer) Lister() v1alpha3.GatewayLister { func (f *gatewayInformer) Lister() v1alpha3.GatewayLister {

View File

@ -19,15 +19,21 @@ limitations under the License.
package v1alpha3 package v1alpha3
import ( import (
internalinterfaces "knative.dev/pkg/client/informers/externalversions/internalinterfaces" internalinterfaces "knative.dev/pkg/client/istio/informers/externalversions/internalinterfaces"
) )
// Interface provides access to all the informers in this group version. // Interface provides access to all the informers in this group version.
type Interface interface { type Interface interface {
// DestinationRules returns a DestinationRuleInformer. // DestinationRules returns a DestinationRuleInformer.
DestinationRules() DestinationRuleInformer DestinationRules() DestinationRuleInformer
// EnvoyFilters returns a EnvoyFilterInformer.
EnvoyFilters() EnvoyFilterInformer
// Gateways returns a GatewayInformer. // Gateways returns a GatewayInformer.
Gateways() GatewayInformer Gateways() GatewayInformer
// ServiceEntries returns a ServiceEntryInformer.
ServiceEntries() ServiceEntryInformer
// Sidecars returns a SidecarInformer.
Sidecars() SidecarInformer
// VirtualServices returns a VirtualServiceInformer. // VirtualServices returns a VirtualServiceInformer.
VirtualServices() VirtualServiceInformer VirtualServices() VirtualServiceInformer
} }
@ -48,11 +54,26 @@ func (v *version) DestinationRules() DestinationRuleInformer {
return &destinationRuleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} return &destinationRuleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
} }
// EnvoyFilters returns a EnvoyFilterInformer.
func (v *version) EnvoyFilters() EnvoyFilterInformer {
return &envoyFilterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// Gateways returns a GatewayInformer. // Gateways returns a GatewayInformer.
func (v *version) Gateways() GatewayInformer { func (v *version) Gateways() GatewayInformer {
return &gatewayInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} return &gatewayInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
} }
// ServiceEntries returns a ServiceEntryInformer.
func (v *version) ServiceEntries() ServiceEntryInformer {
return &serviceEntryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// Sidecars returns a SidecarInformer.
func (v *version) Sidecars() SidecarInformer {
return &sidecarInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// VirtualServices returns a VirtualServiceInformer. // VirtualServices returns a VirtualServiceInformer.
func (v *version) VirtualServices() VirtualServiceInformer { func (v *version) VirtualServices() VirtualServiceInformer {
return &virtualServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} return &virtualServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}

View File

@ -0,0 +1,89 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha3
import (
time "time"
networkingv1alpha3 "istio.io/client-go/pkg/apis/networking/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"
versioned "knative.dev/pkg/client/istio/clientset/versioned"
internalinterfaces "knative.dev/pkg/client/istio/informers/externalversions/internalinterfaces"
v1alpha3 "knative.dev/pkg/client/istio/listers/networking/v1alpha3"
)
// ServiceEntryInformer provides access to a shared informer and lister for
// ServiceEntries.
type ServiceEntryInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha3.ServiceEntryLister
}
type serviceEntryInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewServiceEntryInformer constructs a new informer for ServiceEntry 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 NewServiceEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredServiceEntryInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredServiceEntryInformer constructs a new informer for ServiceEntry 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 NewFilteredServiceEntryInformer(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().ServiceEntries(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkingV1alpha3().ServiceEntries(namespace).Watch(options)
},
},
&networkingv1alpha3.ServiceEntry{},
resyncPeriod,
indexers,
)
}
func (f *serviceEntryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredServiceEntryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *serviceEntryInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&networkingv1alpha3.ServiceEntry{}, f.defaultInformer)
}
func (f *serviceEntryInformer) Lister() v1alpha3.ServiceEntryLister {
return v1alpha3.NewServiceEntryLister(f.Informer().GetIndexer())
}

View File

@ -0,0 +1,89 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha3
import (
time "time"
networkingv1alpha3 "istio.io/client-go/pkg/apis/networking/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"
versioned "knative.dev/pkg/client/istio/clientset/versioned"
internalinterfaces "knative.dev/pkg/client/istio/informers/externalversions/internalinterfaces"
v1alpha3 "knative.dev/pkg/client/istio/listers/networking/v1alpha3"
)
// SidecarInformer provides access to a shared informer and lister for
// Sidecars.
type SidecarInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha3.SidecarLister
}
type sidecarInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewSidecarInformer constructs a new informer for Sidecar 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 NewSidecarInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredSidecarInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredSidecarInformer constructs a new informer for Sidecar 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 NewFilteredSidecarInformer(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().Sidecars(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkingV1alpha3().Sidecars(namespace).Watch(options)
},
},
&networkingv1alpha3.Sidecar{},
resyncPeriod,
indexers,
)
}
func (f *sidecarInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredSidecarInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *sidecarInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&networkingv1alpha3.Sidecar{}, f.defaultInformer)
}
func (f *sidecarInformer) Lister() v1alpha3.SidecarLister {
return v1alpha3.NewSidecarLister(f.Informer().GetIndexer())
}

View File

@ -21,14 +21,14 @@ package v1alpha3
import ( import (
time "time" time "time"
networkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache" cache "k8s.io/client-go/tools/cache"
istiov1alpha3 "knative.dev/pkg/apis/istio/v1alpha3" versioned "knative.dev/pkg/client/istio/clientset/versioned"
versioned "knative.dev/pkg/client/clientset/versioned" internalinterfaces "knative.dev/pkg/client/istio/informers/externalversions/internalinterfaces"
internalinterfaces "knative.dev/pkg/client/informers/externalversions/internalinterfaces" v1alpha3 "knative.dev/pkg/client/istio/listers/networking/v1alpha3"
v1alpha3 "knative.dev/pkg/client/listers/istio/v1alpha3"
) )
// VirtualServiceInformer provides access to a shared informer and lister for // VirtualServiceInformer provides access to a shared informer and lister for
@ -70,7 +70,7 @@ func NewFilteredVirtualServiceInformer(client versioned.Interface, namespace str
return client.NetworkingV1alpha3().VirtualServices(namespace).Watch(options) return client.NetworkingV1alpha3().VirtualServices(namespace).Watch(options)
}, },
}, },
&istiov1alpha3.VirtualService{}, &networkingv1alpha3.VirtualService{},
resyncPeriod, resyncPeriod,
indexers, indexers,
) )
@ -81,7 +81,7 @@ func (f *virtualServiceInformer) defaultInformer(client versioned.Interface, res
} }
func (f *virtualServiceInformer) Informer() cache.SharedIndexInformer { func (f *virtualServiceInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&istiov1alpha3.VirtualService{}, f.defaultInformer) return f.factory.InformerFor(&networkingv1alpha3.VirtualService{}, f.defaultInformer)
} }
func (f *virtualServiceInformer) Lister() v1alpha3.VirtualServiceLister { func (f *virtualServiceInformer) Lister() v1alpha3.VirtualServiceLister {

View File

@ -22,7 +22,7 @@ import (
"context" "context"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
versioned "knative.dev/pkg/client/clientset/versioned" versioned "knative.dev/pkg/client/istio/clientset/versioned"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
logging "knative.dev/pkg/logging" logging "knative.dev/pkg/logging"
) )
@ -43,7 +43,7 @@ func Get(ctx context.Context) versioned.Interface {
untyped := ctx.Value(Key{}) untyped := ctx.Value(Key{})
if untyped == nil { if untyped == nil {
logging.FromContext(ctx).Panic( logging.FromContext(ctx).Panic(
"Unable to fetch knative.dev/pkg/client/clientset/versioned.Interface from context.") "Unable to fetch knative.dev/pkg/client/istio/clientset/versioned.Interface from context.")
} }
return untyped.(versioned.Interface) return untyped.(versioned.Interface)
} }

View File

@ -23,8 +23,8 @@ import (
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
fake "knative.dev/pkg/client/clientset/versioned/fake" fake "knative.dev/pkg/client/istio/clientset/versioned/fake"
client "knative.dev/pkg/client/injection/client" client "knative.dev/pkg/client/istio/injection/client"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
logging "knative.dev/pkg/logging" logging "knative.dev/pkg/logging"
) )
@ -48,7 +48,7 @@ func Get(ctx context.Context) *fake.Clientset {
untyped := ctx.Value(client.Key{}) untyped := ctx.Value(client.Key{})
if untyped == nil { if untyped == nil {
logging.FromContext(ctx).Panic( logging.FromContext(ctx).Panic(
"Unable to fetch knative.dev/pkg/client/clientset/versioned/fake.Clientset from context.") "Unable to fetch knative.dev/pkg/client/istio/clientset/versioned/fake.Clientset from context.")
} }
return untyped.(*fake.Clientset) return untyped.(*fake.Clientset)
} }

View File

@ -21,8 +21,8 @@ package factory
import ( import (
"context" "context"
externalversions "knative.dev/pkg/client/informers/externalversions" externalversions "knative.dev/pkg/client/istio/informers/externalversions"
client "knative.dev/pkg/client/injection/client" client "knative.dev/pkg/client/istio/injection/client"
controller "knative.dev/pkg/controller" controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
logging "knative.dev/pkg/logging" logging "knative.dev/pkg/logging"
@ -50,7 +50,7 @@ func Get(ctx context.Context) externalversions.SharedInformerFactory {
untyped := ctx.Value(Key{}) untyped := ctx.Value(Key{})
if untyped == nil { if untyped == nil {
logging.FromContext(ctx).Panic( logging.FromContext(ctx).Panic(
"Unable to fetch knative.dev/pkg/client/informers/externalversions.SharedInformerFactory from context.") "Unable to fetch knative.dev/pkg/client/istio/informers/externalversions.SharedInformerFactory from context.")
} }
return untyped.(externalversions.SharedInformerFactory) return untyped.(externalversions.SharedInformerFactory)
} }

View File

@ -21,9 +21,9 @@ package fake
import ( import (
"context" "context"
externalversions "knative.dev/pkg/client/informers/externalversions" externalversions "knative.dev/pkg/client/istio/informers/externalversions"
fake "knative.dev/pkg/client/injection/client/fake" fake "knative.dev/pkg/client/istio/injection/client/fake"
factory "knative.dev/pkg/client/injection/informers/factory" factory "knative.dev/pkg/client/istio/injection/informers/factory"
controller "knative.dev/pkg/controller" controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
) )

View File

@ -21,8 +21,8 @@ package destinationrule
import ( import (
"context" "context"
v1alpha3 "knative.dev/pkg/client/informers/externalversions/istio/v1alpha3" v1alpha3 "knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3"
factory "knative.dev/pkg/client/injection/informers/factory" factory "knative.dev/pkg/client/istio/injection/informers/factory"
controller "knative.dev/pkg/controller" controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
logging "knative.dev/pkg/logging" logging "knative.dev/pkg/logging"
@ -46,7 +46,7 @@ func Get(ctx context.Context) v1alpha3.DestinationRuleInformer {
untyped := ctx.Value(Key{}) untyped := ctx.Value(Key{})
if untyped == nil { if untyped == nil {
logging.FromContext(ctx).Panic( logging.FromContext(ctx).Panic(
"Unable to fetch knative.dev/pkg/client/informers/externalversions/istio/v1alpha3.DestinationRuleInformer from context.") "Unable to fetch knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3.DestinationRuleInformer from context.")
} }
return untyped.(v1alpha3.DestinationRuleInformer) return untyped.(v1alpha3.DestinationRuleInformer)
} }

View File

@ -21,8 +21,8 @@ package fake
import ( import (
"context" "context"
fake "knative.dev/pkg/client/injection/informers/factory/fake" fake "knative.dev/pkg/client/istio/injection/informers/factory/fake"
destinationrule "knative.dev/pkg/client/injection/informers/istio/v1alpha3/destinationrule" destinationrule "knative.dev/pkg/client/istio/injection/informers/networking/v1alpha3/destinationrule"
controller "knative.dev/pkg/controller" controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
) )

View File

@ -0,0 +1,52 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by injection-gen. DO NOT EDIT.
package envoyfilter
import (
"context"
v1alpha3 "knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3"
factory "knative.dev/pkg/client/istio/injection/informers/factory"
controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection"
logging "knative.dev/pkg/logging"
)
func init() {
injection.Default.RegisterInformer(withInformer)
}
// Key is used for associating the Informer inside the context.Context.
type Key struct{}
func withInformer(ctx context.Context) (context.Context, controller.Informer) {
f := factory.Get(ctx)
inf := f.Networking().V1alpha3().EnvoyFilters()
return context.WithValue(ctx, Key{}, inf), inf.Informer()
}
// Get extracts the typed informer from the context.
func Get(ctx context.Context) v1alpha3.EnvoyFilterInformer {
untyped := ctx.Value(Key{})
if untyped == nil {
logging.FromContext(ctx).Panic(
"Unable to fetch knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3.EnvoyFilterInformer from context.")
}
return untyped.(v1alpha3.EnvoyFilterInformer)
}

View File

@ -0,0 +1,40 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by injection-gen. DO NOT EDIT.
package fake
import (
"context"
fake "knative.dev/pkg/client/istio/injection/informers/factory/fake"
envoyfilter "knative.dev/pkg/client/istio/injection/informers/networking/v1alpha3/envoyfilter"
controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection"
)
var Get = envoyfilter.Get
func init() {
injection.Fake.RegisterInformer(withInformer)
}
func withInformer(ctx context.Context) (context.Context, controller.Informer) {
f := fake.Get(ctx)
inf := f.Networking().V1alpha3().EnvoyFilters()
return context.WithValue(ctx, envoyfilter.Key{}, inf), inf.Informer()
}

View File

@ -21,8 +21,8 @@ package fake
import ( import (
"context" "context"
fake "knative.dev/pkg/client/injection/informers/factory/fake" fake "knative.dev/pkg/client/istio/injection/informers/factory/fake"
gateway "knative.dev/pkg/client/injection/informers/istio/v1alpha3/gateway" gateway "knative.dev/pkg/client/istio/injection/informers/networking/v1alpha3/gateway"
controller "knative.dev/pkg/controller" controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
) )

View File

@ -21,8 +21,8 @@ package gateway
import ( import (
"context" "context"
v1alpha3 "knative.dev/pkg/client/informers/externalversions/istio/v1alpha3" v1alpha3 "knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3"
factory "knative.dev/pkg/client/injection/informers/factory" factory "knative.dev/pkg/client/istio/injection/informers/factory"
controller "knative.dev/pkg/controller" controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
logging "knative.dev/pkg/logging" logging "knative.dev/pkg/logging"
@ -46,7 +46,7 @@ func Get(ctx context.Context) v1alpha3.GatewayInformer {
untyped := ctx.Value(Key{}) untyped := ctx.Value(Key{})
if untyped == nil { if untyped == nil {
logging.FromContext(ctx).Panic( logging.FromContext(ctx).Panic(
"Unable to fetch knative.dev/pkg/client/informers/externalversions/istio/v1alpha3.GatewayInformer from context.") "Unable to fetch knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3.GatewayInformer from context.")
} }
return untyped.(v1alpha3.GatewayInformer) return untyped.(v1alpha3.GatewayInformer)
} }

View File

@ -0,0 +1,40 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by injection-gen. DO NOT EDIT.
package fake
import (
"context"
fake "knative.dev/pkg/client/istio/injection/informers/factory/fake"
serviceentry "knative.dev/pkg/client/istio/injection/informers/networking/v1alpha3/serviceentry"
controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection"
)
var Get = serviceentry.Get
func init() {
injection.Fake.RegisterInformer(withInformer)
}
func withInformer(ctx context.Context) (context.Context, controller.Informer) {
f := fake.Get(ctx)
inf := f.Networking().V1alpha3().ServiceEntries()
return context.WithValue(ctx, serviceentry.Key{}, inf), inf.Informer()
}

View File

@ -0,0 +1,52 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by injection-gen. DO NOT EDIT.
package serviceentry
import (
"context"
v1alpha3 "knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3"
factory "knative.dev/pkg/client/istio/injection/informers/factory"
controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection"
logging "knative.dev/pkg/logging"
)
func init() {
injection.Default.RegisterInformer(withInformer)
}
// Key is used for associating the Informer inside the context.Context.
type Key struct{}
func withInformer(ctx context.Context) (context.Context, controller.Informer) {
f := factory.Get(ctx)
inf := f.Networking().V1alpha3().ServiceEntries()
return context.WithValue(ctx, Key{}, inf), inf.Informer()
}
// Get extracts the typed informer from the context.
func Get(ctx context.Context) v1alpha3.ServiceEntryInformer {
untyped := ctx.Value(Key{})
if untyped == nil {
logging.FromContext(ctx).Panic(
"Unable to fetch knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3.ServiceEntryInformer from context.")
}
return untyped.(v1alpha3.ServiceEntryInformer)
}

View File

@ -21,13 +21,13 @@ package fake
import ( import (
"context" "context"
policy "knative.dev/pkg/client/injection/informers/authentication/v1alpha1/policy" fake "knative.dev/pkg/client/istio/injection/informers/factory/fake"
fake "knative.dev/pkg/client/injection/informers/factory/fake" sidecar "knative.dev/pkg/client/istio/injection/informers/networking/v1alpha3/sidecar"
controller "knative.dev/pkg/controller" controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
) )
var Get = policy.Get var Get = sidecar.Get
func init() { func init() {
injection.Fake.RegisterInformer(withInformer) injection.Fake.RegisterInformer(withInformer)
@ -35,6 +35,6 @@ func init() {
func withInformer(ctx context.Context) (context.Context, controller.Informer) { func withInformer(ctx context.Context) (context.Context, controller.Informer) {
f := fake.Get(ctx) f := fake.Get(ctx)
inf := f.Authentication().V1alpha1().Policies() inf := f.Networking().V1alpha3().Sidecars()
return context.WithValue(ctx, policy.Key{}, inf), inf.Informer() return context.WithValue(ctx, sidecar.Key{}, inf), inf.Informer()
} }

View File

@ -16,13 +16,13 @@ limitations under the License.
// Code generated by injection-gen. DO NOT EDIT. // Code generated by injection-gen. DO NOT EDIT.
package policy package sidecar
import ( import (
"context" "context"
v1alpha1 "knative.dev/pkg/client/informers/externalversions/authentication/v1alpha1" v1alpha3 "knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3"
factory "knative.dev/pkg/client/injection/informers/factory" factory "knative.dev/pkg/client/istio/injection/informers/factory"
controller "knative.dev/pkg/controller" controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
logging "knative.dev/pkg/logging" logging "knative.dev/pkg/logging"
@ -37,16 +37,16 @@ type Key struct{}
func withInformer(ctx context.Context) (context.Context, controller.Informer) { func withInformer(ctx context.Context) (context.Context, controller.Informer) {
f := factory.Get(ctx) f := factory.Get(ctx)
inf := f.Authentication().V1alpha1().Policies() inf := f.Networking().V1alpha3().Sidecars()
return context.WithValue(ctx, Key{}, inf), inf.Informer() return context.WithValue(ctx, Key{}, inf), inf.Informer()
} }
// Get extracts the typed informer from the context. // Get extracts the typed informer from the context.
func Get(ctx context.Context) v1alpha1.PolicyInformer { func Get(ctx context.Context) v1alpha3.SidecarInformer {
untyped := ctx.Value(Key{}) untyped := ctx.Value(Key{})
if untyped == nil { if untyped == nil {
logging.FromContext(ctx).Panic( logging.FromContext(ctx).Panic(
"Unable to fetch knative.dev/pkg/client/informers/externalversions/authentication/v1alpha1.PolicyInformer from context.") "Unable to fetch knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3.SidecarInformer from context.")
} }
return untyped.(v1alpha1.PolicyInformer) return untyped.(v1alpha3.SidecarInformer)
} }

View File

@ -21,8 +21,8 @@ package fake
import ( import (
"context" "context"
fake "knative.dev/pkg/client/injection/informers/factory/fake" fake "knative.dev/pkg/client/istio/injection/informers/factory/fake"
virtualservice "knative.dev/pkg/client/injection/informers/istio/v1alpha3/virtualservice" virtualservice "knative.dev/pkg/client/istio/injection/informers/networking/v1alpha3/virtualservice"
controller "knative.dev/pkg/controller" controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
) )

View File

@ -21,8 +21,8 @@ package virtualservice
import ( import (
"context" "context"
v1alpha3 "knative.dev/pkg/client/informers/externalversions/istio/v1alpha3" v1alpha3 "knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3"
factory "knative.dev/pkg/client/injection/informers/factory" factory "knative.dev/pkg/client/istio/injection/informers/factory"
controller "knative.dev/pkg/controller" controller "knative.dev/pkg/controller"
injection "knative.dev/pkg/injection" injection "knative.dev/pkg/injection"
logging "knative.dev/pkg/logging" logging "knative.dev/pkg/logging"
@ -46,7 +46,7 @@ func Get(ctx context.Context) v1alpha3.VirtualServiceInformer {
untyped := ctx.Value(Key{}) untyped := ctx.Value(Key{})
if untyped == nil { if untyped == nil {
logging.FromContext(ctx).Panic( logging.FromContext(ctx).Panic(
"Unable to fetch knative.dev/pkg/client/informers/externalversions/istio/v1alpha3.VirtualServiceInformer from context.") "Unable to fetch knative.dev/pkg/client/istio/informers/externalversions/networking/v1alpha3.VirtualServiceInformer from context.")
} }
return untyped.(v1alpha3.VirtualServiceInformer) return untyped.(v1alpha3.VirtualServiceInformer)
} }

View File

@ -19,10 +19,10 @@ limitations under the License.
package v1alpha3 package v1alpha3
import ( import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
v1alpha3 "knative.dev/pkg/apis/istio/v1alpha3"
) )
// DestinationRuleLister helps list DestinationRules. // DestinationRuleLister helps list DestinationRules.

View File

@ -0,0 +1,94 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha3
import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// EnvoyFilterLister helps list EnvoyFilters.
type EnvoyFilterLister interface {
// List lists all EnvoyFilters in the indexer.
List(selector labels.Selector) (ret []*v1alpha3.EnvoyFilter, err error)
// EnvoyFilters returns an object that can list and get EnvoyFilters.
EnvoyFilters(namespace string) EnvoyFilterNamespaceLister
EnvoyFilterListerExpansion
}
// envoyFilterLister implements the EnvoyFilterLister interface.
type envoyFilterLister struct {
indexer cache.Indexer
}
// NewEnvoyFilterLister returns a new EnvoyFilterLister.
func NewEnvoyFilterLister(indexer cache.Indexer) EnvoyFilterLister {
return &envoyFilterLister{indexer: indexer}
}
// List lists all EnvoyFilters in the indexer.
func (s *envoyFilterLister) List(selector labels.Selector) (ret []*v1alpha3.EnvoyFilter, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha3.EnvoyFilter))
})
return ret, err
}
// EnvoyFilters returns an object that can list and get EnvoyFilters.
func (s *envoyFilterLister) EnvoyFilters(namespace string) EnvoyFilterNamespaceLister {
return envoyFilterNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// EnvoyFilterNamespaceLister helps list and get EnvoyFilters.
type EnvoyFilterNamespaceLister interface {
// List lists all EnvoyFilters in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1alpha3.EnvoyFilter, err error)
// Get retrieves the EnvoyFilter from the indexer for a given namespace and name.
Get(name string) (*v1alpha3.EnvoyFilter, error)
EnvoyFilterNamespaceListerExpansion
}
// envoyFilterNamespaceLister implements the EnvoyFilterNamespaceLister
// interface.
type envoyFilterNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all EnvoyFilters in the indexer for a given namespace.
func (s envoyFilterNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.EnvoyFilter, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha3.EnvoyFilter))
})
return ret, err
}
// Get retrieves the EnvoyFilter from the indexer for a given namespace and name.
func (s envoyFilterNamespaceLister) Get(name string) (*v1alpha3.EnvoyFilter, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha3.Resource("envoyfilter"), name)
}
return obj.(*v1alpha3.EnvoyFilter), nil
}

View File

@ -26,6 +26,14 @@ type DestinationRuleListerExpansion interface{}
// DestinationRuleNamespaceLister. // DestinationRuleNamespaceLister.
type DestinationRuleNamespaceListerExpansion interface{} type DestinationRuleNamespaceListerExpansion interface{}
// EnvoyFilterListerExpansion allows custom methods to be added to
// EnvoyFilterLister.
type EnvoyFilterListerExpansion interface{}
// EnvoyFilterNamespaceListerExpansion allows custom methods to be added to
// EnvoyFilterNamespaceLister.
type EnvoyFilterNamespaceListerExpansion interface{}
// GatewayListerExpansion allows custom methods to be added to // GatewayListerExpansion allows custom methods to be added to
// GatewayLister. // GatewayLister.
type GatewayListerExpansion interface{} type GatewayListerExpansion interface{}
@ -34,6 +42,22 @@ type GatewayListerExpansion interface{}
// GatewayNamespaceLister. // GatewayNamespaceLister.
type GatewayNamespaceListerExpansion interface{} type GatewayNamespaceListerExpansion interface{}
// ServiceEntryListerExpansion allows custom methods to be added to
// ServiceEntryLister.
type ServiceEntryListerExpansion interface{}
// ServiceEntryNamespaceListerExpansion allows custom methods to be added to
// ServiceEntryNamespaceLister.
type ServiceEntryNamespaceListerExpansion interface{}
// SidecarListerExpansion allows custom methods to be added to
// SidecarLister.
type SidecarListerExpansion interface{}
// SidecarNamespaceListerExpansion allows custom methods to be added to
// SidecarNamespaceLister.
type SidecarNamespaceListerExpansion interface{}
// VirtualServiceListerExpansion allows custom methods to be added to // VirtualServiceListerExpansion allows custom methods to be added to
// VirtualServiceLister. // VirtualServiceLister.
type VirtualServiceListerExpansion interface{} type VirtualServiceListerExpansion interface{}

View File

@ -19,10 +19,10 @@ limitations under the License.
package v1alpha3 package v1alpha3
import ( import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
v1alpha3 "knative.dev/pkg/apis/istio/v1alpha3"
) )
// GatewayLister helps list Gateways. // GatewayLister helps list Gateways.

View File

@ -0,0 +1,94 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha3
import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// ServiceEntryLister helps list ServiceEntries.
type ServiceEntryLister interface {
// List lists all ServiceEntries in the indexer.
List(selector labels.Selector) (ret []*v1alpha3.ServiceEntry, err error)
// ServiceEntries returns an object that can list and get ServiceEntries.
ServiceEntries(namespace string) ServiceEntryNamespaceLister
ServiceEntryListerExpansion
}
// serviceEntryLister implements the ServiceEntryLister interface.
type serviceEntryLister struct {
indexer cache.Indexer
}
// NewServiceEntryLister returns a new ServiceEntryLister.
func NewServiceEntryLister(indexer cache.Indexer) ServiceEntryLister {
return &serviceEntryLister{indexer: indexer}
}
// List lists all ServiceEntries in the indexer.
func (s *serviceEntryLister) List(selector labels.Selector) (ret []*v1alpha3.ServiceEntry, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha3.ServiceEntry))
})
return ret, err
}
// ServiceEntries returns an object that can list and get ServiceEntries.
func (s *serviceEntryLister) ServiceEntries(namespace string) ServiceEntryNamespaceLister {
return serviceEntryNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ServiceEntryNamespaceLister helps list and get ServiceEntries.
type ServiceEntryNamespaceLister interface {
// List lists all ServiceEntries in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1alpha3.ServiceEntry, err error)
// Get retrieves the ServiceEntry from the indexer for a given namespace and name.
Get(name string) (*v1alpha3.ServiceEntry, error)
ServiceEntryNamespaceListerExpansion
}
// serviceEntryNamespaceLister implements the ServiceEntryNamespaceLister
// interface.
type serviceEntryNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ServiceEntries in the indexer for a given namespace.
func (s serviceEntryNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.ServiceEntry, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha3.ServiceEntry))
})
return ret, err
}
// Get retrieves the ServiceEntry from the indexer for a given namespace and name.
func (s serviceEntryNamespaceLister) Get(name string) (*v1alpha3.ServiceEntry, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha3.Resource("serviceentry"), name)
}
return obj.(*v1alpha3.ServiceEntry), nil
}

View File

@ -0,0 +1,94 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha3
import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// SidecarLister helps list Sidecars.
type SidecarLister interface {
// List lists all Sidecars in the indexer.
List(selector labels.Selector) (ret []*v1alpha3.Sidecar, err error)
// Sidecars returns an object that can list and get Sidecars.
Sidecars(namespace string) SidecarNamespaceLister
SidecarListerExpansion
}
// sidecarLister implements the SidecarLister interface.
type sidecarLister struct {
indexer cache.Indexer
}
// NewSidecarLister returns a new SidecarLister.
func NewSidecarLister(indexer cache.Indexer) SidecarLister {
return &sidecarLister{indexer: indexer}
}
// List lists all Sidecars in the indexer.
func (s *sidecarLister) List(selector labels.Selector) (ret []*v1alpha3.Sidecar, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha3.Sidecar))
})
return ret, err
}
// Sidecars returns an object that can list and get Sidecars.
func (s *sidecarLister) Sidecars(namespace string) SidecarNamespaceLister {
return sidecarNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// SidecarNamespaceLister helps list and get Sidecars.
type SidecarNamespaceLister interface {
// List lists all Sidecars in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1alpha3.Sidecar, err error)
// Get retrieves the Sidecar from the indexer for a given namespace and name.
Get(name string) (*v1alpha3.Sidecar, error)
SidecarNamespaceListerExpansion
}
// sidecarNamespaceLister implements the SidecarNamespaceLister
// interface.
type sidecarNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all Sidecars in the indexer for a given namespace.
func (s sidecarNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.Sidecar, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha3.Sidecar))
})
return ret, err
}
// Get retrieves the Sidecar from the indexer for a given namespace and name.
func (s sidecarNamespaceLister) Get(name string) (*v1alpha3.Sidecar, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha3.Resource("sidecar"), name)
}
return obj.(*v1alpha3.Sidecar), nil
}

View File

@ -19,10 +19,10 @@ limitations under the License.
package v1alpha3 package v1alpha3
import ( import (
v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
v1alpha3 "knative.dev/pkg/apis/istio/v1alpha3"
) )
// VirtualServiceLister helps list VirtualServices. // VirtualServiceLister helps list VirtualServices.

View File

@ -1,27 +0,0 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
// PolicyListerExpansion allows custom methods to be added to
// PolicyLister.
type PolicyListerExpansion interface{}
// PolicyNamespaceListerExpansion allows custom methods to be added to
// PolicyNamespaceLister.
type PolicyNamespaceListerExpansion interface{}

View File

@ -1,94 +0,0 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
v1alpha1 "knative.dev/pkg/apis/istio/authentication/v1alpha1"
)
// PolicyLister helps list Policies.
type PolicyLister interface {
// List lists all Policies in the indexer.
List(selector labels.Selector) (ret []*v1alpha1.Policy, err error)
// Policies returns an object that can list and get Policies.
Policies(namespace string) PolicyNamespaceLister
PolicyListerExpansion
}
// policyLister implements the PolicyLister interface.
type policyLister struct {
indexer cache.Indexer
}
// NewPolicyLister returns a new PolicyLister.
func NewPolicyLister(indexer cache.Indexer) PolicyLister {
return &policyLister{indexer: indexer}
}
// List lists all Policies in the indexer.
func (s *policyLister) List(selector labels.Selector) (ret []*v1alpha1.Policy, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Policy))
})
return ret, err
}
// Policies returns an object that can list and get Policies.
func (s *policyLister) Policies(namespace string) PolicyNamespaceLister {
return policyNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// PolicyNamespaceLister helps list and get Policies.
type PolicyNamespaceLister interface {
// List lists all Policies in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1alpha1.Policy, err error)
// Get retrieves the Policy from the indexer for a given namespace and name.
Get(name string) (*v1alpha1.Policy, error)
PolicyNamespaceListerExpansion
}
// policyNamespaceLister implements the PolicyNamespaceLister
// interface.
type policyNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all Policies in the indexer for a given namespace.
func (s policyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Policy, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Policy))
})
return ret, err
}
// Get retrieves the Policy from the indexer for a given namespace and name.
func (s policyNamespaceLister) Get(name string) (*v1alpha1.Policy, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("policy"), name)
}
return obj.(*v1alpha1.Policy), nil
}

View File

@ -0,0 +1,13 @@
diff --git a/vendor/istio.io/client-go/pkg/apis/networking/v1alpha3/doc.gen.go b/vendor/istio.io/client-go/pkg/apis/networking/v1alpha3/doc.go
similarity index 84%
rename from vendor/istio.io/client-go/pkg/apis/networking/v1alpha3/doc.gen.go
rename to vendor/istio.io/client-go/pkg/apis/networking/v1alpha3/doc.go
index 4fb1dd2..ecc1ecc 100644
--- a/vendor/istio.io/client-go/pkg/apis/networking/v1alpha3/doc.gen.go
+++ b/vendor/istio.io/client-go/pkg/apis/networking/v1alpha3/doc.go
@@ -3,4 +3,5 @@
// Package has auto-generated kube type wrappers for raw types.
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen=package
+// +groupName=networking.istio.io
package v1alpha3

View File

@ -28,15 +28,23 @@ go install $(dirname $0)/../vendor/k8s.io/code-generator/cmd/deepcopy-gen
# --output-base because this script should also be able to run inside the vendor dir of # --output-base because this script should also be able to run inside the vendor dir of
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
# instead of the $GOPATH directly. For normal projects this can be dropped. # instead of the $GOPATH directly. For normal projects this can be dropped.
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
knative.dev/pkg/client knative.dev/pkg/apis \
"istio:v1alpha3 istio/authentication:v1alpha1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
# Knative Injection # Knative Injection
${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \ ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \
knative.dev/pkg/client knative.dev/pkg/apis \ knative.dev/pkg/client knative.dev/pkg/apis \
"istio:v1alpha3 istio/authentication:v1alpha1 duck:v1alpha1,v1beta1,v1" \ "duck:v1alpha1,v1beta1,v1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
# Generate our own client for istio (otherwise injection won't work)
${CODEGEN_PKG}/generate-groups.sh "client,informer,lister" \
knative.dev/pkg/client/istio istio.io/client-go/pkg/apis \
"networking:v1alpha3" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
# Knative Injection (for istio)
${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \
knative.dev/pkg/client/istio istio.io/client-go/pkg/apis \
"networking:v1alpha3" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
OUTPUT_PKG="knative.dev/pkg/client/injection/kube" \ OUTPUT_PKG="knative.dev/pkg/client/injection/kube" \

View File

@ -28,3 +28,9 @@ dep ensure
rm -rf $(find vendor/ -name 'OWNERS') rm -rf $(find vendor/ -name 'OWNERS')
rm -rf $(find vendor/ -name '*_test.go') rm -rf $(find vendor/ -name '*_test.go')
# HACK HACK HACK
# Currently istio.io/client-go apis are missing groupName comment tags and that
# breaks our (and theirs for that matter) generated fake client sets.
# TODO(skaslev): Remove after istio/tools#549 and istio/client-go#22 get merged.
git apply ${REPO_ROOT_DIR}/hack/istio-client-missing-group-name.patch

View File

@ -27,12 +27,13 @@ import (
"knative.dev/pkg/apis" "knative.dev/pkg/apis"
pkgapisduck "knative.dev/pkg/apis/duck" pkgapisduck "knative.dev/pkg/apis/duck"
duckv1 "knative.dev/pkg/apis/duck/v1"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
"knative.dev/pkg/controller" "knative.dev/pkg/controller"
"knative.dev/pkg/network" "knative.dev/pkg/network"
"knative.dev/pkg/tracker" "knative.dev/pkg/tracker"
"knative.dev/pkg/client/injection/ducks/duck/v1beta1/addressable" "knative.dev/pkg/client/injection/ducks/duck/v1/addressable"
) )
// URIResolver resolves Destinations and ObjectReferences into a URI. // URIResolver resolves Destinations and ObjectReferences into a URI.
@ -41,7 +42,8 @@ type URIResolver struct {
informerFactory pkgapisduck.InformerFactory informerFactory pkgapisduck.InformerFactory
} }
// NewURIResolver constructs a new URIResolver with context and a callback passed to the URIResolver's tracker. // NewURIResolver constructs a new URIResolver with context and a callback
// for a given listableType (Listable) passed to the URIResolver's tracker.
func NewURIResolver(ctx context.Context, callback func(types.NamespacedName)) *URIResolver { func NewURIResolver(ctx context.Context, callback func(types.NamespacedName)) *URIResolver {
ret := &URIResolver{} ret := &URIResolver{}
@ -56,7 +58,7 @@ func NewURIResolver(ctx context.Context, callback func(types.NamespacedName)) *U
return ret return ret
} }
// URIFromDestination resolves a Destination into a URI string. // URIFromDestination resolves a v1beta1.Destination into a URI string.
func (r *URIResolver) URIFromDestination(dest duckv1beta1.Destination, parent interface{}) (string, error) { func (r *URIResolver) URIFromDestination(dest duckv1beta1.Destination, parent interface{}) (string, error) {
var deprecatedObjectReference *corev1.ObjectReference var deprecatedObjectReference *corev1.ObjectReference
if dest.DeprecatedAPIVersion == "" && dest.DeprecatedKind == "" && dest.DeprecatedName == "" && dest.DeprecatedNamespace == "" { if dest.DeprecatedAPIVersion == "" && dest.DeprecatedKind == "" && dest.DeprecatedName == "" && dest.DeprecatedNamespace == "" {
@ -70,7 +72,7 @@ func (r *URIResolver) URIFromDestination(dest duckv1beta1.Destination, parent in
} }
} }
if dest.Ref != nil && deprecatedObjectReference != nil { if dest.Ref != nil && deprecatedObjectReference != nil {
return "", fmt.Errorf("ref and [apiVersion, kind, name] can't be both present") return "", errors.New("ref and [apiVersion, kind, name] can't be both present")
} }
var ref *corev1.ObjectReference var ref *corev1.ObjectReference
if dest.Ref != nil { if dest.Ref != nil {
@ -85,7 +87,7 @@ func (r *URIResolver) URIFromDestination(dest duckv1beta1.Destination, parent in
} }
if dest.URI != nil { if dest.URI != nil {
if dest.URI.URL().IsAbs() { if dest.URI.URL().IsAbs() {
return "", fmt.Errorf("absolute URI is not allowed when Ref or [apiVersion, kind, name] exists") return "", errors.New("absolute URI is not allowed when Ref or [apiVersion, kind, name] exists")
} }
return url.URL().ResolveReference(dest.URI.URL()).String(), nil return url.URL().ResolveReference(dest.URI.URL()).String(), nil
} }
@ -100,7 +102,34 @@ func (r *URIResolver) URIFromDestination(dest duckv1beta1.Destination, parent in
return dest.URI.String(), nil return dest.URI.String(), nil
} }
return "", fmt.Errorf("destination missing Ref, [apiVersion, kind, name] and URI, expected at least one") return "", errors.New("destination missing Ref, [apiVersion, kind, name] and URI, expected at least one")
}
// URIFromDestinationV1 resolves a v1.Destination into a URI string.
func (r *URIResolver) URIFromDestinationV1(dest duckv1.Destination, parent interface{}) (string, error) {
if dest.Ref != nil {
url, err := r.URIFromObjectReference(dest.Ref, parent)
if err != nil {
return "", err
}
if dest.URI != nil {
if dest.URI.URL().IsAbs() {
return "", errors.New("absolute URI is not allowed when Ref or [apiVersion, kind, name] exists")
}
return url.URL().ResolveReference(dest.URI.URL()).String(), nil
}
return url.URL().String(), nil
}
if dest.URI != nil {
// IsAbs check whether the URL has a non-empty scheme. Besides the non non-empty scheme, we also require dest.URI has a non-empty host
if !dest.URI.URL().IsAbs() || dest.URI.Host == "" {
return "", fmt.Errorf("URI is not absolute(both scheme and host should be non-empty): %v", dest.URI.String())
}
return dest.URI.String(), nil
}
return "", errors.New("destination missing Ref and URI, expected at least one")
} }
// URIFromObjectReference resolves an ObjectReference to a URI string. // URIFromObjectReference resolves an ObjectReference to a URI string.
@ -136,7 +165,7 @@ func (r *URIResolver) URIFromObjectReference(ref *corev1.ObjectReference, parent
return nil, fmt.Errorf("failed to get ref %+v: %v", ref, err) return nil, fmt.Errorf("failed to get ref %+v: %v", ref, err)
} }
addressable, ok := obj.(*duckv1beta1.AddressableType) addressable, ok := obj.(*duckv1.AddressableType)
if !ok { if !ok {
return nil, fmt.Errorf("%+v is not an AddressableType", ref) return nil, fmt.Errorf("%+v is not an AddressableType", ref)
} }

View File

@ -20,12 +20,14 @@ limitations under the License.
package test package test
import ( import (
"bytes"
"flag" "flag"
"fmt" "fmt"
"os" "os"
"os/user" "os/user"
"path" "path"
"sync" "sync"
"text/template"
_ "github.com/golang/glog" // Needed if glog and klog are to coexist _ "github.com/golang/glog" // Needed if glog and klog are to coexist
"k8s.io/klog" "k8s.io/klog"
@ -56,6 +58,7 @@ type EnvironmentFlags struct {
IngressEndpoint string // Host to use for ingress endpoint IngressEndpoint string // Host to use for ingress endpoint
LogVerbose bool // Enable verbose logging LogVerbose bool // Enable verbose logging
EmitMetrics bool // Emit metrics EmitMetrics bool // Emit metrics
ImageTemplate string // Template to build the image reference (defaults to {{.Repository}}/{{.Name}}:{{.Tag}})
DockerRepo string // Docker repo (defaults to $KO_DOCKER_REPO) DockerRepo string // Docker repo (defaults to $KO_DOCKER_REPO)
Tag string // Tag for test images Tag string // Tag for test images
} }
@ -84,6 +87,9 @@ func initializeFlags() *EnvironmentFlags {
flag.BoolVar(&f.EmitMetrics, "emitmetrics", false, flag.BoolVar(&f.EmitMetrics, "emitmetrics", false,
"Set this flag to true if you would like tests to emit metrics, e.g. latency of resources being realized in the system.") "Set this flag to true if you would like tests to emit metrics, e.g. latency of resources being realized in the system.")
flag.StringVar(&f.ImageTemplate, "imagetemplate", "{{.Repository}}/{{.Name}}:{{.Tag}}",
"Provide a template to generate the reference to an image from the test. Defaults to `{{.Repository}}/{{.Name}}:{{.Tag}}`.")
defaultRepo := os.Getenv("KO_DOCKER_REPO") defaultRepo := os.Getenv("KO_DOCKER_REPO")
flag.StringVar(&f.DockerRepo, "dockerrepo", defaultRepo, flag.StringVar(&f.DockerRepo, "dockerrepo", defaultRepo,
"Provide the uri of the docker repo you have uploaded the test image to using `uploadtestimage.sh`. Defaults to $KO_DOCKER_REPO") "Provide the uri of the docker repo you have uploaded the test image to using `uploadtestimage.sh`. Defaults to $KO_DOCKER_REPO")
@ -135,7 +141,24 @@ func SetupLoggingFlags() {
}) })
} }
// ImagePath is a helper function to prefix image name with repo and suffix with tag // ImagePath is a helper function to transform an image name into an image reference that can be pulled.
func ImagePath(name string) string { func ImagePath(name string) string {
return fmt.Sprintf("%s/%s:%s", Flags.DockerRepo, name, Flags.Tag) tpl, err := template.New("image").Parse(Flags.ImageTemplate)
if err != nil {
panic("could not parse image template: " + err.Error())
}
var buf bytes.Buffer
if err := tpl.Execute(&buf, struct {
Repository string
Name string
Tag string
}{
Repository: Flags.DockerRepo,
Name: name,
Tag: Flags.Tag,
}); err != nil {
panic("could not apply the image template: " + err.Error())
}
return buf.String()
} }

View File

@ -22,6 +22,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"knative.dev/pkg/apis" "knative.dev/pkg/apis"
) )
@ -49,6 +50,11 @@ type ResourceSpec struct {
FieldThatsImmutableWithDefault string `json:"fieldThatsImmutableWithDefault,omitempty"` FieldThatsImmutableWithDefault string `json:"fieldThatsImmutableWithDefault,omitempty"`
} }
// GetGroupVersionKind returns the GroupVersionKind.
func (r *Resource) GetGroupVersionKind() schema.GroupVersionKind {
return SchemeGroupVersion.WithKind("Resource")
}
// GetUntypedSpec returns the spec of the resource. // GetUntypedSpec returns the spec of the resource.
func (r *Resource) GetUntypedSpec() interface{} { func (r *Resource) GetUntypedSpec() interface{} {
return r.Spec return r.Spec

View File

@ -21,8 +21,8 @@ import (
"encoding/json" "encoding/json"
"testing" "testing"
fakesharedclient "knative.dev/pkg/client/injection/client/fake"
fakekubeclient "knative.dev/pkg/client/injection/kube/client/fake" fakekubeclient "knative.dev/pkg/client/injection/kube/client/fake"
fakeistioclient "knative.dev/pkg/client/istio/injection/client/fake"
fakedynamicclient "knative.dev/pkg/injection/clients/dynamicclient/fake" fakedynamicclient "knative.dev/pkg/injection/clients/dynamicclient/fake"
"knative.dev/pkg/configmap" "knative.dev/pkg/configmap"
@ -62,7 +62,7 @@ func MakeFactory(ctor Ctor) rtesting.Factory {
ctx = logging.WithLogger(ctx, logger) ctx = logging.WithLogger(ctx, logger)
ctx, kubeClient := fakekubeclient.With(ctx, ls.GetKubeObjects()...) ctx, kubeClient := fakekubeclient.With(ctx, ls.GetKubeObjects()...)
ctx, sharedClient := fakesharedclient.With(ctx, ls.GetSharedObjects()...) ctx, istioClient := fakeistioclient.With(ctx, ls.GetIstioObjects()...)
ctx, dynamicClient := fakedynamicclient.With(ctx, ctx, dynamicClient := fakedynamicclient.With(ctx,
ls.NewScheme(), ToUnstructured(t, ls.NewScheme(), r.Objects)...) ls.NewScheme(), ToUnstructured(t, ls.NewScheme(), r.Objects)...)
@ -95,11 +95,11 @@ func MakeFactory(ctor Ctor) rtesting.Factory {
for _, reactor := range r.WithReactors { for _, reactor := range r.WithReactors {
kubeClient.PrependReactor("*", "*", reactor) kubeClient.PrependReactor("*", "*", reactor)
sharedClient.PrependReactor("*", "*", reactor) istioClient.PrependReactor("*", "*", reactor)
dynamicClient.PrependReactor("*", "*", reactor) dynamicClient.PrependReactor("*", "*", reactor)
} }
actionRecorderList := rtesting.ActionRecorderList{sharedClient, dynamicClient, kubeClient} actionRecorderList := rtesting.ActionRecorderList{istioClient, dynamicClient, kubeClient}
eventList := rtesting.EventList{Recorder: eventRecorder} eventList := rtesting.EventList{Recorder: eventRecorder}
return c, actionRecorderList, eventList, statsReporter return c, actionRecorderList, eventList, statsReporter

View File

@ -17,6 +17,7 @@ limitations under the License.
package testing package testing
import ( import (
istiov1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1"
@ -28,15 +29,14 @@ import (
autoscalingv2beta1listers "k8s.io/client-go/listers/autoscaling/v2beta1" autoscalingv2beta1listers "k8s.io/client-go/listers/autoscaling/v2beta1"
corev1listers "k8s.io/client-go/listers/core/v1" corev1listers "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
istiov1alpha3 "knative.dev/pkg/apis/istio/v1alpha3" fakeistioclientset "knative.dev/pkg/client/istio/clientset/versioned/fake"
fakesharedclientset "knative.dev/pkg/client/clientset/versioned/fake" istiolisters "knative.dev/pkg/client/istio/listers/networking/v1alpha3"
istiolisters "knative.dev/pkg/client/listers/istio/v1alpha3"
"knative.dev/pkg/reconciler/testing" "knative.dev/pkg/reconciler/testing"
) )
var clientSetSchemes = []func(*runtime.Scheme) error{ var clientSetSchemes = []func(*runtime.Scheme) error{
fakekubeclientset.AddToScheme, fakekubeclientset.AddToScheme,
fakesharedclientset.AddToScheme, fakeistioclientset.AddToScheme,
autoscalingv2beta1.AddToScheme, autoscalingv2beta1.AddToScheme,
} }
@ -83,9 +83,9 @@ func (l *Listers) GetKubeObjects() []runtime.Object {
return l.sorter.ObjectsForSchemeFunc(fakekubeclientset.AddToScheme) return l.sorter.ObjectsForSchemeFunc(fakekubeclientset.AddToScheme)
} }
// GetSharedObjects filters the Listers initial list of objects to types defined in knative/pkg // GetIstioObjects filters the Listers initial list of objects to types defined in knative/pkg
func (l *Listers) GetSharedObjects() []runtime.Object { func (l *Listers) GetIstioObjects() []runtime.Object {
return l.sorter.ObjectsForSchemeFunc(fakesharedclientset.AddToScheme) return l.sorter.ObjectsForSchemeFunc(fakeistioclientset.AddToScheme)
} }
// GetHorizontalPodAutoscalerLister gets lister for HorizontalPodAutoscaler resources. // GetHorizontalPodAutoscalerLister gets lister for HorizontalPodAutoscaler resources.