remove gateway types, fix rbac and add istio faq

Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
This commit is contained in:
Sanskar Jaiswal
2022-03-10 18:16:44 +05:30
parent e26a10b481
commit c9e53dd069
18 changed files with 96 additions and 1301 deletions
+26
View File
@@ -187,6 +187,32 @@ rules:
- update
- patch
- delete
- apiGroups:
- kuma.io
resources:
- trafficroutes
- trafficroutes/finalizers
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- gateway.networking.k8s.io
resources:
- httproutes
- httproutes/finalizers
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- nonResourceURLs:
- /version
verbs:
+13
View File
@@ -208,6 +208,19 @@ rules:
- update
- patch
- delete
- apiGroups:
- gateway.networking.k8s.io
resources:
- httproutes
- httproutes/finalizers
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- nonResourceURLs:
- /version
verbs:
+27
View File
@@ -495,6 +495,33 @@ histogram_quantile(0.99,
The analysis can be extended with metrics provided by Prometheus, Datadog, AWS CloudWatch, New Relic and Graphite.
For more details on how custom metrics can be used, please read the [metrics docs](usage/metrics.md).
#### Istio Gateway API
If you're using Istio with Gateway API, the Prometheus query needs to include `reporter="source"`. For example, to calculate HTTP requests error percentage, the query would be:
```javascript
100 - sum(
rate(
istio_requests_total{
reporter="source",
destination_workload_namespace=~"$namespace",
destination_workload=~"$workload",
response_code!~"5.*"
}[$interval]
)
)
/
sum(
rate(
istio_requests_total{
reporter="source",
destination_workload_namespace=~"$namespace",
destination_workload=~"$workload"
}[$interval]
)
) * 100
```
## Istio routing
#### How does Flagger interact with Istio?
+4 -5
View File
@@ -190,14 +190,9 @@ rules:
- update
- patch
- delete
- nonResourceURLs:
- /version
verbs:
- get
- apiGroups:
- gateway.networking.k8s.io
resources:
- gateways
- httproutes
- httproutes/finalizers
verbs:
@@ -208,6 +203,10 @@ rules:
- update
- patch
- delete
- nonResourceURLs:
- /version
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
@@ -1,513 +0,0 @@
/*
Copyright 2020 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="Class",type=string,JSONPath=`.spec.gatewayClassName`
// +kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.addresses[*].value`
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// Gateway represents an instance of a service-traffic handling infrastructure
// by binding Listeners to a set of IP addresses.
type Gateway struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec defines the desired state of Gateway.
Spec GatewaySpec `json:"spec"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// GatewayList contains a list of Gateways.
type GatewayList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Gateway `json:"items"`
}
// GatewaySpec defines the desired state of Gateway.
//
// Not all possible combinations of options specified in the Spec are
// valid. Some invalid configurations can be caught synchronously via a
// webhook, but there are many cases that will require asynchronous
// signaling via the GatewayStatus block.
type GatewaySpec struct {
// GatewayClassName used for this Gateway. This is the name of a
// GatewayClass resource.
GatewayClassName ObjectName `json:"gatewayClassName"`
// Listeners associated with this Gateway. Listeners define
// logical endpoints that are bound on this Gateway's addresses.
// At least one Listener MUST be specified.
//
// Each listener in a Gateway must have a unique combination of Hostname,
// Port, and Protocol.
//
// An implementation MAY group Listeners by Port and then collapse each
// group of Listeners into a single Listener if the implementation
// determines that the Listeners in the group are "compatible". An
// implementation MAY also group together and collapse compatible
// Listeners belonging to different Gateways.
//
// For example, an implementation might consider Listeners to be
// compatible with each other if all of the following conditions are
// met:
//
// 1. Either each Listener within the group specifies the "HTTP"
// Protocol or each Listener within the group specifies either
// the "HTTPS" or "TLS" Protocol.
//
// 2. Each Listener within the group specifies a Hostname that is unique
// within the group.
//
// 3. As a special case, one Listener within a group may omit Hostname,
// in which case this Listener matches when no other Listener
// matches.
//
// If the implementation does collapse compatible Listeners, the
// hostname provided in the incoming client request MUST be
// matched to a Listener to find the correct set of Routes.
// The incoming hostname MUST be matched using the Hostname
// field for each Listener in order of most to least specific.
// That is, exact matches must be processed before wildcard
// matches.
//
// If this field specifies multiple Listeners that have the same
// Port value but are not compatible, the implementation must raise
// a "Conflicted" condition in the Listener status.
//
// Support: Core
//
// +listType=map
// +listMapKey=name
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=64
Listeners []Listener `json:"listeners"`
// Addresses requested for this Gateway. This is optional and behavior can
// depend on the implementation. If a value is set in the spec and the
// requested address is invalid or unavailable, the implementation MUST
// indicate this in the associated entry in GatewayStatus.Addresses.
//
// The Addresses field represents a request for the address(es) on the
// "outside of the Gateway", that traffic bound for this Gateway will use.
// This could be the IP address or hostname of an external load balancer or
// other networking infrastructure, or some other address that traffic will
// be sent to.
//
// The .listener.hostname field is used to route traffic that has already
// arrived at the Gateway to the correct in-cluster destination.
//
// If no Addresses are specified, the implementation MAY schedule the
// Gateway in an implementation-specific manner, assigning an appropriate
// set of Addresses.
//
// The implementation MUST bind all Listeners to every GatewayAddress that
// it assigns to the Gateway and add a corresponding entry in
// GatewayStatus.Addresses.
//
// Support: Core
//
// +optional
// +kubebuilder:validation:MaxItems=16
Addresses []GatewayAddress `json:"addresses,omitempty"`
}
// Listener embodies the concept of a logical endpoint where a Gateway accepts
// network connections.
type Listener struct {
// Name is the name of the Listener. This name MUST be unique within a
// Gateway.
//
// Support: Core
Name SectionName `json:"name"`
// Hostname specifies the virtual hostname to match for protocol types that
// define this concept. When unspecified, all hostnames are matched. This
// field is ignored for protocols that don't require hostname based
// matching.
//
// Implementations MUST apply Hostname matching appropriately for each of
// the following protocols:
//
// * TLS: The Listener Hostname MUST match the SNI.
// * HTTP: The Listener Hostname MUST match the Host header of the request.
// * HTTPS: The Listener Hostname SHOULD match at both the TLS and HTTP
// protocol layers as described above. If an implementation does not
// ensure that both the SNI and Host header match the Listener hostname,
// it MUST clearly document that.
//
// For HTTPRoute and TLSRoute resources, there is an interaction with the
// `spec.hostnames` array. When both listener and route specify hostnames,
// there MUST be an intersection between the values for a Route to be
// accepted. For more information, refer to the Route specific Hostnames
// documentation.
//
// Support: Core
//
// +optional
Hostname *Hostname `json:"hostname,omitempty"`
// Port is the network port. Multiple listeners may use the
// same port, subject to the Listener compatibility rules.
//
// Support: Core
Port PortNumber `json:"port"`
// Protocol specifies the network protocol this listener expects to receive.
//
// Support: Core
Protocol ProtocolType `json:"protocol"`
// TLS is the TLS configuration for the Listener. This field is required if
// the Protocol field is "HTTPS" or "TLS". It is invalid to set this field
// if the Protocol field is "HTTP", "TCP", or "UDP".
//
// The association of SNIs to Certificate defined in GatewayTLSConfig is
// defined based on the Hostname field for this listener.
//
// The GatewayClass MUST use the longest matching SNI out of all
// available certificates for any TLS handshake.
//
// Support: Core
//
// +optional
TLS *GatewayTLSConfig `json:"tls,omitempty"`
// AllowedRoutes defines the types of routes that MAY be attached to a
// Listener and the trusted namespaces where those Route resources MAY be
// present.
//
// Although a client request may match multiple route rules, only one rule
// may ultimately receive the request. Matching precedence MUST be
// determined in order of the following criteria:
//
// * The most specific match as defined by the Route type.
// * The oldest Route based on creation timestamp. For example, a Route with
// a creation timestamp of "2020-09-08 01:02:03" is given precedence over
// a Route with a creation timestamp of "2020-09-08 01:02:04".
// * If everything else is equivalent, the Route appearing first in
// alphabetical order (namespace/name) should be given precedence. For
// example, foo/bar is given precedence over foo/baz.
//
// All valid rules within a Route attached to this Listener should be
// implemented. Invalid Route rules can be ignored (sometimes that will mean
// the full Route). If a Route rule transitions from valid to invalid,
// support for that Route rule should be dropped to ensure consistency. For
// example, even if a filter specified by a Route rule is invalid, the rest
// of the rules within that Route should still be supported.
//
// Support: Core
// +kubebuilder:default={namespaces:{from: Same}}
// +optional
AllowedRoutes *AllowedRoutes `json:"allowedRoutes,omitempty"`
}
// ProtocolType defines the application protocol accepted by a Listener.
// Implementations are not required to accept all the defined protocols.
// If an implementation does not support a specified protocol, it
// should raise a "Detached" condition for the affected Listener with
// a reason of "UnsupportedProtocol".
//
// Core ProtocolType values are listed in the table below.
//
// Implementations can define their own protocols if a core ProtocolType does not
// exist. Such definitions must use prefixed name, such as
// `mycompany.com/my-custom-protocol`. Un-prefixed names are reserved for core
// protocols. Any protocol defined by implementations will fall under custom
// conformance.
//
// Valid values include:
//
// * "HTTP" - Core support
// * "example.com/bar" - Implementation-specific support
//
// Invalid values include:
//
// * "example.com" - must include path if domain is used
// * "foo.example.com" - must include path if domain is used
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=255
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([-a-zSA-Z0-9]*[a-zA-Z0-9])?$|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9]+$`
type ProtocolType string
const (
// Accepts cleartext HTTP/1.1 sessions over TCP. Implementations MAY also
// support HTTP/2 over cleartext. If implementations support HTTP/2 over
// cleartext on "HTTP" listeners, that MUST be clearly documented by the
// implementation.
HTTPProtocolType ProtocolType = "HTTP"
// Accepts HTTP/1.1 or HTTP/2 sessions over TLS.
HTTPSProtocolType ProtocolType = "HTTPS"
// Accepts TLS sessions over TCP.
TLSProtocolType ProtocolType = "TLS"
// Accepts TCP sessions.
TCPProtocolType ProtocolType = "TCP"
// Accepts UDP packets.
UDPProtocolType ProtocolType = "UDP"
)
// GatewayTLSConfig describes a TLS configuration.
type GatewayTLSConfig struct {
// Mode defines the TLS behavior for the TLS session initiated by the client.
// There are two possible modes:
//
// - Terminate: The TLS session between the downstream client
// and the Gateway is terminated at the Gateway. This mode requires
// certificateRefs to be set and contain at least one element.
// - Passthrough: The TLS session is NOT terminated by the Gateway. This
// implies that the Gateway can't decipher the TLS stream except for
// the ClientHello message of the TLS protocol.
// CertificateRefs field is ignored in this mode.
//
// Support: Core
//
// +optional
// +kubebuilder:default=Terminate
Mode *TLSModeType `json:"mode,omitempty"`
// CertificateRefs contains a series of references to Kubernetes objects that
// contains TLS certificates and private keys. These certificates are used to
// establish a TLS handshake for requests that match the hostname of the
// associated listener.
//
// A single CertificateRef to a Kubernetes Secret has "Core" support.
// Implementations MAY choose to support attaching multiple certificates to
// a Listener, but this behavior is implementation-specific.
//
// References to a resource in different namespace are invalid UNLESS there
// is a ReferencePolicy in the target namespace that allows the certificate
// to be attached. If a ReferencePolicy does not allow this reference, the
// "ResolvedRefs" condition MUST be set to False for this listener with the
// "InvalidCertificateRef" reason.
//
// This field is required to have at least one element when the mode is set
// to "Terminate" (default) and is optional otherwise.
//
// CertificateRefs can reference to standard Kubernetes resources, i.e.
// Secret, or implementation-specific custom resources.
//
// Support: Core - A single reference to a Kubernetes Secret
//
// Support: Implementation-specific (More than one reference or other resource types)
//
// +optional
// +kubebuilder:validation:MaxItems=64
CertificateRefs []*SecretObjectReference `json:"certificateRefs,omitempty"`
// Options are a list of key/value pairs to enable extended TLS
// configuration for each implementation. For example, configuring the
// minimum TLS version or supported cipher suites.
//
// A set of common keys MAY be defined by the API in the future. To avoid
// any ambiguity, implementation-specific definitions MUST use
// domain-prefixed names, such as `example.com/my-custom-option`.
// Un-prefixed names are reserved for key names defined by Gateway API.
//
// Support: Implementation-specific
//
// +optional
// +kubebuilder:validation:MaxProperties=16
Options map[AnnotationKey]AnnotationValue `json:"options,omitempty"`
}
// TLSModeType type defines how a Gateway handles TLS sessions.
//
// +kubebuilder:validation:Enum=Terminate;Passthrough
type TLSModeType string
const (
// In this mode, TLS session between the downstream client
// and the Gateway is terminated at the Gateway.
TLSModeTerminate TLSModeType = "Terminate"
// In this mode, the TLS session is NOT terminated by the Gateway. This
// implies that the Gateway can't decipher the TLS stream except for
// the ClientHello message of the TLS protocol.
//
// Note that SSL passthrough is only supported by TLSRoute.
TLSModePassthrough TLSModeType = "Passthrough"
)
// AllowedRoutes defines which Routes may be attached to this Listener.
type AllowedRoutes struct {
// Namespaces indicates namespaces from which Routes may be attached to this
// Listener. This is restricted to the namespace of this Gateway by default.
//
// Support: Core
//
// +optional
// +kubebuilder:default={from: Same}
Namespaces *RouteNamespaces `json:"namespaces,omitempty"`
// Kinds specifies the groups and kinds of Routes that are allowed to bind
// to this Gateway Listener. When unspecified or empty, the kinds of Routes
// selected are determined using the Listener protocol.
//
// A RouteGroupKind MUST correspond to kinds of Routes that are compatible
// with the application protocol specified in the Listener's Protocol field.
// If an implementation does not support or recognize this resource type, it
// MUST set the "ResolvedRefs" condition to False for this Listener with the
// "InvalidRouteKinds" reason.
//
// Support: Core
//
// +optional
// +kubebuilder:validation:MaxItems=8
Kinds []RouteGroupKind `json:"kinds,omitempty"`
}
// FromNamespaces specifies namespace from which Routes may be attached to a
// Gateway.
//
// +kubebuilder:validation:Enum=All;Selector;Same
type FromNamespaces string
const (
// Routes in all namespaces may be attached to this Gateway.
NamespacesFromAll FromNamespaces = "All"
// Only Routes in namespaces selected by the selector may be attached to
// this Gateway.
NamespacesFromSelector FromNamespaces = "Selector"
// Only Routes in the same namespace as the Gateway may be attached to this
// Gateway.
NamespacesFromSame FromNamespaces = "Same"
)
// RouteNamespaces indicate which namespaces Routes should be selected from.
type RouteNamespaces struct {
// From indicates where Routes will be selected for this Gateway. Possible
// values are:
// * All: Routes in all namespaces may be used by this Gateway.
// * Selector: Routes in namespaces selected by the selector may be used by
// this Gateway.
// * Same: Only Routes in the same namespace may be used by this Gateway.
//
// Support: Core
//
// +optional
// +kubebuilder:default=Same
From *FromNamespaces `json:"from,omitempty"`
// Selector must be specified when From is set to "Selector". In that case,
// only Routes in Namespaces matching this Selector will be selected by this
// Gateway. This field is ignored for other values of "From".
//
// Support: Core
//
// +optional
Selector *metav1.LabelSelector `json:"selector,omitempty"`
}
// RouteGroupKind indicates the group and kind of a Route resource.
type RouteGroupKind struct {
// Group is the group of the Route.
//
// +optional
// +kubebuilder:default=gateway.networking.k8s.io
Group *Group `json:"group,omitempty"`
// Kind is the kind of the Route.
Kind Kind `json:"kind"`
}
// GatewayAddress describes an address that can be bound to a Gateway.
type GatewayAddress struct {
// Type of the address.
//
// +optional
// +kubebuilder:validation:Enum=IPAddress;Hostname;NamedAddress
// +kubebuilder:default=IPAddress
Type *AddressType `json:"type,omitempty"`
// Value of the address. The validity of the values will depend
// on the type and support by the controller.
//
// Examples: `1.2.3.4`, `128::1`, `my-ip-address`.
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Value string `json:"value"`
}
// AnnotationKey is the key of an annotation in Gateway API. This is used for
// validation of maps such as TLS options. This matches the Kubernetes
// "qualified name" validation that is used for annotations and other common
// values.
//
// Valid values include:
//
// * example
// * example.com
// * example.com/path
// * example.com/path.html
//
// Invalid values include:
//
// * example~ - "~" is an invalid character
// * example.com. - can not start or end with "."
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Pattern=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]/?)*$`
type AnnotationKey string
// AnnotationValue is the value of an annotation in Gateway API. This is used
// for validation of maps such as TLS options. This roughly matches Kubernetes
// annotation validation, although the length validation in that case is based
// on the entire size of the annotations struct.
//
// +kubebuilder:validation:MinLength=0
// +kubebuilder:validation:MaxLength=4096
type AnnotationValue string
// Hostname is the fully qualified domain name of a network host. This matches
// the RFC 1123 definition of a hostname with 2 notable exceptions:
//
// 1. IPs are not allowed.
// 2. A hostname may be prefixed with a wildcard label (`*.`). The wildcard
// label must appear by itself as the first label.
//
// Hostname can be "precise" which is a domain name without the terminating
// dot of a network host (e.g. "foo.example.com") or "wildcard", which is a
// domain name prefixed with a single wildcard label (e.g. `*.example.com`).
//
// Note that as per RFC1035 and RFC1123, a *label* must consist of lower case
// alphanumeric characters or '-', and must start and end with an alphanumeric
// character. No other punctuation is allowed.
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Pattern=`^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
type Hostname string
// PortNumber defines a network port.
//
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
type PortNumber int32
@@ -851,3 +851,29 @@ type HTTPBackendRef struct {
type HTTPRouteStatus struct {
RouteStatus `json:",inline"`
}
// Hostname is the fully qualified domain name of a network host. This matches
// the RFC 1123 definition of a hostname with 2 notable exceptions:
//
// 1. IPs are not allowed.
// 2. A hostname may be prefixed with a wildcard label (`*.`). The wildcard
// label must appear by itself as the first label.
//
// Hostname can be "precise" which is a domain name without the terminating
// dot of a network host (e.g. "foo.example.com") or "wildcard", which is a
// domain name prefixed with a single wildcard label (e.g. `*.example.com`).
//
// Note that as per RFC1035 and RFC1123, a *label* must consist of lower case
// alphanumeric characters or '-', and must start and end with an alphanumeric
// character. No other punctuation is allowed.
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Pattern=`^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
type Hostname string
// PortNumber defines a network port.
//
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
type PortNumber int32
-2
View File
@@ -31,8 +31,6 @@ var (
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&Gateway{},
&GatewayList{},
&HTTPRoute{},
&HTTPRouteList{},
)
@@ -77,34 +77,6 @@ func (in *AddressRouteMatches) DeepCopy() *AddressRouteMatches {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AllowedRoutes) DeepCopyInto(out *AllowedRoutes) {
*out = *in
if in.Namespaces != nil {
in, out := &in.Namespaces, &out.Namespaces
*out = new(RouteNamespaces)
(*in).DeepCopyInto(*out)
}
if in.Kinds != nil {
in, out := &in.Kinds, &out.Kinds
*out = make([]RouteGroupKind, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllowedRoutes.
func (in *AllowedRoutes) DeepCopy() *AllowedRoutes {
if in == nil {
return nil
}
out := new(AllowedRoutes)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BackendObjectReference) DeepCopyInto(out *BackendObjectReference) {
*out = *in
@@ -186,156 +158,6 @@ func (in *CommonRouteSpec) DeepCopy() *CommonRouteSpec {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Gateway) DeepCopyInto(out *Gateway) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Gateway.
func (in *Gateway) DeepCopy() *Gateway {
if in == nil {
return nil
}
out := new(Gateway)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Gateway) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GatewayAddress) DeepCopyInto(out *GatewayAddress) {
*out = *in
if in.Type != nil {
in, out := &in.Type, &out.Type
*out = new(AddressType)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayAddress.
func (in *GatewayAddress) DeepCopy() *GatewayAddress {
if in == nil {
return nil
}
out := new(GatewayAddress)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GatewayList) DeepCopyInto(out *GatewayList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Gateway, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayList.
func (in *GatewayList) DeepCopy() *GatewayList {
if in == nil {
return nil
}
out := new(GatewayList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *GatewayList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GatewaySpec) DeepCopyInto(out *GatewaySpec) {
*out = *in
if in.Listeners != nil {
in, out := &in.Listeners, &out.Listeners
*out = make([]Listener, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Addresses != nil {
in, out := &in.Addresses, &out.Addresses
*out = make([]GatewayAddress, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewaySpec.
func (in *GatewaySpec) DeepCopy() *GatewaySpec {
if in == nil {
return nil
}
out := new(GatewaySpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GatewayTLSConfig) DeepCopyInto(out *GatewayTLSConfig) {
*out = *in
if in.Mode != nil {
in, out := &in.Mode, &out.Mode
*out = new(TLSModeType)
**out = **in
}
if in.CertificateRefs != nil {
in, out := &in.CertificateRefs, &out.CertificateRefs
*out = make([]*SecretObjectReference, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(SecretObjectReference)
(*in).DeepCopyInto(*out)
}
}
}
if in.Options != nil {
in, out := &in.Options, &out.Options
*out = make(map[AnnotationKey]AnnotationValue, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayTLSConfig.
func (in *GatewayTLSConfig) DeepCopy() *GatewayTLSConfig {
if in == nil {
return nil
}
out := new(GatewayTLSConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HTTPBackendRef) DeepCopyInto(out *HTTPBackendRef) {
*out = *in
@@ -799,37 +621,6 @@ func (in *HTTPURLRewriteFilter) DeepCopy() *HTTPURLRewriteFilter {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Listener) DeepCopyInto(out *Listener) {
*out = *in
if in.Hostname != nil {
in, out := &in.Hostname, &out.Hostname
*out = new(Hostname)
**out = **in
}
if in.TLS != nil {
in, out := &in.TLS, &out.TLS
*out = new(GatewayTLSConfig)
(*in).DeepCopyInto(*out)
}
if in.AllowedRoutes != nil {
in, out := &in.AllowedRoutes, &out.AllowedRoutes
*out = new(AllowedRoutes)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Listener.
func (in *Listener) DeepCopy() *Listener {
if in == nil {
return nil
}
out := new(Listener)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LocalObjectReference) DeepCopyInto(out *LocalObjectReference) {
*out = *in
@@ -882,53 +673,6 @@ func (in *ParentReference) DeepCopy() *ParentReference {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RouteGroupKind) DeepCopyInto(out *RouteGroupKind) {
*out = *in
if in.Group != nil {
in, out := &in.Group, &out.Group
*out = new(Group)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteGroupKind.
func (in *RouteGroupKind) DeepCopy() *RouteGroupKind {
if in == nil {
return nil
}
out := new(RouteGroupKind)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RouteNamespaces) DeepCopyInto(out *RouteNamespaces) {
*out = *in
if in.From != nil {
in, out := &in.From, &out.From
*out = new(FromNamespaces)
**out = **in
}
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = new(v1.LabelSelector)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteNamespaces.
func (in *RouteNamespaces) DeepCopy() *RouteNamespaces {
if in == nil {
return nil
}
out := new(RouteNamespaces)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RouteParentStatus) DeepCopyInto(out *RouteParentStatus) {
*out = *in
@@ -1,130 +0,0 @@
/*
Copyright 2020 The Flux 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 (
"context"
v1alpha2 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1alpha2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeGateways implements GatewayInterface
type FakeGateways struct {
Fake *FakeGatewayapiV1alpha2
ns string
}
var gatewaysResource = schema.GroupVersionResource{Group: "gatewayapi", Version: "v1alpha2", Resource: "gateways"}
var gatewaysKind = schema.GroupVersionKind{Group: "gatewayapi", Version: "v1alpha2", Kind: "Gateway"}
// Get takes name of the gateway, and returns the corresponding gateway object, and an error if there is any.
func (c *FakeGateways) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.Gateway, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(gatewaysResource, c.ns, name), &v1alpha2.Gateway{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Gateway), err
}
// List takes label and field selectors, and returns the list of Gateways that match those selectors.
func (c *FakeGateways) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.GatewayList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(gatewaysResource, gatewaysKind, c.ns, opts), &v1alpha2.GatewayList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha2.GatewayList{ListMeta: obj.(*v1alpha2.GatewayList).ListMeta}
for _, item := range obj.(*v1alpha2.GatewayList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested gateways.
func (c *FakeGateways) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(gatewaysResource, c.ns, opts))
}
// Create takes the representation of a gateway and creates it. Returns the server's representation of the gateway, and an error, if there is any.
func (c *FakeGateways) Create(ctx context.Context, gateway *v1alpha2.Gateway, opts v1.CreateOptions) (result *v1alpha2.Gateway, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(gatewaysResource, c.ns, gateway), &v1alpha2.Gateway{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Gateway), err
}
// Update takes the representation of a gateway and updates it. Returns the server's representation of the gateway, and an error, if there is any.
func (c *FakeGateways) Update(ctx context.Context, gateway *v1alpha2.Gateway, opts v1.UpdateOptions) (result *v1alpha2.Gateway, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(gatewaysResource, c.ns, gateway), &v1alpha2.Gateway{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Gateway), err
}
// Delete takes name of the gateway and deletes it. Returns an error if one occurs.
func (c *FakeGateways) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(gatewaysResource, c.ns, name, opts), &v1alpha2.Gateway{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeGateways) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(gatewaysResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha2.GatewayList{})
return err
}
// Patch applies the patch and returns the patched gateway.
func (c *FakeGateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.Gateway, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(gatewaysResource, c.ns, name, pt, data, subresources...), &v1alpha2.Gateway{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.Gateway), err
}
@@ -28,10 +28,6 @@ type FakeGatewayapiV1alpha2 struct {
*testing.Fake
}
func (c *FakeGatewayapiV1alpha2) Gateways(namespace string) v1alpha2.GatewayInterface {
return &FakeGateways{c, namespace}
}
func (c *FakeGatewayapiV1alpha2) HTTPRoutes(namespace string) v1alpha2.HTTPRouteInterface {
return &FakeHTTPRoutes{c, namespace}
}
@@ -1,178 +0,0 @@
/*
Copyright 2020 The Flux 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 v1alpha2
import (
"context"
"time"
v1alpha2 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1alpha2"
scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// GatewaysGetter has a method to return a GatewayInterface.
// A group's client should implement this interface.
type GatewaysGetter interface {
Gateways(namespace string) GatewayInterface
}
// GatewayInterface has methods to work with Gateway resources.
type GatewayInterface interface {
Create(ctx context.Context, gateway *v1alpha2.Gateway, opts v1.CreateOptions) (*v1alpha2.Gateway, error)
Update(ctx context.Context, gateway *v1alpha2.Gateway, opts v1.UpdateOptions) (*v1alpha2.Gateway, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha2.Gateway, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.GatewayList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.Gateway, err error)
GatewayExpansion
}
// gateways implements GatewayInterface
type gateways struct {
client rest.Interface
ns string
}
// newGateways returns a Gateways
func newGateways(c *GatewayapiV1alpha2Client, namespace string) *gateways {
return &gateways{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the gateway, and returns the corresponding gateway object, and an error if there is any.
func (c *gateways) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.Gateway, err error) {
result = &v1alpha2.Gateway{}
err = c.client.Get().
Namespace(c.ns).
Resource("gateways").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Gateways that match those selectors.
func (c *gateways) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.GatewayList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha2.GatewayList{}
err = c.client.Get().
Namespace(c.ns).
Resource("gateways").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested gateways.
func (c *gateways) Watch(ctx context.Context, 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("gateways").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a gateway and creates it. Returns the server's representation of the gateway, and an error, if there is any.
func (c *gateways) Create(ctx context.Context, gateway *v1alpha2.Gateway, opts v1.CreateOptions) (result *v1alpha2.Gateway, err error) {
result = &v1alpha2.Gateway{}
err = c.client.Post().
Namespace(c.ns).
Resource("gateways").
VersionedParams(&opts, scheme.ParameterCodec).
Body(gateway).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a gateway and updates it. Returns the server's representation of the gateway, and an error, if there is any.
func (c *gateways) Update(ctx context.Context, gateway *v1alpha2.Gateway, opts v1.UpdateOptions) (result *v1alpha2.Gateway, err error) {
result = &v1alpha2.Gateway{}
err = c.client.Put().
Namespace(c.ns).
Resource("gateways").
Name(gateway.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(gateway).
Do(ctx).
Into(result)
return
}
// Delete takes name of the gateway and deletes it. Returns an error if one occurs.
func (c *gateways) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("gateways").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *gateways) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("gateways").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched gateway.
func (c *gateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.Gateway, err error) {
result = &v1alpha2.Gateway{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("gateways").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -28,7 +28,6 @@ import (
type GatewayapiV1alpha2Interface interface {
RESTClient() rest.Interface
GatewaysGetter
HTTPRoutesGetter
}
@@ -37,10 +36,6 @@ type GatewayapiV1alpha2Client struct {
restClient rest.Interface
}
func (c *GatewayapiV1alpha2Client) Gateways(namespace string) GatewayInterface {
return newGateways(c, namespace)
}
func (c *GatewayapiV1alpha2Client) HTTPRoutes(namespace string) HTTPRouteInterface {
return newHTTPRoutes(c, namespace)
}
@@ -18,6 +18,4 @@ limitations under the License.
package v1alpha2
type GatewayExpansion interface{}
type HTTPRouteExpansion interface{}
@@ -1,90 +0,0 @@
/*
Copyright 2020 The Flux 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 v1alpha2
import (
"context"
time "time"
gatewayapiv1alpha2 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1alpha2"
versioned "github.com/fluxcd/flagger/pkg/client/clientset/versioned"
internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces"
v1alpha2 "github.com/fluxcd/flagger/pkg/client/listers/gatewayapi/v1alpha2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
)
// GatewayInformer provides access to a shared informer and lister for
// Gateways.
type GatewayInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha2.GatewayLister
}
type gatewayInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewGatewayInformer constructs a new informer for Gateway type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewGatewayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredGatewayInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredGatewayInformer constructs a new informer for Gateway type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredGatewayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.GatewayapiV1alpha2().Gateways(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.GatewayapiV1alpha2().Gateways(namespace).Watch(context.TODO(), options)
},
},
&gatewayapiv1alpha2.Gateway{},
resyncPeriod,
indexers,
)
}
func (f *gatewayInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredGatewayInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *gatewayInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&gatewayapiv1alpha2.Gateway{}, f.defaultInformer)
}
func (f *gatewayInformer) Lister() v1alpha2.GatewayLister {
return v1alpha2.NewGatewayLister(f.Informer().GetIndexer())
}
@@ -24,8 +24,6 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
// Gateways returns a GatewayInformer.
Gateways() GatewayInformer
// HTTPRoutes returns a HTTPRouteInformer.
HTTPRoutes() HTTPRouteInformer
}
@@ -41,11 +39,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// Gateways returns a GatewayInformer.
func (v *version) Gateways() GatewayInformer {
return &gatewayInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// HTTPRoutes returns a HTTPRouteInformer.
func (v *version) HTTPRoutes() HTTPRouteInformer {
return &hTTPRouteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
@@ -93,8 +93,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1().RouteTables().Informer()}, nil
// Group=gatewayapi, Version=v1alpha2
case v1alpha2.SchemeGroupVersion.WithResource("gateways"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Gatewayapi().V1alpha2().Gateways().Informer()}, nil
case v1alpha2.SchemeGroupVersion.WithResource("httproutes"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Gatewayapi().V1alpha2().HTTPRoutes().Informer()}, nil
@@ -18,14 +18,6 @@ limitations under the License.
package v1alpha2
// GatewayListerExpansion allows custom methods to be added to
// GatewayLister.
type GatewayListerExpansion interface{}
// GatewayNamespaceListerExpansion allows custom methods to be added to
// GatewayNamespaceLister.
type GatewayNamespaceListerExpansion interface{}
// HTTPRouteListerExpansion allows custom methods to be added to
// HTTPRouteLister.
type HTTPRouteListerExpansion interface{}
@@ -1,99 +0,0 @@
/*
Copyright 2020 The Flux 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 v1alpha2
import (
v1alpha2 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1alpha2"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// GatewayLister helps list Gateways.
// All objects returned here must be treated as read-only.
type GatewayLister interface {
// List lists all Gateways in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha2.Gateway, err error)
// Gateways returns an object that can list and get Gateways.
Gateways(namespace string) GatewayNamespaceLister
GatewayListerExpansion
}
// gatewayLister implements the GatewayLister interface.
type gatewayLister struct {
indexer cache.Indexer
}
// NewGatewayLister returns a new GatewayLister.
func NewGatewayLister(indexer cache.Indexer) GatewayLister {
return &gatewayLister{indexer: indexer}
}
// List lists all Gateways in the indexer.
func (s *gatewayLister) List(selector labels.Selector) (ret []*v1alpha2.Gateway, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha2.Gateway))
})
return ret, err
}
// Gateways returns an object that can list and get Gateways.
func (s *gatewayLister) Gateways(namespace string) GatewayNamespaceLister {
return gatewayNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// GatewayNamespaceLister helps list and get Gateways.
// All objects returned here must be treated as read-only.
type GatewayNamespaceLister interface {
// List lists all Gateways in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha2.Gateway, err error)
// Get retrieves the Gateway from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha2.Gateway, error)
GatewayNamespaceListerExpansion
}
// gatewayNamespaceLister implements the GatewayNamespaceLister
// interface.
type gatewayNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all Gateways in the indexer for a given namespace.
func (s gatewayNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.Gateway, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha2.Gateway))
})
return ret, err
}
// Get retrieves the Gateway from the indexer for a given namespace and name.
func (s gatewayNamespaceLister) Get(name string) (*v1alpha2.Gateway, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha2.Resource("gateway"), name)
}
return obj.(*v1alpha2.Gateway), nil
}