diff --git a/.github/codecov.yml b/.github/codecov.yml index d8de57d94a9..0faad086e4b 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -16,3 +16,4 @@ ignore: - "**/*.pb.go" - "**/zz_generated.*.go" - "api/**/*_types.go" + - "pkg/client/**" diff --git a/api/v1alpha1/backend_types.go b/api/v1alpha1/backend_types.go index 9481d2ebadc..acbde67b6ed 100644 --- a/api/v1alpha1/backend_types.go +++ b/api/v1alpha1/backend_types.go @@ -29,6 +29,8 @@ const ( AppProtocolTypeWSS AppProtocolType = "gateway.envoyproxy.io/wss" ) +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // Backend allows the user to configure the endpoints of a backend and // the behavior of the connection from Envoy Proxy to the backend. // @@ -281,6 +283,7 @@ type BackendStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty"` } +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // BackendList contains a list of Backend resources. // // +kubebuilder:object:root=true @@ -291,5 +294,5 @@ type BackendList struct { } func init() { - SchemeBuilder.Register(&Backend{}, &BackendList{}) + localSchemeBuilder.Register(&Backend{}, &BackendList{}) } diff --git a/api/v1alpha1/backendtrafficpolicy_types.go b/api/v1alpha1/backendtrafficpolicy_types.go index 967985426bf..c9bb4ae2b8f 100644 --- a/api/v1alpha1/backendtrafficpolicy_types.go +++ b/api/v1alpha1/backendtrafficpolicy_types.go @@ -23,6 +23,8 @@ const ( // +kubebuilder:resource:categories=envoy-gateway,shortName=btp // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type BackendTrafficPolicy struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -165,6 +167,7 @@ type RequestBuffer struct { // BackendTrafficPolicyList contains a list of BackendTrafficPolicy resources. // // +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type BackendTrafficPolicyList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` @@ -172,5 +175,5 @@ type BackendTrafficPolicyList struct { } func init() { - SchemeBuilder.Register(&BackendTrafficPolicy{}, &BackendTrafficPolicyList{}) + localSchemeBuilder.Register(&BackendTrafficPolicy{}, &BackendTrafficPolicyList{}) } diff --git a/api/v1alpha1/clienttrafficpolicy_types.go b/api/v1alpha1/clienttrafficpolicy_types.go index a416e5487fd..9e571c067cf 100644 --- a/api/v1alpha1/clienttrafficpolicy_types.go +++ b/api/v1alpha1/clienttrafficpolicy_types.go @@ -22,6 +22,8 @@ const ( // ClientTrafficPolicy allows the user to configure the behavior of the connection // between the downstream client and Envoy Proxy listener. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type ClientTrafficPolicy struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -396,6 +398,7 @@ type ProxyProtocolSettings struct { //+kubebuilder:object:root=true // ClientTrafficPolicyList contains a list of ClientTrafficPolicy resources. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type ClientTrafficPolicyList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` @@ -403,5 +406,5 @@ type ClientTrafficPolicyList struct { } func init() { - SchemeBuilder.Register(&ClientTrafficPolicy{}, &ClientTrafficPolicyList{}) + localSchemeBuilder.Register(&ClientTrafficPolicy{}, &ClientTrafficPolicyList{}) } diff --git a/api/v1alpha1/doc.go b/api/v1alpha1/doc.go index 4e705afd0e9..ef7c364c280 100644 --- a/api/v1alpha1/doc.go +++ b/api/v1alpha1/doc.go @@ -6,6 +6,7 @@ // Package v1alpha1 contains API schema definitions for the gateway.envoyproxy.io // API group. // -// +kubebuilder:object:generate=true +// +k8s:deepcopy-gen=package // +groupName=gateway.envoyproxy.io +// +kubebuilder:object:generate=true package v1alpha1 diff --git a/api/v1alpha1/envoyextensionypolicy_types.go b/api/v1alpha1/envoyextensionypolicy_types.go index 67fc0d0fef8..b3b2b3df64e 100644 --- a/api/v1alpha1/envoyextensionypolicy_types.go +++ b/api/v1alpha1/envoyextensionypolicy_types.go @@ -21,6 +21,8 @@ const ( // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` // EnvoyExtensionPolicy allows the user to configure various envoy extensibility options for the Gateway. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type EnvoyExtensionPolicy struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -68,6 +70,7 @@ type EnvoyExtensionPolicySpec struct { //+kubebuilder:object:root=true // EnvoyExtensionPolicyList contains a list of EnvoyExtensionPolicy resources. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type EnvoyExtensionPolicyList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` @@ -75,5 +78,5 @@ type EnvoyExtensionPolicyList struct { } func init() { - SchemeBuilder.Register(&EnvoyExtensionPolicy{}, &EnvoyExtensionPolicyList{}) + localSchemeBuilder.Register(&EnvoyExtensionPolicy{}, &EnvoyExtensionPolicyList{}) } diff --git a/api/v1alpha1/envoygateway_types.go b/api/v1alpha1/envoygateway_types.go index 8434ee156c6..69c2a90aa64 100644 --- a/api/v1alpha1/envoygateway_types.go +++ b/api/v1alpha1/envoygateway_types.go @@ -852,5 +852,5 @@ type EnvoyGatewayTopologyInjector struct { } func init() { - SchemeBuilder.Register(&EnvoyGateway{}) + localSchemeBuilder.Register(&EnvoyGateway{}) } diff --git a/api/v1alpha1/envoypatchpolicy_types.go b/api/v1alpha1/envoypatchpolicy_types.go index ebf4a08ce41..94aa990011f 100644 --- a/api/v1alpha1/envoypatchpolicy_types.go +++ b/api/v1alpha1/envoypatchpolicy_types.go @@ -24,6 +24,8 @@ const ( // EnvoyPatchPolicy allows the user to modify the generated Envoy xDS // resources by Envoy Gateway using this patch API +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type EnvoyPatchPolicy struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -169,6 +171,7 @@ const ( //+kubebuilder:object:root=true // EnvoyPatchPolicyList contains a list of EnvoyPatchPolicy resources. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type EnvoyPatchPolicyList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` @@ -176,5 +179,5 @@ type EnvoyPatchPolicyList struct { } func init() { - SchemeBuilder.Register(&EnvoyPatchPolicy{}, &EnvoyPatchPolicyList{}) + localSchemeBuilder.Register(&EnvoyPatchPolicy{}, &EnvoyPatchPolicyList{}) } diff --git a/api/v1alpha1/envoyproxy_types.go b/api/v1alpha1/envoyproxy_types.go index 0db874ef3a8..cd4933d948b 100644 --- a/api/v1alpha1/envoyproxy_types.go +++ b/api/v1alpha1/envoyproxy_types.go @@ -20,6 +20,8 @@ const ( // +kubebuilder:subresource:status // EnvoyProxy is the schema for the envoyproxies API. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type EnvoyProxy struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -549,6 +551,7 @@ type EnvoyProxyStatus struct { // +kubebuilder:object:root=true // EnvoyProxyList contains a list of EnvoyProxy +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type EnvoyProxyList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` @@ -570,5 +573,5 @@ const ( ) func init() { - SchemeBuilder.Register(&EnvoyProxy{}, &EnvoyProxyList{}) + localSchemeBuilder.Register(&EnvoyProxy{}, &EnvoyProxyList{}) } diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index be4c68a538d..ab86d93ca4f 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -6,6 +6,8 @@ package v1alpha1 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "sigs.k8s.io/controller-runtime/pkg/scheme" ) @@ -13,13 +15,47 @@ import ( const GroupName = "gateway.envoyproxy.io" var ( - // GroupVersion is group version used to register these objects GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + // SchemeGroupVersion is an alias for GroupVersion for code-generator compatibility + SchemeGroupVersion = GroupVersion + // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + + // localSchemeBuilder is used for controller-runtime compatibility + localSchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme ) + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return GroupVersion.WithResource(resource).GroupResource() +} + +// addKnownTypes adds the set of types defined in this package to the supplied scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(GroupVersion, + &Backend{}, + &BackendList{}, + &BackendTrafficPolicy{}, + &BackendTrafficPolicyList{}, + &ClientTrafficPolicy{}, + &ClientTrafficPolicyList{}, + &EnvoyExtensionPolicy{}, + &EnvoyExtensionPolicyList{}, + &EnvoyPatchPolicy{}, + &EnvoyPatchPolicyList{}, + &EnvoyProxy{}, + &EnvoyProxyList{}, + &HTTPRouteFilter{}, + &HTTPRouteFilterList{}, + &SecurityPolicy{}, + &SecurityPolicyList{}, + ) + metav1.AddToGroupVersion(scheme, GroupVersion) + return nil +} diff --git a/api/v1alpha1/httproutefilter_types.go b/api/v1alpha1/httproutefilter_types.go index 29939b03ef2..87fa56f1dbf 100644 --- a/api/v1alpha1/httproutefilter_types.go +++ b/api/v1alpha1/httproutefilter_types.go @@ -24,6 +24,9 @@ const ( // HTTPRouteFilter is a custom Envoy Gateway HTTPRouteFilter which provides extended // traffic processing options such as path regex rewrite, direct response and more. +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type HTTPRouteFilter struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -188,6 +191,7 @@ type InjectedCredential struct { //+kubebuilder:object:root=true // HTTPRouteFilterList contains a list of HTTPRouteFilter resources. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type HTTPRouteFilterList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` @@ -195,5 +199,5 @@ type HTTPRouteFilterList struct { } func init() { - SchemeBuilder.Register(&HTTPRouteFilter{}, &HTTPRouteFilterList{}) + localSchemeBuilder.Register(&HTTPRouteFilter{}, &HTTPRouteFilterList{}) } diff --git a/api/v1alpha1/securitypolicy_types.go b/api/v1alpha1/securitypolicy_types.go index 3ec2c46c4c1..08cb1e63c6e 100644 --- a/api/v1alpha1/securitypolicy_types.go +++ b/api/v1alpha1/securitypolicy_types.go @@ -15,6 +15,8 @@ const ( KindSecurityPolicy = "SecurityPolicy" ) +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true // +kubebuilder:resource:categories=envoy-gateway,shortName=sp // +kubebuilder:subresource:status @@ -86,7 +88,8 @@ type SecurityPolicySpec struct { Authorization *Authorization `json:"authorization,omitempty"` } -//+kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true // SecurityPolicyList contains a list of SecurityPolicy resources. type SecurityPolicyList struct { @@ -96,5 +99,5 @@ type SecurityPolicyList struct { } func init() { - SchemeBuilder.Register(&SecurityPolicy{}, &SecurityPolicyList{}) + localSchemeBuilder.Register(&SecurityPolicy{}, &SecurityPolicyList{}) } diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index fe24643fa2f..65a0aafdd98 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -15,7 +15,7 @@ import ( corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/gateway-api/apis/v1" ) diff --git a/internal/cmd/egctl/config_ratelimit.go b/internal/cmd/egctl/config_ratelimit.go index 0653018dfbd..759c58c1a94 100644 --- a/internal/cmd/egctl/config_ratelimit.go +++ b/internal/cmd/egctl/config_ratelimit.go @@ -7,7 +7,6 @@ package egctl import ( "context" - "errors" "fmt" "io" "net/http" @@ -15,12 +14,10 @@ import ( "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/types" cmdutil "k8s.io/kubectl/pkg/cmd/util" - egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1" - "github.com/envoyproxy/gateway/internal/envoygateway" + "github.com/envoyproxy/gateway/internal/envoygateway/config" "github.com/envoyproxy/gateway/internal/infrastructure/kubernetes/ratelimit" "github.com/envoyproxy/gateway/internal/kubernetes" ) @@ -168,28 +165,16 @@ func checkEnableGlobalRateLimit(cli kubernetes.CLIClient) (bool, error) { return false, err } - config, ok := cm.Data[defaultConfigMapKey] + configData, ok := cm.Data[defaultConfigMapKey] if !ok { return false, fmt.Errorf("failed to get envoy-gateway configuration") } - decoder := serializer.NewCodecFactory(envoygateway.GetScheme()).UniversalDeserializer() - obj, gvk, err := decoder.Decode([]byte(config), nil, nil) + eg, err := config.DecodeBytes([]byte(configData)) if err != nil { return false, err } - if gvk.Group != egv1a1.GroupVersion.Group || - gvk.Version != egv1a1.GroupVersion.Version || - gvk.Kind != egv1a1.KindEnvoyGateway { - return false, errors.New("failed to decode unmatched resource type") - } - - eg, ok := obj.(*egv1a1.EnvoyGateway) - if !ok { - return false, errors.New("failed to convert object to EnvoyGateway type") - } - if eg.RateLimit == nil || eg.RateLimit.Backend.Redis == nil { return false, nil } diff --git a/internal/envoygateway/config/decoder.go b/internal/envoygateway/config/decoder.go index 68ca23b6485..2d3620474dd 100644 --- a/internal/envoygateway/config/decoder.go +++ b/internal/envoygateway/config/decoder.go @@ -9,20 +9,35 @@ import ( "errors" "os" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1" - "github.com/envoyproxy/gateway/internal/envoygateway" ) +// configScheme is a dedicated scheme for decoding EnvoyGateway configuration. +// EnvoyGateway is a configuration type loaded from files/ConfigMaps, not a CRD, +// so it should not be added to the main CRD scheme. +var configScheme = runtime.NewScheme() + +func init() { + // Register only the EnvoyGateway configuration type + configScheme.AddKnownTypes(egv1a1.GroupVersion, &egv1a1.EnvoyGateway{}) +} + func Decode(cfgPath string) (*egv1a1.EnvoyGateway, error) { data, err := os.ReadFile(cfgPath) if err != nil { return nil, err } - // Decode the config file. - decoder := serializer.NewCodecFactory(envoygateway.GetScheme()).UniversalDeserializer() + return DecodeBytes(data) +} + +// DecodeBytes decodes an EnvoyGateway configuration from bytes. +func DecodeBytes(data []byte) (*egv1a1.EnvoyGateway, error) { + // Decode the config using the dedicated config scheme. + decoder := serializer.NewCodecFactory(configScheme).UniversalDeserializer() obj, gvk, err := decoder.Decode(data, nil, nil) if err != nil { return nil, err diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go new file mode 100644 index 00000000000..06178d37a97 --- /dev/null +++ b/pkg/client/clientset/versioned/clientset.go @@ -0,0 +1,109 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + fmt "fmt" + http "net/http" + + gatewayv1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + GatewayV1alpha1() gatewayv1alpha1.GatewayV1alpha1Interface +} + +// Clientset contains the clients for groups. +type Clientset struct { + *discovery.DiscoveryClient + gatewayV1alpha1 *gatewayv1alpha1.GatewayV1alpha1Client +} + +// GatewayV1alpha1 retrieves the GatewayV1alpha1Client +func (c *Clientset) GatewayV1alpha1() gatewayv1alpha1.GatewayV1alpha1Interface { + return c.gatewayV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + + if configShallowCopy.UserAgent == "" { + configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() + } + + // share the transport between all clients + httpClient, err := rest.HTTPClientFor(&configShallowCopy) + if err != nil { + return nil, err + } + + return NewForConfigAndClient(&configShallowCopy, httpClient) +} + +// NewForConfigAndClient creates a new Clientset for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. +func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + + var cs Clientset + var err error + cs.gatewayV1alpha1, err = gatewayv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + cs, err := NewForConfig(c) + if err != nil { + panic(err) + } + return cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.gatewayV1alpha1 = gatewayv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 00000000000..b4495c03b96 --- /dev/null +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,83 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + clientset "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + gatewayv1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1" + fakegatewayv1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1/fake" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + var opts metav1.ListOptions + if watchActcion, ok := action.(testing.WatchActionImpl); ok { + opts = watchActcion.ListOptions + } + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns, opts) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery + tracker testing.ObjectTracker +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +func (c *Clientset) Tracker() testing.ObjectTracker { + return c.tracker +} + +var ( + _ clientset.Interface = &Clientset{} + _ testing.FakeClient = &Clientset{} +) + +// GatewayV1alpha1 retrieves the GatewayV1alpha1Client +func (c *Clientset) GatewayV1alpha1() gatewayv1alpha1.GatewayV1alpha1Interface { + return &fakegatewayv1alpha1.FakeGatewayV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/doc.go b/pkg/client/clientset/versioned/fake/doc.go new file mode 100644 index 00000000000..e5dd1a58c16 --- /dev/null +++ b/pkg/client/clientset/versioned/fake/doc.go @@ -0,0 +1,9 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go new file mode 100644 index 00000000000..66a25f28f2f --- /dev/null +++ b/pkg/client/clientset/versioned/fake/register.go @@ -0,0 +1,45 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + gatewayv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) + +var localSchemeBuilder = runtime.SchemeBuilder{ + gatewayv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/pkg/client/clientset/versioned/scheme/doc.go b/pkg/client/clientset/versioned/scheme/doc.go new file mode 100644 index 00000000000..5a49ce71d25 --- /dev/null +++ b/pkg/client/clientset/versioned/scheme/doc.go @@ -0,0 +1,9 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go new file mode 100644 index 00000000000..77705b0bb38 --- /dev/null +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -0,0 +1,45 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + gatewayv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + gatewayv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/api_client.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/api_client.go new file mode 100644 index 00000000000..41e435e84b9 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/api_client.go @@ -0,0 +1,125 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + http "net/http" + + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + scheme "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type GatewayV1alpha1Interface interface { + RESTClient() rest.Interface + BackendsGetter + BackendTrafficPoliciesGetter + ClientTrafficPoliciesGetter + EnvoyExtensionPoliciesGetter + EnvoyPatchPoliciesGetter + EnvoyProxiesGetter + HTTPRouteFiltersGetter + SecurityPoliciesGetter +} + +// GatewayV1alpha1Client is used to interact with features provided by the gateway.envoyproxy.io group. +type GatewayV1alpha1Client struct { + restClient rest.Interface +} + +func (c *GatewayV1alpha1Client) Backends(namespace string) BackendInterface { + return newBackends(c, namespace) +} + +func (c *GatewayV1alpha1Client) BackendTrafficPolicies(namespace string) BackendTrafficPolicyInterface { + return newBackendTrafficPolicies(c, namespace) +} + +func (c *GatewayV1alpha1Client) ClientTrafficPolicies(namespace string) ClientTrafficPolicyInterface { + return newClientTrafficPolicies(c, namespace) +} + +func (c *GatewayV1alpha1Client) EnvoyExtensionPolicies(namespace string) EnvoyExtensionPolicyInterface { + return newEnvoyExtensionPolicies(c, namespace) +} + +func (c *GatewayV1alpha1Client) EnvoyPatchPolicies(namespace string) EnvoyPatchPolicyInterface { + return newEnvoyPatchPolicies(c, namespace) +} + +func (c *GatewayV1alpha1Client) EnvoyProxies(namespace string) EnvoyProxyInterface { + return newEnvoyProxies(c, namespace) +} + +func (c *GatewayV1alpha1Client) HTTPRouteFilters(namespace string) HTTPRouteFilterInterface { + return newHTTPRouteFilters(c, namespace) +} + +func (c *GatewayV1alpha1Client) SecurityPolicies(namespace string) SecurityPolicyInterface { + return newSecurityPolicies(c, namespace) +} + +// NewForConfig creates a new GatewayV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*GatewayV1alpha1Client, error) { + config := *c + setConfigDefaults(&config) + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new GatewayV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*GatewayV1alpha1Client, error) { + config := *c + setConfigDefaults(&config) + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &GatewayV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new GatewayV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *GatewayV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new GatewayV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *GatewayV1alpha1Client { + return &GatewayV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) { + gv := apiv1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *GatewayV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/backend.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/backend.go new file mode 100644 index 00000000000..e2a2b1cb9c7 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/backend.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + scheme "github.com/envoyproxy/gateway/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" + gentype "k8s.io/client-go/gentype" +) + +// BackendsGetter has a method to return a BackendInterface. +// A group's client should implement this interface. +type BackendsGetter interface { + Backends(namespace string) BackendInterface +} + +// BackendInterface has methods to work with Backend resources. +type BackendInterface interface { + Create(ctx context.Context, backend *apiv1alpha1.Backend, opts v1.CreateOptions) (*apiv1alpha1.Backend, error) + Update(ctx context.Context, backend *apiv1alpha1.Backend, opts v1.UpdateOptions) (*apiv1alpha1.Backend, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, backend *apiv1alpha1.Backend, opts v1.UpdateOptions) (*apiv1alpha1.Backend, 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) (*apiv1alpha1.Backend, error) + List(ctx context.Context, opts v1.ListOptions) (*apiv1alpha1.BackendList, 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 *apiv1alpha1.Backend, err error) + BackendExpansion +} + +// backends implements BackendInterface +type backends struct { + *gentype.ClientWithList[*apiv1alpha1.Backend, *apiv1alpha1.BackendList] +} + +// newBackends returns a Backends +func newBackends(c *GatewayV1alpha1Client, namespace string) *backends { + return &backends{ + gentype.NewClientWithList[*apiv1alpha1.Backend, *apiv1alpha1.BackendList]( + "backends", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *apiv1alpha1.Backend { return &apiv1alpha1.Backend{} }, + func() *apiv1alpha1.BackendList { return &apiv1alpha1.BackendList{} }, + ), + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/backendtrafficpolicy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/backendtrafficpolicy.go new file mode 100644 index 00000000000..571bc96e3b0 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/backendtrafficpolicy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + scheme "github.com/envoyproxy/gateway/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" + gentype "k8s.io/client-go/gentype" +) + +// BackendTrafficPoliciesGetter has a method to return a BackendTrafficPolicyInterface. +// A group's client should implement this interface. +type BackendTrafficPoliciesGetter interface { + BackendTrafficPolicies(namespace string) BackendTrafficPolicyInterface +} + +// BackendTrafficPolicyInterface has methods to work with BackendTrafficPolicy resources. +type BackendTrafficPolicyInterface interface { + Create(ctx context.Context, backendTrafficPolicy *apiv1alpha1.BackendTrafficPolicy, opts v1.CreateOptions) (*apiv1alpha1.BackendTrafficPolicy, error) + Update(ctx context.Context, backendTrafficPolicy *apiv1alpha1.BackendTrafficPolicy, opts v1.UpdateOptions) (*apiv1alpha1.BackendTrafficPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, backendTrafficPolicy *apiv1alpha1.BackendTrafficPolicy, opts v1.UpdateOptions) (*apiv1alpha1.BackendTrafficPolicy, 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) (*apiv1alpha1.BackendTrafficPolicy, error) + List(ctx context.Context, opts v1.ListOptions) (*apiv1alpha1.BackendTrafficPolicyList, 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 *apiv1alpha1.BackendTrafficPolicy, err error) + BackendTrafficPolicyExpansion +} + +// backendTrafficPolicies implements BackendTrafficPolicyInterface +type backendTrafficPolicies struct { + *gentype.ClientWithList[*apiv1alpha1.BackendTrafficPolicy, *apiv1alpha1.BackendTrafficPolicyList] +} + +// newBackendTrafficPolicies returns a BackendTrafficPolicies +func newBackendTrafficPolicies(c *GatewayV1alpha1Client, namespace string) *backendTrafficPolicies { + return &backendTrafficPolicies{ + gentype.NewClientWithList[*apiv1alpha1.BackendTrafficPolicy, *apiv1alpha1.BackendTrafficPolicyList]( + "backendtrafficpolicies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *apiv1alpha1.BackendTrafficPolicy { return &apiv1alpha1.BackendTrafficPolicy{} }, + func() *apiv1alpha1.BackendTrafficPolicyList { return &apiv1alpha1.BackendTrafficPolicyList{} }, + ), + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/clienttrafficpolicy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/clienttrafficpolicy.go new file mode 100644 index 00000000000..24d77297716 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/clienttrafficpolicy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + scheme "github.com/envoyproxy/gateway/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" + gentype "k8s.io/client-go/gentype" +) + +// ClientTrafficPoliciesGetter has a method to return a ClientTrafficPolicyInterface. +// A group's client should implement this interface. +type ClientTrafficPoliciesGetter interface { + ClientTrafficPolicies(namespace string) ClientTrafficPolicyInterface +} + +// ClientTrafficPolicyInterface has methods to work with ClientTrafficPolicy resources. +type ClientTrafficPolicyInterface interface { + Create(ctx context.Context, clientTrafficPolicy *apiv1alpha1.ClientTrafficPolicy, opts v1.CreateOptions) (*apiv1alpha1.ClientTrafficPolicy, error) + Update(ctx context.Context, clientTrafficPolicy *apiv1alpha1.ClientTrafficPolicy, opts v1.UpdateOptions) (*apiv1alpha1.ClientTrafficPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, clientTrafficPolicy *apiv1alpha1.ClientTrafficPolicy, opts v1.UpdateOptions) (*apiv1alpha1.ClientTrafficPolicy, 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) (*apiv1alpha1.ClientTrafficPolicy, error) + List(ctx context.Context, opts v1.ListOptions) (*apiv1alpha1.ClientTrafficPolicyList, 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 *apiv1alpha1.ClientTrafficPolicy, err error) + ClientTrafficPolicyExpansion +} + +// clientTrafficPolicies implements ClientTrafficPolicyInterface +type clientTrafficPolicies struct { + *gentype.ClientWithList[*apiv1alpha1.ClientTrafficPolicy, *apiv1alpha1.ClientTrafficPolicyList] +} + +// newClientTrafficPolicies returns a ClientTrafficPolicies +func newClientTrafficPolicies(c *GatewayV1alpha1Client, namespace string) *clientTrafficPolicies { + return &clientTrafficPolicies{ + gentype.NewClientWithList[*apiv1alpha1.ClientTrafficPolicy, *apiv1alpha1.ClientTrafficPolicyList]( + "clienttrafficpolicies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *apiv1alpha1.ClientTrafficPolicy { return &apiv1alpha1.ClientTrafficPolicy{} }, + func() *apiv1alpha1.ClientTrafficPolicyList { return &apiv1alpha1.ClientTrafficPolicyList{} }, + ), + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/doc.go new file mode 100644 index 00000000000..a641105ed19 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/doc.go @@ -0,0 +1,9 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/envoyextensionpolicy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/envoyextensionpolicy.go new file mode 100644 index 00000000000..4ade1d66d40 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/envoyextensionpolicy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + scheme "github.com/envoyproxy/gateway/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" + gentype "k8s.io/client-go/gentype" +) + +// EnvoyExtensionPoliciesGetter has a method to return a EnvoyExtensionPolicyInterface. +// A group's client should implement this interface. +type EnvoyExtensionPoliciesGetter interface { + EnvoyExtensionPolicies(namespace string) EnvoyExtensionPolicyInterface +} + +// EnvoyExtensionPolicyInterface has methods to work with EnvoyExtensionPolicy resources. +type EnvoyExtensionPolicyInterface interface { + Create(ctx context.Context, envoyExtensionPolicy *apiv1alpha1.EnvoyExtensionPolicy, opts v1.CreateOptions) (*apiv1alpha1.EnvoyExtensionPolicy, error) + Update(ctx context.Context, envoyExtensionPolicy *apiv1alpha1.EnvoyExtensionPolicy, opts v1.UpdateOptions) (*apiv1alpha1.EnvoyExtensionPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, envoyExtensionPolicy *apiv1alpha1.EnvoyExtensionPolicy, opts v1.UpdateOptions) (*apiv1alpha1.EnvoyExtensionPolicy, 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) (*apiv1alpha1.EnvoyExtensionPolicy, error) + List(ctx context.Context, opts v1.ListOptions) (*apiv1alpha1.EnvoyExtensionPolicyList, 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 *apiv1alpha1.EnvoyExtensionPolicy, err error) + EnvoyExtensionPolicyExpansion +} + +// envoyExtensionPolicies implements EnvoyExtensionPolicyInterface +type envoyExtensionPolicies struct { + *gentype.ClientWithList[*apiv1alpha1.EnvoyExtensionPolicy, *apiv1alpha1.EnvoyExtensionPolicyList] +} + +// newEnvoyExtensionPolicies returns a EnvoyExtensionPolicies +func newEnvoyExtensionPolicies(c *GatewayV1alpha1Client, namespace string) *envoyExtensionPolicies { + return &envoyExtensionPolicies{ + gentype.NewClientWithList[*apiv1alpha1.EnvoyExtensionPolicy, *apiv1alpha1.EnvoyExtensionPolicyList]( + "envoyextensionpolicies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *apiv1alpha1.EnvoyExtensionPolicy { return &apiv1alpha1.EnvoyExtensionPolicy{} }, + func() *apiv1alpha1.EnvoyExtensionPolicyList { return &apiv1alpha1.EnvoyExtensionPolicyList{} }, + ), + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/envoypatchpolicy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/envoypatchpolicy.go new file mode 100644 index 00000000000..13289891e94 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/envoypatchpolicy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + scheme "github.com/envoyproxy/gateway/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" + gentype "k8s.io/client-go/gentype" +) + +// EnvoyPatchPoliciesGetter has a method to return a EnvoyPatchPolicyInterface. +// A group's client should implement this interface. +type EnvoyPatchPoliciesGetter interface { + EnvoyPatchPolicies(namespace string) EnvoyPatchPolicyInterface +} + +// EnvoyPatchPolicyInterface has methods to work with EnvoyPatchPolicy resources. +type EnvoyPatchPolicyInterface interface { + Create(ctx context.Context, envoyPatchPolicy *apiv1alpha1.EnvoyPatchPolicy, opts v1.CreateOptions) (*apiv1alpha1.EnvoyPatchPolicy, error) + Update(ctx context.Context, envoyPatchPolicy *apiv1alpha1.EnvoyPatchPolicy, opts v1.UpdateOptions) (*apiv1alpha1.EnvoyPatchPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, envoyPatchPolicy *apiv1alpha1.EnvoyPatchPolicy, opts v1.UpdateOptions) (*apiv1alpha1.EnvoyPatchPolicy, 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) (*apiv1alpha1.EnvoyPatchPolicy, error) + List(ctx context.Context, opts v1.ListOptions) (*apiv1alpha1.EnvoyPatchPolicyList, 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 *apiv1alpha1.EnvoyPatchPolicy, err error) + EnvoyPatchPolicyExpansion +} + +// envoyPatchPolicies implements EnvoyPatchPolicyInterface +type envoyPatchPolicies struct { + *gentype.ClientWithList[*apiv1alpha1.EnvoyPatchPolicy, *apiv1alpha1.EnvoyPatchPolicyList] +} + +// newEnvoyPatchPolicies returns a EnvoyPatchPolicies +func newEnvoyPatchPolicies(c *GatewayV1alpha1Client, namespace string) *envoyPatchPolicies { + return &envoyPatchPolicies{ + gentype.NewClientWithList[*apiv1alpha1.EnvoyPatchPolicy, *apiv1alpha1.EnvoyPatchPolicyList]( + "envoypatchpolicies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *apiv1alpha1.EnvoyPatchPolicy { return &apiv1alpha1.EnvoyPatchPolicy{} }, + func() *apiv1alpha1.EnvoyPatchPolicyList { return &apiv1alpha1.EnvoyPatchPolicyList{} }, + ), + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/envoyproxy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/envoyproxy.go new file mode 100644 index 00000000000..321d14aa187 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/envoyproxy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + scheme "github.com/envoyproxy/gateway/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" + gentype "k8s.io/client-go/gentype" +) + +// EnvoyProxiesGetter has a method to return a EnvoyProxyInterface. +// A group's client should implement this interface. +type EnvoyProxiesGetter interface { + EnvoyProxies(namespace string) EnvoyProxyInterface +} + +// EnvoyProxyInterface has methods to work with EnvoyProxy resources. +type EnvoyProxyInterface interface { + Create(ctx context.Context, envoyProxy *apiv1alpha1.EnvoyProxy, opts v1.CreateOptions) (*apiv1alpha1.EnvoyProxy, error) + Update(ctx context.Context, envoyProxy *apiv1alpha1.EnvoyProxy, opts v1.UpdateOptions) (*apiv1alpha1.EnvoyProxy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, envoyProxy *apiv1alpha1.EnvoyProxy, opts v1.UpdateOptions) (*apiv1alpha1.EnvoyProxy, 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) (*apiv1alpha1.EnvoyProxy, error) + List(ctx context.Context, opts v1.ListOptions) (*apiv1alpha1.EnvoyProxyList, 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 *apiv1alpha1.EnvoyProxy, err error) + EnvoyProxyExpansion +} + +// envoyProxies implements EnvoyProxyInterface +type envoyProxies struct { + *gentype.ClientWithList[*apiv1alpha1.EnvoyProxy, *apiv1alpha1.EnvoyProxyList] +} + +// newEnvoyProxies returns a EnvoyProxies +func newEnvoyProxies(c *GatewayV1alpha1Client, namespace string) *envoyProxies { + return &envoyProxies{ + gentype.NewClientWithList[*apiv1alpha1.EnvoyProxy, *apiv1alpha1.EnvoyProxyList]( + "envoyproxies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *apiv1alpha1.EnvoyProxy { return &apiv1alpha1.EnvoyProxy{} }, + func() *apiv1alpha1.EnvoyProxyList { return &apiv1alpha1.EnvoyProxyList{} }, + ), + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/doc.go new file mode 100644 index 00000000000..42f80d64ea1 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/doc.go @@ -0,0 +1,9 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_api_client.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_api_client.go new file mode 100644 index 00000000000..542e0aa319f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_api_client.go @@ -0,0 +1,57 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeGatewayV1alpha1 struct { + *testing.Fake +} + +func (c *FakeGatewayV1alpha1) Backends(namespace string) v1alpha1.BackendInterface { + return newFakeBackends(c, namespace) +} + +func (c *FakeGatewayV1alpha1) BackendTrafficPolicies(namespace string) v1alpha1.BackendTrafficPolicyInterface { + return newFakeBackendTrafficPolicies(c, namespace) +} + +func (c *FakeGatewayV1alpha1) ClientTrafficPolicies(namespace string) v1alpha1.ClientTrafficPolicyInterface { + return newFakeClientTrafficPolicies(c, namespace) +} + +func (c *FakeGatewayV1alpha1) EnvoyExtensionPolicies(namespace string) v1alpha1.EnvoyExtensionPolicyInterface { + return newFakeEnvoyExtensionPolicies(c, namespace) +} + +func (c *FakeGatewayV1alpha1) EnvoyPatchPolicies(namespace string) v1alpha1.EnvoyPatchPolicyInterface { + return newFakeEnvoyPatchPolicies(c, namespace) +} + +func (c *FakeGatewayV1alpha1) EnvoyProxies(namespace string) v1alpha1.EnvoyProxyInterface { + return newFakeEnvoyProxies(c, namespace) +} + +func (c *FakeGatewayV1alpha1) HTTPRouteFilters(namespace string) v1alpha1.HTTPRouteFilterInterface { + return newFakeHTTPRouteFilters(c, namespace) +} + +func (c *FakeGatewayV1alpha1) SecurityPolicies(namespace string) v1alpha1.SecurityPolicyInterface { + return newFakeSecurityPolicies(c, namespace) +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeGatewayV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_backend.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_backend.go new file mode 100644 index 00000000000..618a257935f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_backend.go @@ -0,0 +1,39 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1" + gentype "k8s.io/client-go/gentype" +) + +// fakeBackends implements BackendInterface +type fakeBackends struct { + *gentype.FakeClientWithList[*v1alpha1.Backend, *v1alpha1.BackendList] + Fake *FakeGatewayV1alpha1 +} + +func newFakeBackends(fake *FakeGatewayV1alpha1, namespace string) apiv1alpha1.BackendInterface { + return &fakeBackends{ + gentype.NewFakeClientWithList[*v1alpha1.Backend, *v1alpha1.BackendList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("backends"), + v1alpha1.SchemeGroupVersion.WithKind("Backend"), + func() *v1alpha1.Backend { return &v1alpha1.Backend{} }, + func() *v1alpha1.BackendList { return &v1alpha1.BackendList{} }, + func(dst, src *v1alpha1.BackendList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.BackendList) []*v1alpha1.Backend { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha1.BackendList, items []*v1alpha1.Backend) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_backendtrafficpolicy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_backendtrafficpolicy.go new file mode 100644 index 00000000000..04dfd62dde1 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_backendtrafficpolicy.go @@ -0,0 +1,41 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1" + gentype "k8s.io/client-go/gentype" +) + +// fakeBackendTrafficPolicies implements BackendTrafficPolicyInterface +type fakeBackendTrafficPolicies struct { + *gentype.FakeClientWithList[*v1alpha1.BackendTrafficPolicy, *v1alpha1.BackendTrafficPolicyList] + Fake *FakeGatewayV1alpha1 +} + +func newFakeBackendTrafficPolicies(fake *FakeGatewayV1alpha1, namespace string) apiv1alpha1.BackendTrafficPolicyInterface { + return &fakeBackendTrafficPolicies{ + gentype.NewFakeClientWithList[*v1alpha1.BackendTrafficPolicy, *v1alpha1.BackendTrafficPolicyList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("backendtrafficpolicies"), + v1alpha1.SchemeGroupVersion.WithKind("BackendTrafficPolicy"), + func() *v1alpha1.BackendTrafficPolicy { return &v1alpha1.BackendTrafficPolicy{} }, + func() *v1alpha1.BackendTrafficPolicyList { return &v1alpha1.BackendTrafficPolicyList{} }, + func(dst, src *v1alpha1.BackendTrafficPolicyList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.BackendTrafficPolicyList) []*v1alpha1.BackendTrafficPolicy { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.BackendTrafficPolicyList, items []*v1alpha1.BackendTrafficPolicy) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_clienttrafficpolicy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_clienttrafficpolicy.go new file mode 100644 index 00000000000..cf2b249d940 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_clienttrafficpolicy.go @@ -0,0 +1,41 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1" + gentype "k8s.io/client-go/gentype" +) + +// fakeClientTrafficPolicies implements ClientTrafficPolicyInterface +type fakeClientTrafficPolicies struct { + *gentype.FakeClientWithList[*v1alpha1.ClientTrafficPolicy, *v1alpha1.ClientTrafficPolicyList] + Fake *FakeGatewayV1alpha1 +} + +func newFakeClientTrafficPolicies(fake *FakeGatewayV1alpha1, namespace string) apiv1alpha1.ClientTrafficPolicyInterface { + return &fakeClientTrafficPolicies{ + gentype.NewFakeClientWithList[*v1alpha1.ClientTrafficPolicy, *v1alpha1.ClientTrafficPolicyList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("clienttrafficpolicies"), + v1alpha1.SchemeGroupVersion.WithKind("ClientTrafficPolicy"), + func() *v1alpha1.ClientTrafficPolicy { return &v1alpha1.ClientTrafficPolicy{} }, + func() *v1alpha1.ClientTrafficPolicyList { return &v1alpha1.ClientTrafficPolicyList{} }, + func(dst, src *v1alpha1.ClientTrafficPolicyList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.ClientTrafficPolicyList) []*v1alpha1.ClientTrafficPolicy { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.ClientTrafficPolicyList, items []*v1alpha1.ClientTrafficPolicy) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_envoyextensionpolicy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_envoyextensionpolicy.go new file mode 100644 index 00000000000..e4566116ea2 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_envoyextensionpolicy.go @@ -0,0 +1,41 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1" + gentype "k8s.io/client-go/gentype" +) + +// fakeEnvoyExtensionPolicies implements EnvoyExtensionPolicyInterface +type fakeEnvoyExtensionPolicies struct { + *gentype.FakeClientWithList[*v1alpha1.EnvoyExtensionPolicy, *v1alpha1.EnvoyExtensionPolicyList] + Fake *FakeGatewayV1alpha1 +} + +func newFakeEnvoyExtensionPolicies(fake *FakeGatewayV1alpha1, namespace string) apiv1alpha1.EnvoyExtensionPolicyInterface { + return &fakeEnvoyExtensionPolicies{ + gentype.NewFakeClientWithList[*v1alpha1.EnvoyExtensionPolicy, *v1alpha1.EnvoyExtensionPolicyList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("envoyextensionpolicies"), + v1alpha1.SchemeGroupVersion.WithKind("EnvoyExtensionPolicy"), + func() *v1alpha1.EnvoyExtensionPolicy { return &v1alpha1.EnvoyExtensionPolicy{} }, + func() *v1alpha1.EnvoyExtensionPolicyList { return &v1alpha1.EnvoyExtensionPolicyList{} }, + func(dst, src *v1alpha1.EnvoyExtensionPolicyList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.EnvoyExtensionPolicyList) []*v1alpha1.EnvoyExtensionPolicy { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.EnvoyExtensionPolicyList, items []*v1alpha1.EnvoyExtensionPolicy) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_envoypatchpolicy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_envoypatchpolicy.go new file mode 100644 index 00000000000..267f29ac5d5 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_envoypatchpolicy.go @@ -0,0 +1,41 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1" + gentype "k8s.io/client-go/gentype" +) + +// fakeEnvoyPatchPolicies implements EnvoyPatchPolicyInterface +type fakeEnvoyPatchPolicies struct { + *gentype.FakeClientWithList[*v1alpha1.EnvoyPatchPolicy, *v1alpha1.EnvoyPatchPolicyList] + Fake *FakeGatewayV1alpha1 +} + +func newFakeEnvoyPatchPolicies(fake *FakeGatewayV1alpha1, namespace string) apiv1alpha1.EnvoyPatchPolicyInterface { + return &fakeEnvoyPatchPolicies{ + gentype.NewFakeClientWithList[*v1alpha1.EnvoyPatchPolicy, *v1alpha1.EnvoyPatchPolicyList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("envoypatchpolicies"), + v1alpha1.SchemeGroupVersion.WithKind("EnvoyPatchPolicy"), + func() *v1alpha1.EnvoyPatchPolicy { return &v1alpha1.EnvoyPatchPolicy{} }, + func() *v1alpha1.EnvoyPatchPolicyList { return &v1alpha1.EnvoyPatchPolicyList{} }, + func(dst, src *v1alpha1.EnvoyPatchPolicyList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.EnvoyPatchPolicyList) []*v1alpha1.EnvoyPatchPolicy { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.EnvoyPatchPolicyList, items []*v1alpha1.EnvoyPatchPolicy) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_envoyproxy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_envoyproxy.go new file mode 100644 index 00000000000..bd1b5888973 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_envoyproxy.go @@ -0,0 +1,39 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1" + gentype "k8s.io/client-go/gentype" +) + +// fakeEnvoyProxies implements EnvoyProxyInterface +type fakeEnvoyProxies struct { + *gentype.FakeClientWithList[*v1alpha1.EnvoyProxy, *v1alpha1.EnvoyProxyList] + Fake *FakeGatewayV1alpha1 +} + +func newFakeEnvoyProxies(fake *FakeGatewayV1alpha1, namespace string) apiv1alpha1.EnvoyProxyInterface { + return &fakeEnvoyProxies{ + gentype.NewFakeClientWithList[*v1alpha1.EnvoyProxy, *v1alpha1.EnvoyProxyList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("envoyproxies"), + v1alpha1.SchemeGroupVersion.WithKind("EnvoyProxy"), + func() *v1alpha1.EnvoyProxy { return &v1alpha1.EnvoyProxy{} }, + func() *v1alpha1.EnvoyProxyList { return &v1alpha1.EnvoyProxyList{} }, + func(dst, src *v1alpha1.EnvoyProxyList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.EnvoyProxyList) []*v1alpha1.EnvoyProxy { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha1.EnvoyProxyList, items []*v1alpha1.EnvoyProxy) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_httproutefilter.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_httproutefilter.go new file mode 100644 index 00000000000..ae36e2c7289 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_httproutefilter.go @@ -0,0 +1,41 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1" + gentype "k8s.io/client-go/gentype" +) + +// fakeHTTPRouteFilters implements HTTPRouteFilterInterface +type fakeHTTPRouteFilters struct { + *gentype.FakeClientWithList[*v1alpha1.HTTPRouteFilter, *v1alpha1.HTTPRouteFilterList] + Fake *FakeGatewayV1alpha1 +} + +func newFakeHTTPRouteFilters(fake *FakeGatewayV1alpha1, namespace string) apiv1alpha1.HTTPRouteFilterInterface { + return &fakeHTTPRouteFilters{ + gentype.NewFakeClientWithList[*v1alpha1.HTTPRouteFilter, *v1alpha1.HTTPRouteFilterList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("httproutefilters"), + v1alpha1.SchemeGroupVersion.WithKind("HTTPRouteFilter"), + func() *v1alpha1.HTTPRouteFilter { return &v1alpha1.HTTPRouteFilter{} }, + func() *v1alpha1.HTTPRouteFilterList { return &v1alpha1.HTTPRouteFilterList{} }, + func(dst, src *v1alpha1.HTTPRouteFilterList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.HTTPRouteFilterList) []*v1alpha1.HTTPRouteFilter { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.HTTPRouteFilterList, items []*v1alpha1.HTTPRouteFilter) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_securitypolicy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_securitypolicy.go new file mode 100644 index 00000000000..497030abd87 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/fake/fake_securitypolicy.go @@ -0,0 +1,41 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/typed/api/v1alpha1" + gentype "k8s.io/client-go/gentype" +) + +// fakeSecurityPolicies implements SecurityPolicyInterface +type fakeSecurityPolicies struct { + *gentype.FakeClientWithList[*v1alpha1.SecurityPolicy, *v1alpha1.SecurityPolicyList] + Fake *FakeGatewayV1alpha1 +} + +func newFakeSecurityPolicies(fake *FakeGatewayV1alpha1, namespace string) apiv1alpha1.SecurityPolicyInterface { + return &fakeSecurityPolicies{ + gentype.NewFakeClientWithList[*v1alpha1.SecurityPolicy, *v1alpha1.SecurityPolicyList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("securitypolicies"), + v1alpha1.SchemeGroupVersion.WithKind("SecurityPolicy"), + func() *v1alpha1.SecurityPolicy { return &v1alpha1.SecurityPolicy{} }, + func() *v1alpha1.SecurityPolicyList { return &v1alpha1.SecurityPolicyList{} }, + func(dst, src *v1alpha1.SecurityPolicyList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.SecurityPolicyList) []*v1alpha1.SecurityPolicy { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.SecurityPolicyList, items []*v1alpha1.SecurityPolicy) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/generated_expansion.go new file mode 100644 index 00000000000..f404d8a949a --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/generated_expansion.go @@ -0,0 +1,24 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type BackendExpansion interface{} + +type BackendTrafficPolicyExpansion interface{} + +type ClientTrafficPolicyExpansion interface{} + +type EnvoyExtensionPolicyExpansion interface{} + +type EnvoyPatchPolicyExpansion interface{} + +type EnvoyProxyExpansion interface{} + +type HTTPRouteFilterExpansion interface{} + +type SecurityPolicyExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/httproutefilter.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/httproutefilter.go new file mode 100644 index 00000000000..15957d7401f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/httproutefilter.go @@ -0,0 +1,57 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + scheme "github.com/envoyproxy/gateway/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" + gentype "k8s.io/client-go/gentype" +) + +// HTTPRouteFiltersGetter has a method to return a HTTPRouteFilterInterface. +// A group's client should implement this interface. +type HTTPRouteFiltersGetter interface { + HTTPRouteFilters(namespace string) HTTPRouteFilterInterface +} + +// HTTPRouteFilterInterface has methods to work with HTTPRouteFilter resources. +type HTTPRouteFilterInterface interface { + Create(ctx context.Context, hTTPRouteFilter *apiv1alpha1.HTTPRouteFilter, opts v1.CreateOptions) (*apiv1alpha1.HTTPRouteFilter, error) + Update(ctx context.Context, hTTPRouteFilter *apiv1alpha1.HTTPRouteFilter, opts v1.UpdateOptions) (*apiv1alpha1.HTTPRouteFilter, 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) (*apiv1alpha1.HTTPRouteFilter, error) + List(ctx context.Context, opts v1.ListOptions) (*apiv1alpha1.HTTPRouteFilterList, 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 *apiv1alpha1.HTTPRouteFilter, err error) + HTTPRouteFilterExpansion +} + +// hTTPRouteFilters implements HTTPRouteFilterInterface +type hTTPRouteFilters struct { + *gentype.ClientWithList[*apiv1alpha1.HTTPRouteFilter, *apiv1alpha1.HTTPRouteFilterList] +} + +// newHTTPRouteFilters returns a HTTPRouteFilters +func newHTTPRouteFilters(c *GatewayV1alpha1Client, namespace string) *hTTPRouteFilters { + return &hTTPRouteFilters{ + gentype.NewClientWithList[*apiv1alpha1.HTTPRouteFilter, *apiv1alpha1.HTTPRouteFilterList]( + "httproutefilters", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *apiv1alpha1.HTTPRouteFilter { return &apiv1alpha1.HTTPRouteFilter{} }, + func() *apiv1alpha1.HTTPRouteFilterList { return &apiv1alpha1.HTTPRouteFilterList{} }, + ), + } +} diff --git a/pkg/client/clientset/versioned/typed/api/v1alpha1/securitypolicy.go b/pkg/client/clientset/versioned/typed/api/v1alpha1/securitypolicy.go new file mode 100644 index 00000000000..c181301ea14 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/api/v1alpha1/securitypolicy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + scheme "github.com/envoyproxy/gateway/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" + gentype "k8s.io/client-go/gentype" +) + +// SecurityPoliciesGetter has a method to return a SecurityPolicyInterface. +// A group's client should implement this interface. +type SecurityPoliciesGetter interface { + SecurityPolicies(namespace string) SecurityPolicyInterface +} + +// SecurityPolicyInterface has methods to work with SecurityPolicy resources. +type SecurityPolicyInterface interface { + Create(ctx context.Context, securityPolicy *apiv1alpha1.SecurityPolicy, opts v1.CreateOptions) (*apiv1alpha1.SecurityPolicy, error) + Update(ctx context.Context, securityPolicy *apiv1alpha1.SecurityPolicy, opts v1.UpdateOptions) (*apiv1alpha1.SecurityPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, securityPolicy *apiv1alpha1.SecurityPolicy, opts v1.UpdateOptions) (*apiv1alpha1.SecurityPolicy, 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) (*apiv1alpha1.SecurityPolicy, error) + List(ctx context.Context, opts v1.ListOptions) (*apiv1alpha1.SecurityPolicyList, 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 *apiv1alpha1.SecurityPolicy, err error) + SecurityPolicyExpansion +} + +// securityPolicies implements SecurityPolicyInterface +type securityPolicies struct { + *gentype.ClientWithList[*apiv1alpha1.SecurityPolicy, *apiv1alpha1.SecurityPolicyList] +} + +// newSecurityPolicies returns a SecurityPolicies +func newSecurityPolicies(c *GatewayV1alpha1Client, namespace string) *securityPolicies { + return &securityPolicies{ + gentype.NewClientWithList[*apiv1alpha1.SecurityPolicy, *apiv1alpha1.SecurityPolicyList]( + "securitypolicies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *apiv1alpha1.SecurityPolicy { return &apiv1alpha1.SecurityPolicy{} }, + func() *apiv1alpha1.SecurityPolicyList { return &apiv1alpha1.SecurityPolicyList{} }, + ), + } +} diff --git a/pkg/client/clientset_test.go b/pkg/client/clientset_test.go new file mode 100644 index 00000000000..eb85a5aa73d --- /dev/null +++ b/pkg/client/clientset_test.go @@ -0,0 +1,77 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +package client + +import ( + "testing" + + "k8s.io/client-go/rest" + + "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + "github.com/envoyproxy/gateway/pkg/client/clientset/versioned/fake" +) + +// TestNewForConfig ensures the clientset can be created with a valid config. +func TestNewForConfig(t *testing.T) { + config := &rest.Config{ + Host: "https://localhost:6443", + } + + clientset, err := versioned.NewForConfig(config) + if err != nil { + t.Fatalf("Failed to create clientset: %v", err) + } + + if clientset == nil { + t.Fatal("Expected non-nil clientset") + } + + // Verify all resource clients are accessible + if clientset.GatewayV1alpha1() == nil { + t.Error("Expected non-nil GatewayV1alpha1 client") + } +} + +// TestFakeClientset ensures the fake clientset can be created. +func TestFakeClientset(t *testing.T) { + clientset := fake.NewSimpleClientset() + if clientset == nil { + t.Fatal("Expected non-nil fake clientset") + } + + // Verify all resource clients are accessible + if clientset.GatewayV1alpha1() == nil { + t.Error("Expected non-nil GatewayV1alpha1 client") + } + + // Verify we can access individual resource clients + v1alpha1 := clientset.GatewayV1alpha1() + + if v1alpha1.Backends("default") == nil { + t.Error("Expected non-nil Backends client") + } + if v1alpha1.BackendTrafficPolicies("default") == nil { + t.Error("Expected non-nil BackendTrafficPolicies client") + } + if v1alpha1.ClientTrafficPolicies("default") == nil { + t.Error("Expected non-nil ClientTrafficPolicies client") + } + if v1alpha1.EnvoyExtensionPolicies("default") == nil { + t.Error("Expected non-nil EnvoyExtensionPolicies client") + } + if v1alpha1.EnvoyPatchPolicies("default") == nil { + t.Error("Expected non-nil EnvoyPatchPolicies client") + } + if v1alpha1.EnvoyProxies("default") == nil { + t.Error("Expected non-nil EnvoyProxies client") + } + if v1alpha1.HTTPRouteFilters("default") == nil { + t.Error("Expected non-nil HTTPRouteFilters client") + } + if v1alpha1.SecurityPolicies("default") == nil { + t.Error("Expected non-nil SecurityPolicies client") + } +} diff --git a/pkg/client/informers/externalversions/api/interface.go b/pkg/client/informers/externalversions/api/interface.go new file mode 100644 index 00000000000..eb87f5a5be9 --- /dev/null +++ b/pkg/client/informers/externalversions/api/interface.go @@ -0,0 +1,35 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package api + +import ( + v1alpha1 "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/api/v1alpha1" + internalinterfaces "github.com/envoyproxy/gateway/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) +} diff --git a/pkg/client/informers/externalversions/api/v1alpha1/backend.go b/pkg/client/informers/externalversions/api/v1alpha1/backend.go new file mode 100644 index 00000000000..8bccc1754d9 --- /dev/null +++ b/pkg/client/informers/externalversions/api/v1alpha1/backend.go @@ -0,0 +1,91 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + time "time" + + gatewayapiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + versioned "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + internalinterfaces "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/internalinterfaces" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/listers/api/v1alpha1" + 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" +) + +// BackendInformer provides access to a shared informer and lister for +// Backends. +type BackendInformer interface { + Informer() cache.SharedIndexInformer + Lister() apiv1alpha1.BackendLister +} + +type backendInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewBackendInformer constructs a new informer for Backend 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 NewBackendInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredBackendInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredBackendInformer constructs a new informer for Backend 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 NewFilteredBackendInformer(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.GatewayV1alpha1().Backends(namespace).List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().Backends(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().Backends(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().Backends(namespace).Watch(ctx, options) + }, + }, + &gatewayapiv1alpha1.Backend{}, + resyncPeriod, + indexers, + ) +} + +func (f *backendInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredBackendInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *backendInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&gatewayapiv1alpha1.Backend{}, f.defaultInformer) +} + +func (f *backendInformer) Lister() apiv1alpha1.BackendLister { + return apiv1alpha1.NewBackendLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/api/v1alpha1/backendtrafficpolicy.go b/pkg/client/informers/externalversions/api/v1alpha1/backendtrafficpolicy.go new file mode 100644 index 00000000000..c866f8f45f7 --- /dev/null +++ b/pkg/client/informers/externalversions/api/v1alpha1/backendtrafficpolicy.go @@ -0,0 +1,91 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + time "time" + + gatewayapiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + versioned "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + internalinterfaces "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/internalinterfaces" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/listers/api/v1alpha1" + 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" +) + +// BackendTrafficPolicyInformer provides access to a shared informer and lister for +// BackendTrafficPolicies. +type BackendTrafficPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() apiv1alpha1.BackendTrafficPolicyLister +} + +type backendTrafficPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewBackendTrafficPolicyInformer constructs a new informer for BackendTrafficPolicy 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 NewBackendTrafficPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredBackendTrafficPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredBackendTrafficPolicyInformer constructs a new informer for BackendTrafficPolicy 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 NewFilteredBackendTrafficPolicyInformer(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.GatewayV1alpha1().BackendTrafficPolicies(namespace).List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().BackendTrafficPolicies(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().BackendTrafficPolicies(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().BackendTrafficPolicies(namespace).Watch(ctx, options) + }, + }, + &gatewayapiv1alpha1.BackendTrafficPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *backendTrafficPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredBackendTrafficPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *backendTrafficPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&gatewayapiv1alpha1.BackendTrafficPolicy{}, f.defaultInformer) +} + +func (f *backendTrafficPolicyInformer) Lister() apiv1alpha1.BackendTrafficPolicyLister { + return apiv1alpha1.NewBackendTrafficPolicyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/api/v1alpha1/clienttrafficpolicy.go b/pkg/client/informers/externalversions/api/v1alpha1/clienttrafficpolicy.go new file mode 100644 index 00000000000..636a0e44183 --- /dev/null +++ b/pkg/client/informers/externalversions/api/v1alpha1/clienttrafficpolicy.go @@ -0,0 +1,91 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + time "time" + + gatewayapiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + versioned "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + internalinterfaces "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/internalinterfaces" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/listers/api/v1alpha1" + 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" +) + +// ClientTrafficPolicyInformer provides access to a shared informer and lister for +// ClientTrafficPolicies. +type ClientTrafficPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() apiv1alpha1.ClientTrafficPolicyLister +} + +type clientTrafficPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewClientTrafficPolicyInformer constructs a new informer for ClientTrafficPolicy 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 NewClientTrafficPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClientTrafficPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredClientTrafficPolicyInformer constructs a new informer for ClientTrafficPolicy 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 NewFilteredClientTrafficPolicyInformer(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.GatewayV1alpha1().ClientTrafficPolicies(namespace).List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().ClientTrafficPolicies(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().ClientTrafficPolicies(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().ClientTrafficPolicies(namespace).Watch(ctx, options) + }, + }, + &gatewayapiv1alpha1.ClientTrafficPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *clientTrafficPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClientTrafficPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clientTrafficPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&gatewayapiv1alpha1.ClientTrafficPolicy{}, f.defaultInformer) +} + +func (f *clientTrafficPolicyInformer) Lister() apiv1alpha1.ClientTrafficPolicyLister { + return apiv1alpha1.NewClientTrafficPolicyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/api/v1alpha1/envoyextensionpolicy.go b/pkg/client/informers/externalversions/api/v1alpha1/envoyextensionpolicy.go new file mode 100644 index 00000000000..5b7eb2ed280 --- /dev/null +++ b/pkg/client/informers/externalversions/api/v1alpha1/envoyextensionpolicy.go @@ -0,0 +1,91 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + time "time" + + gatewayapiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + versioned "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + internalinterfaces "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/internalinterfaces" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/listers/api/v1alpha1" + 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" +) + +// EnvoyExtensionPolicyInformer provides access to a shared informer and lister for +// EnvoyExtensionPolicies. +type EnvoyExtensionPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() apiv1alpha1.EnvoyExtensionPolicyLister +} + +type envoyExtensionPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEnvoyExtensionPolicyInformer constructs a new informer for EnvoyExtensionPolicy 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 NewEnvoyExtensionPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEnvoyExtensionPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEnvoyExtensionPolicyInformer constructs a new informer for EnvoyExtensionPolicy 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 NewFilteredEnvoyExtensionPolicyInformer(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.GatewayV1alpha1().EnvoyExtensionPolicies(namespace).List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().EnvoyExtensionPolicies(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().EnvoyExtensionPolicies(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().EnvoyExtensionPolicies(namespace).Watch(ctx, options) + }, + }, + &gatewayapiv1alpha1.EnvoyExtensionPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *envoyExtensionPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEnvoyExtensionPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *envoyExtensionPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&gatewayapiv1alpha1.EnvoyExtensionPolicy{}, f.defaultInformer) +} + +func (f *envoyExtensionPolicyInformer) Lister() apiv1alpha1.EnvoyExtensionPolicyLister { + return apiv1alpha1.NewEnvoyExtensionPolicyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/api/v1alpha1/envoypatchpolicy.go b/pkg/client/informers/externalversions/api/v1alpha1/envoypatchpolicy.go new file mode 100644 index 00000000000..bec4ddaf125 --- /dev/null +++ b/pkg/client/informers/externalversions/api/v1alpha1/envoypatchpolicy.go @@ -0,0 +1,91 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + time "time" + + gatewayapiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + versioned "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + internalinterfaces "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/internalinterfaces" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/listers/api/v1alpha1" + 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" +) + +// EnvoyPatchPolicyInformer provides access to a shared informer and lister for +// EnvoyPatchPolicies. +type EnvoyPatchPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() apiv1alpha1.EnvoyPatchPolicyLister +} + +type envoyPatchPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEnvoyPatchPolicyInformer constructs a new informer for EnvoyPatchPolicy 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 NewEnvoyPatchPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEnvoyPatchPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEnvoyPatchPolicyInformer constructs a new informer for EnvoyPatchPolicy 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 NewFilteredEnvoyPatchPolicyInformer(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.GatewayV1alpha1().EnvoyPatchPolicies(namespace).List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().EnvoyPatchPolicies(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().EnvoyPatchPolicies(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().EnvoyPatchPolicies(namespace).Watch(ctx, options) + }, + }, + &gatewayapiv1alpha1.EnvoyPatchPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *envoyPatchPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEnvoyPatchPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *envoyPatchPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&gatewayapiv1alpha1.EnvoyPatchPolicy{}, f.defaultInformer) +} + +func (f *envoyPatchPolicyInformer) Lister() apiv1alpha1.EnvoyPatchPolicyLister { + return apiv1alpha1.NewEnvoyPatchPolicyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/api/v1alpha1/envoyproxy.go b/pkg/client/informers/externalversions/api/v1alpha1/envoyproxy.go new file mode 100644 index 00000000000..b9353ddbc88 --- /dev/null +++ b/pkg/client/informers/externalversions/api/v1alpha1/envoyproxy.go @@ -0,0 +1,91 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + time "time" + + gatewayapiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + versioned "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + internalinterfaces "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/internalinterfaces" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/listers/api/v1alpha1" + 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" +) + +// EnvoyProxyInformer provides access to a shared informer and lister for +// EnvoyProxies. +type EnvoyProxyInformer interface { + Informer() cache.SharedIndexInformer + Lister() apiv1alpha1.EnvoyProxyLister +} + +type envoyProxyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEnvoyProxyInformer constructs a new informer for EnvoyProxy 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 NewEnvoyProxyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEnvoyProxyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEnvoyProxyInformer constructs a new informer for EnvoyProxy 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 NewFilteredEnvoyProxyInformer(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.GatewayV1alpha1().EnvoyProxies(namespace).List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().EnvoyProxies(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().EnvoyProxies(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().EnvoyProxies(namespace).Watch(ctx, options) + }, + }, + &gatewayapiv1alpha1.EnvoyProxy{}, + resyncPeriod, + indexers, + ) +} + +func (f *envoyProxyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEnvoyProxyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *envoyProxyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&gatewayapiv1alpha1.EnvoyProxy{}, f.defaultInformer) +} + +func (f *envoyProxyInformer) Lister() apiv1alpha1.EnvoyProxyLister { + return apiv1alpha1.NewEnvoyProxyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/api/v1alpha1/httproutefilter.go b/pkg/client/informers/externalversions/api/v1alpha1/httproutefilter.go new file mode 100644 index 00000000000..82880505937 --- /dev/null +++ b/pkg/client/informers/externalversions/api/v1alpha1/httproutefilter.go @@ -0,0 +1,91 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + time "time" + + gatewayapiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + versioned "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + internalinterfaces "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/internalinterfaces" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/listers/api/v1alpha1" + 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" +) + +// HTTPRouteFilterInformer provides access to a shared informer and lister for +// HTTPRouteFilters. +type HTTPRouteFilterInformer interface { + Informer() cache.SharedIndexInformer + Lister() apiv1alpha1.HTTPRouteFilterLister +} + +type hTTPRouteFilterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHTTPRouteFilterInformer constructs a new informer for HTTPRouteFilter 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 NewHTTPRouteFilterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHTTPRouteFilterInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHTTPRouteFilterInformer constructs a new informer for HTTPRouteFilter 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 NewFilteredHTTPRouteFilterInformer(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.GatewayV1alpha1().HTTPRouteFilters(namespace).List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().HTTPRouteFilters(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().HTTPRouteFilters(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().HTTPRouteFilters(namespace).Watch(ctx, options) + }, + }, + &gatewayapiv1alpha1.HTTPRouteFilter{}, + resyncPeriod, + indexers, + ) +} + +func (f *hTTPRouteFilterInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHTTPRouteFilterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *hTTPRouteFilterInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&gatewayapiv1alpha1.HTTPRouteFilter{}, f.defaultInformer) +} + +func (f *hTTPRouteFilterInformer) Lister() apiv1alpha1.HTTPRouteFilterLister { + return apiv1alpha1.NewHTTPRouteFilterLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/api/v1alpha1/interface.go b/pkg/client/informers/externalversions/api/v1alpha1/interface.go new file mode 100644 index 00000000000..2ca0d3175aa --- /dev/null +++ b/pkg/client/informers/externalversions/api/v1alpha1/interface.go @@ -0,0 +1,83 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Backends returns a BackendInformer. + Backends() BackendInformer + // BackendTrafficPolicies returns a BackendTrafficPolicyInformer. + BackendTrafficPolicies() BackendTrafficPolicyInformer + // ClientTrafficPolicies returns a ClientTrafficPolicyInformer. + ClientTrafficPolicies() ClientTrafficPolicyInformer + // EnvoyExtensionPolicies returns a EnvoyExtensionPolicyInformer. + EnvoyExtensionPolicies() EnvoyExtensionPolicyInformer + // EnvoyPatchPolicies returns a EnvoyPatchPolicyInformer. + EnvoyPatchPolicies() EnvoyPatchPolicyInformer + // EnvoyProxies returns a EnvoyProxyInformer. + EnvoyProxies() EnvoyProxyInformer + // HTTPRouteFilters returns a HTTPRouteFilterInformer. + HTTPRouteFilters() HTTPRouteFilterInformer + // SecurityPolicies returns a SecurityPolicyInformer. + SecurityPolicies() SecurityPolicyInformer +} + +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} +} + +// Backends returns a BackendInformer. +func (v *version) Backends() BackendInformer { + return &backendInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// BackendTrafficPolicies returns a BackendTrafficPolicyInformer. +func (v *version) BackendTrafficPolicies() BackendTrafficPolicyInformer { + return &backendTrafficPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ClientTrafficPolicies returns a ClientTrafficPolicyInformer. +func (v *version) ClientTrafficPolicies() ClientTrafficPolicyInformer { + return &clientTrafficPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// EnvoyExtensionPolicies returns a EnvoyExtensionPolicyInformer. +func (v *version) EnvoyExtensionPolicies() EnvoyExtensionPolicyInformer { + return &envoyExtensionPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// EnvoyPatchPolicies returns a EnvoyPatchPolicyInformer. +func (v *version) EnvoyPatchPolicies() EnvoyPatchPolicyInformer { + return &envoyPatchPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// EnvoyProxies returns a EnvoyProxyInformer. +func (v *version) EnvoyProxies() EnvoyProxyInformer { + return &envoyProxyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// HTTPRouteFilters returns a HTTPRouteFilterInformer. +func (v *version) HTTPRouteFilters() HTTPRouteFilterInformer { + return &hTTPRouteFilterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// SecurityPolicies returns a SecurityPolicyInformer. +func (v *version) SecurityPolicies() SecurityPolicyInformer { + return &securityPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/api/v1alpha1/securitypolicy.go b/pkg/client/informers/externalversions/api/v1alpha1/securitypolicy.go new file mode 100644 index 00000000000..d89939cf814 --- /dev/null +++ b/pkg/client/informers/externalversions/api/v1alpha1/securitypolicy.go @@ -0,0 +1,91 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + time "time" + + gatewayapiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + versioned "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + internalinterfaces "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/internalinterfaces" + apiv1alpha1 "github.com/envoyproxy/gateway/pkg/client/listers/api/v1alpha1" + 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" +) + +// SecurityPolicyInformer provides access to a shared informer and lister for +// SecurityPolicies. +type SecurityPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() apiv1alpha1.SecurityPolicyLister +} + +type securityPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSecurityPolicyInformer constructs a new informer for SecurityPolicy 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 NewSecurityPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSecurityPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSecurityPolicyInformer constructs a new informer for SecurityPolicy 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 NewFilteredSecurityPolicyInformer(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.GatewayV1alpha1().SecurityPolicies(namespace).List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().SecurityPolicies(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().SecurityPolicies(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha1().SecurityPolicies(namespace).Watch(ctx, options) + }, + }, + &gatewayapiv1alpha1.SecurityPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *securityPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSecurityPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *securityPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&gatewayapiv1alpha1.SecurityPolicy{}, f.defaultInformer) +} + +func (f *securityPolicyInformer) Lister() apiv1alpha1.SecurityPolicyLister { + return apiv1alpha1.NewSecurityPolicyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go new file mode 100644 index 00000000000..f0e925411aa --- /dev/null +++ b/pkg/client/informers/externalversions/factory.go @@ -0,0 +1,251 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + versioned "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + api "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/api" + internalinterfaces "github.com/envoyproxy/gateway/pkg/client/informers/externalversions/internalinterfaces" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + transform cache.TransformFunc + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool + // wg tracks how many goroutines were started. + wg sync.WaitGroup + // shuttingDown is true when Shutdown has been called. It may still be running + // because it needs to wait for goroutines. + shuttingDown bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// WithTransform sets a transform on all informers. +func WithTransform(transform cache.TransformFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.transform = transform + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + if f.shuttingDown { + return + } + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + f.wg.Add(1) + // We need a new variable in each loop iteration, + // otherwise the goroutine would use the loop variable + // and that keeps changing. + informer := informer + go func() { + defer f.wg.Done() + informer.Run(stopCh) + }() + f.startedInformers[informerType] = true + } + } +} + +func (f *sharedInformerFactory) Shutdown() { + f.lock.Lock() + f.shuttingDown = true + f.lock.Unlock() + + // Will return immediately if there is nothing to wait for. + f.wg.Wait() +} + +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + informer.SetTransform(f.transform) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +// +// It is typically used like this: +// +// ctx, cancel := context.Background() +// defer cancel() +// factory := NewSharedInformerFactory(client, resyncPeriod) +// defer factory.WaitForStop() // Returns immediately if nothing was started. +// genericInformer := factory.ForResource(resource) +// typedInformer := factory.SomeAPIGroup().V1().SomeType() +// factory.Start(ctx.Done()) // Start processing these informers. +// synced := factory.WaitForCacheSync(ctx.Done()) +// for v, ok := range synced { +// if !ok { +// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) +// return +// } +// } +// +// // Creating informers can also be created after Start, but then +// // Start must be called again: +// anotherGenericInformer := factory.ForResource(resource) +// factory.Start(ctx.Done()) +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + + // Start initializes all requested informers. They are handled in goroutines + // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. + Start(stopCh <-chan struct{}) + + // Shutdown marks a factory as shutting down. At that point no new + // informers can be started anymore and Start will return without + // doing anything. + // + // In addition, Shutdown blocks until all goroutines have terminated. For that + // to happen, the close channel(s) that they were started with must be closed, + // either before Shutdown gets called or while it is waiting. + // + // Shutdown may be called multiple times, even concurrently. All such calls will + // block until all goroutines have terminated. + Shutdown() + + // WaitForCacheSync blocks until all started informers' caches were synced + // or the stop channel gets closed. + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + // ForResource gives generic access to a shared informer of the matching type. + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + + // InformerFor returns the SharedIndexInformer for obj using an internal + // client. + InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer + + Gateway() api.Interface +} + +func (f *sharedInformerFactory) Gateway() api.Interface { + return api.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go new file mode 100644 index 00000000000..6af8cb61508 --- /dev/null +++ b/pkg/client/informers/externalversions/generic.go @@ -0,0 +1,65 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + fmt "fmt" + + v1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=gateway.envoyproxy.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("backends"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha1().Backends().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("backendtrafficpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha1().BackendTrafficPolicies().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("clienttrafficpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha1().ClientTrafficPolicies().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("envoyextensionpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha1().EnvoyExtensionPolicies().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("envoypatchpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha1().EnvoyPatchPolicies().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("envoyproxies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha1().EnvoyProxies().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("httproutefilters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha1().HTTPRouteFilters().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("securitypolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha1().SecurityPolicies().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 00000000000..0ade29d1a5c --- /dev/null +++ b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,29 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + versioned "github.com/envoyproxy/gateway/pkg/client/clientset/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +// TweakListOptionsFunc is a function that transforms a v1.ListOptions. +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/pkg/client/listers/api/v1alpha1/backend.go b/pkg/client/listers/api/v1alpha1/backend.go new file mode 100644 index 00000000000..69251b8e6a2 --- /dev/null +++ b/pkg/client/listers/api/v1alpha1/backend.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// BackendLister helps list Backends. +// All objects returned here must be treated as read-only. +type BackendLister interface { + // List lists all Backends in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.Backend, err error) + // Backends returns an object that can list and get Backends. + Backends(namespace string) BackendNamespaceLister + BackendListerExpansion +} + +// backendLister implements the BackendLister interface. +type backendLister struct { + listers.ResourceIndexer[*apiv1alpha1.Backend] +} + +// NewBackendLister returns a new BackendLister. +func NewBackendLister(indexer cache.Indexer) BackendLister { + return &backendLister{listers.New[*apiv1alpha1.Backend](indexer, apiv1alpha1.Resource("backend"))} +} + +// Backends returns an object that can list and get Backends. +func (s *backendLister) Backends(namespace string) BackendNamespaceLister { + return backendNamespaceLister{listers.NewNamespaced[*apiv1alpha1.Backend](s.ResourceIndexer, namespace)} +} + +// BackendNamespaceLister helps list and get Backends. +// All objects returned here must be treated as read-only. +type BackendNamespaceLister interface { + // List lists all Backends in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.Backend, err error) + // Get retrieves the Backend from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*apiv1alpha1.Backend, error) + BackendNamespaceListerExpansion +} + +// backendNamespaceLister implements the BackendNamespaceLister +// interface. +type backendNamespaceLister struct { + listers.ResourceIndexer[*apiv1alpha1.Backend] +} diff --git a/pkg/client/listers/api/v1alpha1/backendtrafficpolicy.go b/pkg/client/listers/api/v1alpha1/backendtrafficpolicy.go new file mode 100644 index 00000000000..3037a25cf72 --- /dev/null +++ b/pkg/client/listers/api/v1alpha1/backendtrafficpolicy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// BackendTrafficPolicyLister helps list BackendTrafficPolicies. +// All objects returned here must be treated as read-only. +type BackendTrafficPolicyLister interface { + // List lists all BackendTrafficPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.BackendTrafficPolicy, err error) + // BackendTrafficPolicies returns an object that can list and get BackendTrafficPolicies. + BackendTrafficPolicies(namespace string) BackendTrafficPolicyNamespaceLister + BackendTrafficPolicyListerExpansion +} + +// backendTrafficPolicyLister implements the BackendTrafficPolicyLister interface. +type backendTrafficPolicyLister struct { + listers.ResourceIndexer[*apiv1alpha1.BackendTrafficPolicy] +} + +// NewBackendTrafficPolicyLister returns a new BackendTrafficPolicyLister. +func NewBackendTrafficPolicyLister(indexer cache.Indexer) BackendTrafficPolicyLister { + return &backendTrafficPolicyLister{listers.New[*apiv1alpha1.BackendTrafficPolicy](indexer, apiv1alpha1.Resource("backendtrafficpolicy"))} +} + +// BackendTrafficPolicies returns an object that can list and get BackendTrafficPolicies. +func (s *backendTrafficPolicyLister) BackendTrafficPolicies(namespace string) BackendTrafficPolicyNamespaceLister { + return backendTrafficPolicyNamespaceLister{listers.NewNamespaced[*apiv1alpha1.BackendTrafficPolicy](s.ResourceIndexer, namespace)} +} + +// BackendTrafficPolicyNamespaceLister helps list and get BackendTrafficPolicies. +// All objects returned here must be treated as read-only. +type BackendTrafficPolicyNamespaceLister interface { + // List lists all BackendTrafficPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.BackendTrafficPolicy, err error) + // Get retrieves the BackendTrafficPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*apiv1alpha1.BackendTrafficPolicy, error) + BackendTrafficPolicyNamespaceListerExpansion +} + +// backendTrafficPolicyNamespaceLister implements the BackendTrafficPolicyNamespaceLister +// interface. +type backendTrafficPolicyNamespaceLister struct { + listers.ResourceIndexer[*apiv1alpha1.BackendTrafficPolicy] +} diff --git a/pkg/client/listers/api/v1alpha1/clienttrafficpolicy.go b/pkg/client/listers/api/v1alpha1/clienttrafficpolicy.go new file mode 100644 index 00000000000..8d787f9f0bb --- /dev/null +++ b/pkg/client/listers/api/v1alpha1/clienttrafficpolicy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// ClientTrafficPolicyLister helps list ClientTrafficPolicies. +// All objects returned here must be treated as read-only. +type ClientTrafficPolicyLister interface { + // List lists all ClientTrafficPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.ClientTrafficPolicy, err error) + // ClientTrafficPolicies returns an object that can list and get ClientTrafficPolicies. + ClientTrafficPolicies(namespace string) ClientTrafficPolicyNamespaceLister + ClientTrafficPolicyListerExpansion +} + +// clientTrafficPolicyLister implements the ClientTrafficPolicyLister interface. +type clientTrafficPolicyLister struct { + listers.ResourceIndexer[*apiv1alpha1.ClientTrafficPolicy] +} + +// NewClientTrafficPolicyLister returns a new ClientTrafficPolicyLister. +func NewClientTrafficPolicyLister(indexer cache.Indexer) ClientTrafficPolicyLister { + return &clientTrafficPolicyLister{listers.New[*apiv1alpha1.ClientTrafficPolicy](indexer, apiv1alpha1.Resource("clienttrafficpolicy"))} +} + +// ClientTrafficPolicies returns an object that can list and get ClientTrafficPolicies. +func (s *clientTrafficPolicyLister) ClientTrafficPolicies(namespace string) ClientTrafficPolicyNamespaceLister { + return clientTrafficPolicyNamespaceLister{listers.NewNamespaced[*apiv1alpha1.ClientTrafficPolicy](s.ResourceIndexer, namespace)} +} + +// ClientTrafficPolicyNamespaceLister helps list and get ClientTrafficPolicies. +// All objects returned here must be treated as read-only. +type ClientTrafficPolicyNamespaceLister interface { + // List lists all ClientTrafficPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.ClientTrafficPolicy, err error) + // Get retrieves the ClientTrafficPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*apiv1alpha1.ClientTrafficPolicy, error) + ClientTrafficPolicyNamespaceListerExpansion +} + +// clientTrafficPolicyNamespaceLister implements the ClientTrafficPolicyNamespaceLister +// interface. +type clientTrafficPolicyNamespaceLister struct { + listers.ResourceIndexer[*apiv1alpha1.ClientTrafficPolicy] +} diff --git a/pkg/client/listers/api/v1alpha1/envoyextensionpolicy.go b/pkg/client/listers/api/v1alpha1/envoyextensionpolicy.go new file mode 100644 index 00000000000..e1d834fb83b --- /dev/null +++ b/pkg/client/listers/api/v1alpha1/envoyextensionpolicy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// EnvoyExtensionPolicyLister helps list EnvoyExtensionPolicies. +// All objects returned here must be treated as read-only. +type EnvoyExtensionPolicyLister interface { + // List lists all EnvoyExtensionPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.EnvoyExtensionPolicy, err error) + // EnvoyExtensionPolicies returns an object that can list and get EnvoyExtensionPolicies. + EnvoyExtensionPolicies(namespace string) EnvoyExtensionPolicyNamespaceLister + EnvoyExtensionPolicyListerExpansion +} + +// envoyExtensionPolicyLister implements the EnvoyExtensionPolicyLister interface. +type envoyExtensionPolicyLister struct { + listers.ResourceIndexer[*apiv1alpha1.EnvoyExtensionPolicy] +} + +// NewEnvoyExtensionPolicyLister returns a new EnvoyExtensionPolicyLister. +func NewEnvoyExtensionPolicyLister(indexer cache.Indexer) EnvoyExtensionPolicyLister { + return &envoyExtensionPolicyLister{listers.New[*apiv1alpha1.EnvoyExtensionPolicy](indexer, apiv1alpha1.Resource("envoyextensionpolicy"))} +} + +// EnvoyExtensionPolicies returns an object that can list and get EnvoyExtensionPolicies. +func (s *envoyExtensionPolicyLister) EnvoyExtensionPolicies(namespace string) EnvoyExtensionPolicyNamespaceLister { + return envoyExtensionPolicyNamespaceLister{listers.NewNamespaced[*apiv1alpha1.EnvoyExtensionPolicy](s.ResourceIndexer, namespace)} +} + +// EnvoyExtensionPolicyNamespaceLister helps list and get EnvoyExtensionPolicies. +// All objects returned here must be treated as read-only. +type EnvoyExtensionPolicyNamespaceLister interface { + // List lists all EnvoyExtensionPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.EnvoyExtensionPolicy, err error) + // Get retrieves the EnvoyExtensionPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*apiv1alpha1.EnvoyExtensionPolicy, error) + EnvoyExtensionPolicyNamespaceListerExpansion +} + +// envoyExtensionPolicyNamespaceLister implements the EnvoyExtensionPolicyNamespaceLister +// interface. +type envoyExtensionPolicyNamespaceLister struct { + listers.ResourceIndexer[*apiv1alpha1.EnvoyExtensionPolicy] +} diff --git a/pkg/client/listers/api/v1alpha1/envoypatchpolicy.go b/pkg/client/listers/api/v1alpha1/envoypatchpolicy.go new file mode 100644 index 00000000000..f2d2311644c --- /dev/null +++ b/pkg/client/listers/api/v1alpha1/envoypatchpolicy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// EnvoyPatchPolicyLister helps list EnvoyPatchPolicies. +// All objects returned here must be treated as read-only. +type EnvoyPatchPolicyLister interface { + // List lists all EnvoyPatchPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.EnvoyPatchPolicy, err error) + // EnvoyPatchPolicies returns an object that can list and get EnvoyPatchPolicies. + EnvoyPatchPolicies(namespace string) EnvoyPatchPolicyNamespaceLister + EnvoyPatchPolicyListerExpansion +} + +// envoyPatchPolicyLister implements the EnvoyPatchPolicyLister interface. +type envoyPatchPolicyLister struct { + listers.ResourceIndexer[*apiv1alpha1.EnvoyPatchPolicy] +} + +// NewEnvoyPatchPolicyLister returns a new EnvoyPatchPolicyLister. +func NewEnvoyPatchPolicyLister(indexer cache.Indexer) EnvoyPatchPolicyLister { + return &envoyPatchPolicyLister{listers.New[*apiv1alpha1.EnvoyPatchPolicy](indexer, apiv1alpha1.Resource("envoypatchpolicy"))} +} + +// EnvoyPatchPolicies returns an object that can list and get EnvoyPatchPolicies. +func (s *envoyPatchPolicyLister) EnvoyPatchPolicies(namespace string) EnvoyPatchPolicyNamespaceLister { + return envoyPatchPolicyNamespaceLister{listers.NewNamespaced[*apiv1alpha1.EnvoyPatchPolicy](s.ResourceIndexer, namespace)} +} + +// EnvoyPatchPolicyNamespaceLister helps list and get EnvoyPatchPolicies. +// All objects returned here must be treated as read-only. +type EnvoyPatchPolicyNamespaceLister interface { + // List lists all EnvoyPatchPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.EnvoyPatchPolicy, err error) + // Get retrieves the EnvoyPatchPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*apiv1alpha1.EnvoyPatchPolicy, error) + EnvoyPatchPolicyNamespaceListerExpansion +} + +// envoyPatchPolicyNamespaceLister implements the EnvoyPatchPolicyNamespaceLister +// interface. +type envoyPatchPolicyNamespaceLister struct { + listers.ResourceIndexer[*apiv1alpha1.EnvoyPatchPolicy] +} diff --git a/pkg/client/listers/api/v1alpha1/envoyproxy.go b/pkg/client/listers/api/v1alpha1/envoyproxy.go new file mode 100644 index 00000000000..b8ab7e92d4d --- /dev/null +++ b/pkg/client/listers/api/v1alpha1/envoyproxy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// EnvoyProxyLister helps list EnvoyProxies. +// All objects returned here must be treated as read-only. +type EnvoyProxyLister interface { + // List lists all EnvoyProxies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.EnvoyProxy, err error) + // EnvoyProxies returns an object that can list and get EnvoyProxies. + EnvoyProxies(namespace string) EnvoyProxyNamespaceLister + EnvoyProxyListerExpansion +} + +// envoyProxyLister implements the EnvoyProxyLister interface. +type envoyProxyLister struct { + listers.ResourceIndexer[*apiv1alpha1.EnvoyProxy] +} + +// NewEnvoyProxyLister returns a new EnvoyProxyLister. +func NewEnvoyProxyLister(indexer cache.Indexer) EnvoyProxyLister { + return &envoyProxyLister{listers.New[*apiv1alpha1.EnvoyProxy](indexer, apiv1alpha1.Resource("envoyproxy"))} +} + +// EnvoyProxies returns an object that can list and get EnvoyProxies. +func (s *envoyProxyLister) EnvoyProxies(namespace string) EnvoyProxyNamespaceLister { + return envoyProxyNamespaceLister{listers.NewNamespaced[*apiv1alpha1.EnvoyProxy](s.ResourceIndexer, namespace)} +} + +// EnvoyProxyNamespaceLister helps list and get EnvoyProxies. +// All objects returned here must be treated as read-only. +type EnvoyProxyNamespaceLister interface { + // List lists all EnvoyProxies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.EnvoyProxy, err error) + // Get retrieves the EnvoyProxy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*apiv1alpha1.EnvoyProxy, error) + EnvoyProxyNamespaceListerExpansion +} + +// envoyProxyNamespaceLister implements the EnvoyProxyNamespaceLister +// interface. +type envoyProxyNamespaceLister struct { + listers.ResourceIndexer[*apiv1alpha1.EnvoyProxy] +} diff --git a/pkg/client/listers/api/v1alpha1/expansion_generated.go b/pkg/client/listers/api/v1alpha1/expansion_generated.go new file mode 100644 index 00000000000..e7f8e5e99d1 --- /dev/null +++ b/pkg/client/listers/api/v1alpha1/expansion_generated.go @@ -0,0 +1,72 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// BackendListerExpansion allows custom methods to be added to +// BackendLister. +type BackendListerExpansion interface{} + +// BackendNamespaceListerExpansion allows custom methods to be added to +// BackendNamespaceLister. +type BackendNamespaceListerExpansion interface{} + +// BackendTrafficPolicyListerExpansion allows custom methods to be added to +// BackendTrafficPolicyLister. +type BackendTrafficPolicyListerExpansion interface{} + +// BackendTrafficPolicyNamespaceListerExpansion allows custom methods to be added to +// BackendTrafficPolicyNamespaceLister. +type BackendTrafficPolicyNamespaceListerExpansion interface{} + +// ClientTrafficPolicyListerExpansion allows custom methods to be added to +// ClientTrafficPolicyLister. +type ClientTrafficPolicyListerExpansion interface{} + +// ClientTrafficPolicyNamespaceListerExpansion allows custom methods to be added to +// ClientTrafficPolicyNamespaceLister. +type ClientTrafficPolicyNamespaceListerExpansion interface{} + +// EnvoyExtensionPolicyListerExpansion allows custom methods to be added to +// EnvoyExtensionPolicyLister. +type EnvoyExtensionPolicyListerExpansion interface{} + +// EnvoyExtensionPolicyNamespaceListerExpansion allows custom methods to be added to +// EnvoyExtensionPolicyNamespaceLister. +type EnvoyExtensionPolicyNamespaceListerExpansion interface{} + +// EnvoyPatchPolicyListerExpansion allows custom methods to be added to +// EnvoyPatchPolicyLister. +type EnvoyPatchPolicyListerExpansion interface{} + +// EnvoyPatchPolicyNamespaceListerExpansion allows custom methods to be added to +// EnvoyPatchPolicyNamespaceLister. +type EnvoyPatchPolicyNamespaceListerExpansion interface{} + +// EnvoyProxyListerExpansion allows custom methods to be added to +// EnvoyProxyLister. +type EnvoyProxyListerExpansion interface{} + +// EnvoyProxyNamespaceListerExpansion allows custom methods to be added to +// EnvoyProxyNamespaceLister. +type EnvoyProxyNamespaceListerExpansion interface{} + +// HTTPRouteFilterListerExpansion allows custom methods to be added to +// HTTPRouteFilterLister. +type HTTPRouteFilterListerExpansion interface{} + +// HTTPRouteFilterNamespaceListerExpansion allows custom methods to be added to +// HTTPRouteFilterNamespaceLister. +type HTTPRouteFilterNamespaceListerExpansion interface{} + +// SecurityPolicyListerExpansion allows custom methods to be added to +// SecurityPolicyLister. +type SecurityPolicyListerExpansion interface{} + +// SecurityPolicyNamespaceListerExpansion allows custom methods to be added to +// SecurityPolicyNamespaceLister. +type SecurityPolicyNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/api/v1alpha1/httproutefilter.go b/pkg/client/listers/api/v1alpha1/httproutefilter.go new file mode 100644 index 00000000000..584d6774879 --- /dev/null +++ b/pkg/client/listers/api/v1alpha1/httproutefilter.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// HTTPRouteFilterLister helps list HTTPRouteFilters. +// All objects returned here must be treated as read-only. +type HTTPRouteFilterLister interface { + // List lists all HTTPRouteFilters in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.HTTPRouteFilter, err error) + // HTTPRouteFilters returns an object that can list and get HTTPRouteFilters. + HTTPRouteFilters(namespace string) HTTPRouteFilterNamespaceLister + HTTPRouteFilterListerExpansion +} + +// hTTPRouteFilterLister implements the HTTPRouteFilterLister interface. +type hTTPRouteFilterLister struct { + listers.ResourceIndexer[*apiv1alpha1.HTTPRouteFilter] +} + +// NewHTTPRouteFilterLister returns a new HTTPRouteFilterLister. +func NewHTTPRouteFilterLister(indexer cache.Indexer) HTTPRouteFilterLister { + return &hTTPRouteFilterLister{listers.New[*apiv1alpha1.HTTPRouteFilter](indexer, apiv1alpha1.Resource("httproutefilter"))} +} + +// HTTPRouteFilters returns an object that can list and get HTTPRouteFilters. +func (s *hTTPRouteFilterLister) HTTPRouteFilters(namespace string) HTTPRouteFilterNamespaceLister { + return hTTPRouteFilterNamespaceLister{listers.NewNamespaced[*apiv1alpha1.HTTPRouteFilter](s.ResourceIndexer, namespace)} +} + +// HTTPRouteFilterNamespaceLister helps list and get HTTPRouteFilters. +// All objects returned here must be treated as read-only. +type HTTPRouteFilterNamespaceLister interface { + // List lists all HTTPRouteFilters in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.HTTPRouteFilter, err error) + // Get retrieves the HTTPRouteFilter from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*apiv1alpha1.HTTPRouteFilter, error) + HTTPRouteFilterNamespaceListerExpansion +} + +// hTTPRouteFilterNamespaceLister implements the HTTPRouteFilterNamespaceLister +// interface. +type hTTPRouteFilterNamespaceLister struct { + listers.ResourceIndexer[*apiv1alpha1.HTTPRouteFilter] +} diff --git a/pkg/client/listers/api/v1alpha1/securitypolicy.go b/pkg/client/listers/api/v1alpha1/securitypolicy.go new file mode 100644 index 00000000000..734ca383b15 --- /dev/null +++ b/pkg/client/listers/api/v1alpha1/securitypolicy.go @@ -0,0 +1,59 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + apiv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// SecurityPolicyLister helps list SecurityPolicies. +// All objects returned here must be treated as read-only. +type SecurityPolicyLister interface { + // List lists all SecurityPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.SecurityPolicy, err error) + // SecurityPolicies returns an object that can list and get SecurityPolicies. + SecurityPolicies(namespace string) SecurityPolicyNamespaceLister + SecurityPolicyListerExpansion +} + +// securityPolicyLister implements the SecurityPolicyLister interface. +type securityPolicyLister struct { + listers.ResourceIndexer[*apiv1alpha1.SecurityPolicy] +} + +// NewSecurityPolicyLister returns a new SecurityPolicyLister. +func NewSecurityPolicyLister(indexer cache.Indexer) SecurityPolicyLister { + return &securityPolicyLister{listers.New[*apiv1alpha1.SecurityPolicy](indexer, apiv1alpha1.Resource("securitypolicy"))} +} + +// SecurityPolicies returns an object that can list and get SecurityPolicies. +func (s *securityPolicyLister) SecurityPolicies(namespace string) SecurityPolicyNamespaceLister { + return securityPolicyNamespaceLister{listers.NewNamespaced[*apiv1alpha1.SecurityPolicy](s.ResourceIndexer, namespace)} +} + +// SecurityPolicyNamespaceLister helps list and get SecurityPolicies. +// All objects returned here must be treated as read-only. +type SecurityPolicyNamespaceLister interface { + // List lists all SecurityPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*apiv1alpha1.SecurityPolicy, err error) + // Get retrieves the SecurityPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*apiv1alpha1.SecurityPolicy, error) + SecurityPolicyNamespaceListerExpansion +} + +// securityPolicyNamespaceLister implements the SecurityPolicyNamespaceLister +// interface. +type securityPolicyNamespaceLister struct { + listers.ResourceIndexer[*apiv1alpha1.SecurityPolicy] +} diff --git a/test/e2e/tests/response-override.go b/test/e2e/tests/response-override.go index 29b2c497a75..301befd1f9c 100644 --- a/test/e2e/tests/response-override.go +++ b/test/e2e/tests/response-override.go @@ -78,6 +78,7 @@ func verifyCustomResponse(t *testing.T, timeoutConfig *config.TimeoutConfig, gwA ) { if timeoutConfig == nil { t.Fatalf("timeoutConfig cannot be nil") + return } reqURL := url.URL{ diff --git a/test/e2e/tests/tcproute.go b/test/e2e/tests/tcproute.go index 877663ceac3..b3b49cf561e 100644 --- a/test/e2e/tests/tcproute.go +++ b/test/e2e/tests/tcproute.go @@ -135,6 +135,7 @@ func WaitForGatewayAddress(t *testing.T, client client.Client, timeoutConfig *co if timeoutConfig == nil { t.Fatalf("timeoutConfig cannot be nil") + return "", nil } var ipAddr, port string @@ -179,6 +180,7 @@ func TCPRouteMustHaveParents(t *testing.T, client client.Client, timeoutConfig * if timeoutConfig == nil { t.Fatalf("timeoutConfig cannot be nil") + return } var actual []gwapiv1.RouteParentStatus diff --git a/test/e2e/tests/udproute.go b/test/e2e/tests/udproute.go index 6174917d5a2..7188cbedff1 100644 --- a/test/e2e/tests/udproute.go +++ b/test/e2e/tests/udproute.go @@ -100,6 +100,7 @@ func GatewayAndUDPRoutesMustBeAccepted(t *testing.T, c client.Client, timeoutCon if timeoutConfig == nil { t.Fatalf("timeoutConfig cannot be nil") + return "" } gwAddr, err := kubernetes.WaitForGatewayAddress(t, c, *timeoutConfig, kubernetes.GatewayRef{ @@ -147,6 +148,7 @@ func UDPRouteMustHaveParents(t *testing.T, client client.Client, timeoutConfig * if timeoutConfig == nil { t.Fatalf("timeoutConfig cannot be nil") + return } var actual []gwapiv1.RouteParentStatus diff --git a/tools/go.mod b/tools/go.mod index 914d83847c2..92b497fd33e 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -12,6 +12,9 @@ tool ( golang.org/x/perf/cmd/benchstat google.golang.org/grpc/cmd/protoc-gen-go-grpc google.golang.org/protobuf/cmd/protoc-gen-go + k8s.io/code-generator/cmd/client-gen + k8s.io/code-generator/cmd/informer-gen + k8s.io/code-generator/cmd/lister-gen sigs.k8s.io/controller-runtime/tools/setup-envtest sigs.k8s.io/controller-tools/cmd/controller-gen sigs.k8s.io/kind/cmd/kind diff --git a/tools/make/kube.mk b/tools/make/kube.mk index 59034075dcf..8674a3f718a 100644 --- a/tools/make/kube.mk +++ b/tools/make/kube.mk @@ -109,11 +109,43 @@ generate-gwapi-manifests: ## Generate Gateway API manifests and make it consiste @mv $(OUTPUT_DIR)/experimental-gatewayapi-crds.yaml charts/gateway-crds-helm/templates/experimental-gatewayapi-crds.yaml @mv $(OUTPUT_DIR)/standard-gatewayapi-crds.yaml charts/gateway-crds-helm/templates/standard-gatewayapi-crds.yaml +.PHONY: kube-generate-clients +kube-generate-clients: ## Generate Kubernetes clients, informers, and listers + @$(LOG_TARGET) + @echo "Generating Kubernetes clients..." + @echo "Running client-gen..." + $(GO_TOOL) client-gen \ + --clientset-name versioned \ + --input-base "" \ + --input github.com/envoyproxy/gateway/api/v1alpha1 \ + --go-header-file "$(ROOT_DIR)/tools/boilerplate/boilerplate.generatego.txt" \ + --output-pkg github.com/envoyproxy/gateway/pkg/client/clientset \ + --output-dir "$(ROOT_DIR)/pkg/client/clientset" \ + --plural-exceptions "EnvoyProxy:EnvoyProxies" \ + github.com/envoyproxy/gateway/api/v1alpha1 + @echo "Running lister-gen..." + $(GO_TOOL) lister-gen \ + --go-header-file "$(ROOT_DIR)/tools/boilerplate/boilerplate.generatego.txt" \ + --output-pkg github.com/envoyproxy/gateway/pkg/client/listers \ + --output-dir "$(ROOT_DIR)/pkg/client/listers" \ + --plural-exceptions "EnvoyProxy:EnvoyProxies" \ + github.com/envoyproxy/gateway/api/v1alpha1 + @echo "Running informer-gen..." + $(GO_TOOL) informer-gen \ + --versioned-clientset-package github.com/envoyproxy/gateway/pkg/client/clientset/versioned \ + --listers-package github.com/envoyproxy/gateway/pkg/client/listers \ + --go-header-file "$(ROOT_DIR)/tools/boilerplate/boilerplate.generatego.txt" \ + --output-pkg github.com/envoyproxy/gateway/pkg/client/informers \ + --output-dir "$(ROOT_DIR)/pkg/client/informers" \ + --plural-exceptions "EnvoyProxy:EnvoyProxies" \ + github.com/envoyproxy/gateway/api/v1alpha1 + @echo "Client generation complete!" + .PHONY: kube-generate -kube-generate: ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. +kube-generate: kube-generate-clients ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. # Note that the paths can't just be "./..." with the header file, or the tool will panic on run. Sorry. @$(LOG_TARGET) - $(GO_TOOL) controller-gen $(CONTROLLERGEN_OBJECT_FLAGS) paths="{$(ROOT_DIR)/api/...,$(ROOT_DIR)/internal/ir/...,$(ROOT_DIR)/internal/gatewayapi/...}" + $(GO_TOOL) controller-gen $(CONTROLLERGEN_OBJECT_FLAGS) paths="{$(ROOT_DIR)/api/...,$(ROOT_DIR)/internal/gatewayapi/...}" .PHONY: kube-test kube-test: manifests generate run-kube-test