From 4b4fd67f9b182d1bf1d5bd5efdca9cde16fe75a5 Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Mon, 10 Feb 2025 11:06:38 -0500 Subject: [PATCH 01/14] apis: add implementation for GEP-3388 HTTPRoute Retry Budget --- apis/v1alpha2/backendtrafficpolicy_types.go | 107 ++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 apis/v1alpha2/backendtrafficpolicy_types.go diff --git a/apis/v1alpha2/backendtrafficpolicy_types.go b/apis/v1alpha2/backendtrafficpolicy_types.go new file mode 100644 index 0000000000..b19f00f97c --- /dev/null +++ b/apis/v1alpha2/backendtrafficpolicy_types.go @@ -0,0 +1,107 @@ +/* +Copyright 2025 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type BackendTrafficPolicy struct { + // BackendTrafficPolicy defines the configuration for how traffic to a target backend should be handled. + // + // Support: Extended + // + // +optional + // + // + // Note: there is no Override or Default policy configuration. + + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the desired state of BackendTrafficPolicy. + Spec BackendTrafficPolicySpec `json:"spec"` + + // Status defines the current state of BackendTrafficPolicy. + Status PolicyStatus `json:"status,omitempty"` +} + +type BackendTrafficPolicySpec struct { + // TargetRef identifies an API object to apply policy to. + // Currently, Backends (i.e. Service, ServiceImport, or any + // implementation-specific backendRef) are the only valid API + // target references. + // +listType=map + // +listMapKey=group + // +listMapKey=kind + // +listMapKey=name + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=16 + TargetRefs []LocalPolicyTargetReference `json:"targetRefs"` + + // Retry defines the configuration for when to retry a request to a target backend. + // + // Implementations SHOULD retry on connection errors (disconnect, reset, timeout, + // TCP failure) if a retry stanza is configured. + // + // Support: Extended + // + // +optional + // + Retry *CommonRetryPolicy `json:"retry,omitempty"` + + // SessionPersistence defines and configures session persistence + // for the backend. + // + // Support: Extended + // + // +optional + SessionPersistence *SessionPersistence `json:"sessionPersistence,omitempty"` +} + +// CommonRetryPolicy defines the configuration for when to retry a request. +// +type CommonRetryPolicy struct { + // Support: Extended + // + // +optional + BudgetPercent *int `json:"budgetPercent,omitempty"` + + // Support: Extended + // + // +optional + BudgetInterval *Duration `json:"budgetInterval,omitempty"` + + // Support: Extended + // + // +optional + MinRetryRate *RequestRate `json:"minRetryRate,omitempty"` +} + +// RequestRate expresses a rate of requests over a given period of time. +// +type RequestRate struct { + // Support: Extended + // + // +optional + Count *int `json:"count,omitempty"` + + // Support: Extended + // + // +optional + Interval *Duration `json:"interval,omitempty"` +} From 19934172472164ca3eb1cd77f76fbdc72063ee1e Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Mon, 10 Feb 2025 12:33:46 -0500 Subject: [PATCH 02/14] fmt and add descriptions for parameters --- apis/v1alpha2/backendtrafficpolicy_types.go | 161 +++++++++++--------- 1 file changed, 89 insertions(+), 72 deletions(-) diff --git a/apis/v1alpha2/backendtrafficpolicy_types.go b/apis/v1alpha2/backendtrafficpolicy_types.go index b19f00f97c..7d342d3918 100644 --- a/apis/v1alpha2/backendtrafficpolicy_types.go +++ b/apis/v1alpha2/backendtrafficpolicy_types.go @@ -21,87 +21,104 @@ import ( ) type BackendTrafficPolicy struct { - // BackendTrafficPolicy defines the configuration for how traffic to a target backend should be handled. - // - // Support: Extended - // - // +optional - // - // - // Note: there is no Override or Default policy configuration. - - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of BackendTrafficPolicy. - Spec BackendTrafficPolicySpec `json:"spec"` - - // Status defines the current state of BackendTrafficPolicy. - Status PolicyStatus `json:"status,omitempty"` + // BackendTrafficPolicy defines the configuration for how traffic to a + // target backend should be handled. + // + // Support: Extended + // + // +optional + // + // + // Note: there is no Override or Default policy configuration. + + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the desired state of BackendTrafficPolicy. + Spec BackendTrafficPolicySpec `json:"spec"` + + // Status defines the current state of BackendTrafficPolicy. + Status PolicyStatus `json:"status,omitempty"` } type BackendTrafficPolicySpec struct { - // TargetRef identifies an API object to apply policy to. - // Currently, Backends (i.e. Service, ServiceImport, or any - // implementation-specific backendRef) are the only valid API - // target references. - // +listType=map - // +listMapKey=group - // +listMapKey=kind - // +listMapKey=name - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=16 - TargetRefs []LocalPolicyTargetReference `json:"targetRefs"` - - // Retry defines the configuration for when to retry a request to a target backend. - // - // Implementations SHOULD retry on connection errors (disconnect, reset, timeout, - // TCP failure) if a retry stanza is configured. - // - // Support: Extended - // - // +optional - // - Retry *CommonRetryPolicy `json:"retry,omitempty"` - - // SessionPersistence defines and configures session persistence - // for the backend. - // - // Support: Extended - // - // +optional - SessionPersistence *SessionPersistence `json:"sessionPersistence,omitempty"` + // TargetRef identifies an API object to apply policy to. + // Currently, Backends (i.e. Service, ServiceImport, or any + // implementation-specific backendRef) are the only valid API + // target references. + // +listType=map + // +listMapKey=group + // +listMapKey=kind + // +listMapKey=name + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=16 + TargetRefs []LocalPolicyTargetReference `json:"targetRefs"` + + // Retry defines the configuration for when to retry a request to a target + // backend. + // + // Implementations SHOULD retry on connection errors (disconnect, reset, timeout, + // TCP failure) if a retry stanza is configured. + // + // Support: Extended + // + // +optional + // + Retry *CommonRetryPolicy `json:"retry,omitempty"` + + // SessionPersistence defines and configures session persistence + // for the backend. + // + // Support: Extended + // + // +optional + SessionPersistence *SessionPersistence `json:"sessionPersistence,omitempty"` } // CommonRetryPolicy defines the configuration for when to retry a request. -// type CommonRetryPolicy struct { - // Support: Extended - // - // +optional - BudgetPercent *int `json:"budgetPercent,omitempty"` - - // Support: Extended - // - // +optional - BudgetInterval *Duration `json:"budgetInterval,omitempty"` - - // Support: Extended - // - // +optional - MinRetryRate *RequestRate `json:"minRetryRate,omitempty"` + // BudgetPercent defines the maximum percentage of active requests that may + // be made up of retries. + // + // Support: Extended + // + // +optional + BudgetPercent *int `json:"budgetPercent,omitempty"` + + // BudgetInterval defines the duration in which requests will be considered + // for calculating the budget for retries. + // + // Support: Extended + // + // +optional + BudgetInterval *Duration `json:"budgetInterval,omitempty"` + + // MinRetryRate defines the minimum rate of retries that will be allowable + // over a specified duration of time. + // + // Ensures that requests can still be retried during periods of low + // traffic. + // + // Support: Extended + // + // +optional + MinRetryRate *RequestRate `json:"minRetryRate,omitempty"` } // RequestRate expresses a rate of requests over a given period of time. -// type RequestRate struct { - // Support: Extended - // - // +optional - Count *int `json:"count,omitempty"` - - // Support: Extended - // - // +optional - Interval *Duration `json:"interval,omitempty"` + // Count specifies the number of requests per time interval. + // + // Support: Extended + // + // +optional + Count *int `json:"count,omitempty"` + + // Interval specifies the divisor of the rate of requests, the amount of + // time during which the given count of requests occr. + // + // Support: Extended + // + // +optional + Interval *Duration `json:"interval,omitempty"` } From 81ee3189e2fec7c358a4b6a22ef4f1f1091fca69 Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Mon, 10 Feb 2025 12:34:48 -0500 Subject: [PATCH 03/14] Move GEP 3388 to Experimental --- geps/gep-3388/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geps/gep-3388/index.md b/geps/gep-3388/index.md index 8f63436739..23d4763912 100644 --- a/geps/gep-3388/index.md +++ b/geps/gep-3388/index.md @@ -1,7 +1,7 @@ # GEP-3388: Retry Budgets * Issue: [#3388](https://github.com/kubernetes-sigs/gateway-api/issues/3388) -* Status: Implementable +* Status: Experimental (See status definitions [here](/geps/overview/#gep-states).) From 7b61c97629c05b65df56b3c717e92e43da02a204 Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Mon, 10 Feb 2025 12:38:06 -0500 Subject: [PATCH 04/14] make generate --- apis/v1alpha2/zz_generated.deepcopy.go | 104 ++++ apis/v1alpha2/zz_generated.register.go | 1 + ...working.k8s.io_backendtrafficpolicies.yaml | 535 ++++++++++++++++++ pkg/generated/openapi/zz_generated.openapi.go | 166 ++++++ 4 files changed, 806 insertions(+) create mode 100644 config/crd/experimental/gateway.networking.k8s.io_backendtrafficpolicies.yaml diff --git a/apis/v1alpha2/zz_generated.deepcopy.go b/apis/v1alpha2/zz_generated.deepcopy.go index 5306ca135d..21679ee6a1 100644 --- a/apis/v1alpha2/zz_generated.deepcopy.go +++ b/apis/v1alpha2/zz_generated.deepcopy.go @@ -110,6 +110,85 @@ func (in *BackendLBPolicySpec) DeepCopy() *BackendLBPolicySpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendTrafficPolicy) DeepCopyInto(out *BackendTrafficPolicy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTrafficPolicy. +func (in *BackendTrafficPolicy) DeepCopy() *BackendTrafficPolicy { + if in == nil { + return nil + } + out := new(BackendTrafficPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendTrafficPolicySpec) DeepCopyInto(out *BackendTrafficPolicySpec) { + *out = *in + if in.TargetRefs != nil { + in, out := &in.TargetRefs, &out.TargetRefs + *out = make([]LocalPolicyTargetReference, len(*in)) + copy(*out, *in) + } + if in.Retry != nil { + in, out := &in.Retry, &out.Retry + *out = new(CommonRetryPolicy) + (*in).DeepCopyInto(*out) + } + if in.SessionPersistence != nil { + in, out := &in.SessionPersistence, &out.SessionPersistence + *out = new(v1.SessionPersistence) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTrafficPolicySpec. +func (in *BackendTrafficPolicySpec) DeepCopy() *BackendTrafficPolicySpec { + if in == nil { + return nil + } + out := new(BackendTrafficPolicySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonRetryPolicy) DeepCopyInto(out *CommonRetryPolicy) { + *out = *in + if in.BudgetPercent != nil { + in, out := &in.BudgetPercent, &out.BudgetPercent + *out = new(int) + **out = **in + } + if in.BudgetInterval != nil { + in, out := &in.BudgetInterval, &out.BudgetInterval + *out = new(v1.Duration) + **out = **in + } + if in.MinRetryRate != nil { + in, out := &in.MinRetryRate, &out.MinRetryRate + *out = new(RequestRate) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonRetryPolicy. +func (in *CommonRetryPolicy) DeepCopy() *CommonRetryPolicy { + if in == nil { + return nil + } + out := new(CommonRetryPolicy) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GRPCRoute) DeepCopyInto(out *GRPCRoute) { *out = *in @@ -328,6 +407,31 @@ func (in *ReferenceGrantList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RequestRate) DeepCopyInto(out *RequestRate) { + *out = *in + if in.Count != nil { + in, out := &in.Count, &out.Count + *out = new(int) + **out = **in + } + if in.Interval != nil { + in, out := &in.Interval, &out.Interval + *out = new(v1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequestRate. +func (in *RequestRate) DeepCopy() *RequestRate { + if in == nil { + return nil + } + out := new(RequestRate) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TCPRoute) DeepCopyInto(out *TCPRoute) { *out = *in diff --git a/apis/v1alpha2/zz_generated.register.go b/apis/v1alpha2/zz_generated.register.go index bb133e5dc1..55a3b08811 100644 --- a/apis/v1alpha2/zz_generated.register.go +++ b/apis/v1alpha2/zz_generated.register.go @@ -63,6 +63,7 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &BackendLBPolicy{}, &BackendLBPolicyList{}, + &BackendTrafficPolicy{}, &GRPCRoute{}, &GRPCRouteList{}, &ReferenceGrant{}, diff --git a/config/crd/experimental/gateway.networking.k8s.io_backendtrafficpolicies.yaml b/config/crd/experimental/gateway.networking.k8s.io_backendtrafficpolicies.yaml new file mode 100644 index 0000000000..8e9b185c46 --- /dev/null +++ b/config/crd/experimental/gateway.networking.k8s.io_backendtrafficpolicies.yaml @@ -0,0 +1,535 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/3328 + gateway.networking.k8s.io/bundle-version: v1.2.1 + gateway.networking.k8s.io/channel: experimental + creationTimestamp: null + name: backendtrafficpolicies.gateway.networking.k8s.io +spec: + group: gateway.networking.k8s.io + names: + kind: BackendTrafficPolicy + listKind: BackendTrafficPolicyList + plural: backendtrafficpolicies + singular: backendtrafficpolicy + scope: Namespaced + versions: + - name: v1alpha2 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: Spec defines the desired state of BackendTrafficPolicy. + properties: + retry: + description: |- + Retry defines the configuration for when to retry a request to a target + backend. + + Implementations SHOULD retry on connection errors (disconnect, reset, timeout, + TCP failure) if a retry stanza is configured. + + Support: Extended + properties: + budgetInterval: + description: |- + BudgetInterval defines the duration in which requests will be considered + for calculating the budget for retries. + + Support: Extended + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + budgetPercent: + description: |- + BudgetPercent defines the maximum percentage of active requests that may + be made up of retries. + + Support: Extended + type: integer + minRetryRate: + description: |- + MinRetryRate defines the minimum rate of retries that will be allowable + over a specified duration of time. + + Ensures that requests can still be retried during periods of low + traffic. + + Support: Extended + properties: + count: + description: |- + Count specifies the number of requests per time interval. + + Support: Extended + type: integer + interval: + description: |- + Interval specifies the divisor of the rate of requests, the amount of + time during which the given count of requests occr. + + Support: Extended + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object + type: object + sessionPersistence: + description: |- + SessionPersistence defines and configures session persistence + for the backend. + + Support: Extended + properties: + absoluteTimeout: + description: |- + AbsoluteTimeout defines the absolute timeout of the persistent + session. Once the AbsoluteTimeout duration has elapsed, the + session becomes invalid. + + Support: Extended + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + cookieConfig: + description: |- + CookieConfig provides configuration settings that are specific + to cookie-based session persistence. + + Support: Core + properties: + lifetimeType: + default: Session + description: |- + LifetimeType specifies whether the cookie has a permanent or + session-based lifetime. A permanent cookie persists until its + specified expiry time, defined by the Expires or Max-Age cookie + attributes, while a session cookie is deleted when the current + session ends. + + When set to "Permanent", AbsoluteTimeout indicates the + cookie's lifetime via the Expires or Max-Age cookie attributes + and is required. + + When set to "Session", AbsoluteTimeout indicates the + absolute lifetime of the cookie tracked by the gateway and + is optional. + + Defaults to "Session". + + Support: Core for "Session" type + + Support: Extended for "Permanent" type + enum: + - Permanent + - Session + type: string + type: object + idleTimeout: + description: |- + IdleTimeout defines the idle timeout of the persistent session. + Once the session has been idle for more than the specified + IdleTimeout duration, the session becomes invalid. + + Support: Extended + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + sessionName: + description: |- + SessionName defines the name of the persistent session token + which may be reflected in the cookie or the header. Users + should avoid reusing session names to prevent unintended + consequences, such as rejection or unpredictable behavior. + + Support: Implementation-specific + maxLength: 128 + type: string + type: + default: Cookie + description: |- + Type defines the type of session persistence such as through + the use a header or cookie. Defaults to cookie based session + persistence. + + Support: Core for "Cookie" type + + Support: Extended for "Header" type + enum: + - Cookie + - Header + type: string + type: object + x-kubernetes-validations: + - message: AbsoluteTimeout must be specified when cookie lifetimeType + is Permanent + rule: '!has(self.cookieConfig) || !has(self.cookieConfig.lifetimeType) + || self.cookieConfig.lifetimeType != ''Permanent'' || has(self.absoluteTimeout)' + targetRefs: + description: |- + TargetRef identifies an API object to apply policy to. + Currently, Backends (i.e. Service, ServiceImport, or any + implementation-specific backendRef) are the only valid API + target references. + items: + description: |- + LocalPolicyTargetReference identifies an API object to apply a direct or + inherited policy to. This should be used as part of Policy resources + that can target Gateway API resources. For more information on how this + policy attachment model works, and a sample Policy resource, refer to + the policy attachment documentation for Gateway API. + properties: + group: + description: Group is the group of the target resource. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is kind of the target resource. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the target resource. + maxLength: 253 + minLength: 1 + type: string + required: + - group + - kind + - name + type: object + maxItems: 16 + minItems: 1 + type: array + x-kubernetes-list-map-keys: + - group + - kind + - name + x-kubernetes-list-type: map + required: + - targetRefs + type: object + status: + description: Status defines the current state of BackendTrafficPolicy. + properties: + ancestors: + description: |- + Ancestors is a list of ancestor resources (usually Gateways) that are + associated with the policy, and the status of the policy with respect to + each ancestor. When this policy attaches to a parent, the controller that + manages the parent and the ancestors MUST add an entry to this list when + the controller first sees the policy and SHOULD update the entry as + appropriate when the relevant ancestor is modified. + + Note that choosing the relevant ancestor is left to the Policy designers; + an important part of Policy design is designing the right object level at + which to namespace this status. + + Note also that implementations MUST ONLY populate ancestor status for + the Ancestor resources they are responsible for. Implementations MUST + use the ControllerName field to uniquely identify the entries in this list + that they are responsible for. + + Note that to achieve this, the list of PolicyAncestorStatus structs + MUST be treated as a map with a composite key, made up of the AncestorRef + and ControllerName fields combined. + + A maximum of 16 ancestors will be represented in this list. An empty list + means the Policy is not relevant for any ancestors. + + If this slice is full, implementations MUST NOT add further entries. + Instead they MUST consider the policy unimplementable and signal that + on any related resources such as the ancestor that would be referenced + here. For example, if this list was full on BackendTLSPolicy, no + additional Gateways would be able to reference the Service targeted by + the BackendTLSPolicy. + items: + description: |- + PolicyAncestorStatus describes the status of a route with respect to an + associated Ancestor. + + Ancestors refer to objects that are either the Target of a policy or above it + in terms of object hierarchy. For example, if a policy targets a Service, the + Policy's Ancestors are, in order, the Service, the HTTPRoute, the Gateway, and + the GatewayClass. Almost always, in this hierarchy, the Gateway will be the most + useful object to place Policy status on, so we recommend that implementations + SHOULD use Gateway as the PolicyAncestorStatus object unless the designers + have a _very_ good reason otherwise. + + In the context of policy attachment, the Ancestor is used to distinguish which + resource results in a distinct application of this policy. For example, if a policy + targets a Service, it may have a distinct result per attached Gateway. + + Policies targeting the same resource may have different effects depending on the + ancestors of those resources. For example, different Gateways targeting the same + Service may have different capabilities, especially if they have different underlying + implementations. + + For example, in BackendTLSPolicy, the Policy attaches to a Service that is + used as a backend in a HTTPRoute that is itself attached to a Gateway. + In this case, the relevant object for status is the Gateway, and that is the + ancestor object referred to in this status. + + Note that a parent is also an ancestor, so for objects where the parent is the + relevant object for status, this struct SHOULD still be used. + + This struct is intended to be used in a slice that's effectively a map, + with a composite key made up of the AncestorRef and the ControllerName. + properties: + ancestorRef: + description: |- + AncestorRef corresponds with a ParentRef in the spec that this + PolicyAncestorStatus struct describes the status of. + properties: + group: + default: gateway.networking.k8s.io + description: |- + Group is the group of the referent. + When unspecified, "gateway.networking.k8s.io" is inferred. + To set the core API group (such as for a "Service" kind referent), + Group must be explicitly set to "" (empty string). + + Support: Core + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Gateway + description: |- + Kind is kind of the referent. + + There are two kinds of parent resources with "Core" support: + + * Gateway (Gateway conformance profile) + * Service (Mesh conformance profile, ClusterIP Services only) + + Support for other resources is Implementation-Specific. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: |- + Name is the name of the referent. + + Support: Core + maxLength: 253 + minLength: 1 + type: string + namespace: + description: |- + Namespace is the namespace of the referent. When unspecified, this refers + to the local namespace of the Route. + + Note that there are specific rules for ParentRefs which cross namespace + boundaries. Cross-namespace references are only valid if they are explicitly + allowed by something in the namespace they are referring to. For example: + Gateway has the AllowedRoutes field, and ReferenceGrant provides a + generic way to enable any other kind of cross-namespace reference. + + + ParentRefs from a Route to a Service in the same namespace are "producer" + routes, which apply default routing rules to inbound connections from + any namespace to the Service. + + ParentRefs from a Route to a Service in a different namespace are + "consumer" routes, and these routing rules are only applied to outbound + connections originating from the same namespace as the Route, for which + the intended destination of the connections are a Service targeted as a + ParentRef of the Route. + + + Support: Core + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + port: + description: |- + Port is the network port this Route targets. It can be interpreted + differently based on the type of parent resource. + + When the parent resource is a Gateway, this targets all listeners + listening on the specified port that also support this kind of Route(and + select this Route). It's not recommended to set `Port` unless the + networking behaviors specified in a Route must apply to a specific port + as opposed to a listener(s) whose port(s) may be changed. When both Port + and SectionName are specified, the name and port of the selected listener + must match both specified values. + + + When the parent resource is a Service, this targets a specific port in the + Service spec. When both Port (experimental) and SectionName are specified, + the name and port of the selected port must match both specified values. + + + Implementations MAY choose to support other parent resources. + Implementations supporting other types of parent resources MUST clearly + document how/if Port is interpreted. + + For the purpose of status, an attachment is considered successful as + long as the parent resource accepts it partially. For example, Gateway + listeners can restrict which Routes can attach to them by Route kind, + namespace, or hostname. If 1 of 2 Gateway listeners accept attachment + from the referencing Route, the Route MUST be considered successfully + attached. If no Gateway listeners accept attachment from this Route, + the Route MUST be considered detached from the Gateway. + + Support: Extended + format: int32 + maximum: 65535 + minimum: 1 + type: integer + sectionName: + description: |- + SectionName is the name of a section within the target resource. In the + following resources, SectionName is interpreted as the following: + + * Gateway: Listener name. When both Port (experimental) and SectionName + are specified, the name and port of the selected listener must match + both specified values. + * Service: Port name. When both Port (experimental) and SectionName + are specified, the name and port of the selected listener must match + both specified values. + + Implementations MAY choose to support attaching Routes to other resources. + If that is the case, they MUST clearly document how SectionName is + interpreted. + + When unspecified (empty string), this will reference the entire resource. + For the purpose of status, an attachment is considered successful if at + least one section in the parent resource accepts it. For example, Gateway + listeners can restrict which Routes can attach to them by Route kind, + namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from + the referencing Route, the Route MUST be considered successfully + attached. If no Gateway listeners accept attachment from this Route, the + Route MUST be considered detached from the Gateway. + + Support: Core + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - name + type: object + conditions: + description: Conditions describes the status of the Policy with + respect to the given Ancestor. + items: + description: Condition contains details for one aspect of + the current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 8 + minItems: 1 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + controllerName: + description: |- + ControllerName is a domain/path string that indicates the name of the + controller that wrote this status. This corresponds with the + controllerName field on GatewayClass. + + Example: "example.net/gateway-controller". + + The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are + valid Kubernetes names + (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). + + Controllers MUST populate this field when writing status. Controllers should ensure that + entries to status populated with their ControllerName are cleaned up when they are no + longer necessary. + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$ + type: string + required: + - ancestorRef + - controllerName + type: object + maxItems: 16 + type: array + required: + - ancestors + type: object + required: + - spec + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: null + storedVersions: null diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 811e47ee48..8f462cbe8e 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -149,6 +149,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendLBPolicy": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendLBPolicy(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendLBPolicyList": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendLBPolicyList(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendLBPolicySpec": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendLBPolicySpec(ref), + "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicy": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicy(ref), + "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicySpec": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicySpec(ref), + "sigs.k8s.io/gateway-api/apis/v1alpha2.CommonRetryPolicy": schema_sigsk8sio_gateway_api_apis_v1alpha2_CommonRetryPolicy(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.GRPCRoute": schema_sigsk8sio_gateway_api_apis_v1alpha2_GRPCRoute(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.GRPCRouteList": schema_sigsk8sio_gateway_api_apis_v1alpha2_GRPCRouteList(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.LocalPolicyTargetReference": schema_sigsk8sio_gateway_api_apis_v1alpha2_LocalPolicyTargetReference(ref), @@ -158,6 +161,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "sigs.k8s.io/gateway-api/apis/v1alpha2.PolicyStatus": schema_sigsk8sio_gateway_api_apis_v1alpha2_PolicyStatus(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.ReferenceGrant": schema_sigsk8sio_gateway_api_apis_v1alpha2_ReferenceGrant(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.ReferenceGrantList": schema_sigsk8sio_gateway_api_apis_v1alpha2_ReferenceGrantList(ref), + "sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate": schema_sigsk8sio_gateway_api_apis_v1alpha2_RequestRate(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.TCPRoute": schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRoute(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.TCPRouteList": schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRouteList(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.TCPRouteRule": schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRouteRule(ref), @@ -5816,6 +5820,141 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendLBPolicySpec(ref common.R } } +func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec defines the desired state of BackendTrafficPolicy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicySpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status defines the current state of BackendTrafficPolicy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.PolicyStatus"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicySpec", "sigs.k8s.io/gateway-api/apis/v1alpha2.PolicyStatus"}, + } +} + +func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "targetRefs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "group", + "kind", + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "TargetRef identifies an API object to apply policy to. Currently, Backends (i.e. Service, ServiceImport, or any implementation-specific backendRef) are the only valid API target references.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.LocalPolicyTargetReference"), + }, + }, + }, + }, + }, + "retry": { + SchemaProps: spec.SchemaProps{ + Description: "Retry defines the configuration for when to retry a request to a target backend.\n\nImplementations SHOULD retry on connection errors (disconnect, reset, timeout, TCP failure) if a retry stanza is configured.\n\nSupport: Extended\n\n", + Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.CommonRetryPolicy"), + }, + }, + "sessionPersistence": { + SchemaProps: spec.SchemaProps{ + Description: "SessionPersistence defines and configures session persistence for the backend.\n\nSupport: Extended", + Ref: ref("sigs.k8s.io/gateway-api/apis/v1.SessionPersistence"), + }, + }, + }, + Required: []string{"targetRefs"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/gateway-api/apis/v1.SessionPersistence", "sigs.k8s.io/gateway-api/apis/v1alpha2.CommonRetryPolicy", "sigs.k8s.io/gateway-api/apis/v1alpha2.LocalPolicyTargetReference"}, + } +} + +func schema_sigsk8sio_gateway_api_apis_v1alpha2_CommonRetryPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CommonRetryPolicy defines the configuration for when to retry a request.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "budgetPercent": { + SchemaProps: spec.SchemaProps{ + Description: "BudgetPercent defines the maximum percentage of active requests that may be made up of retries.\n\nSupport: Extended", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "budgetInterval": { + SchemaProps: spec.SchemaProps{ + Description: "BudgetInterval defines the duration in which requests will be considered for calculating the budget for retries.\n\nSupport: Extended", + Type: []string{"string"}, + Format: "", + }, + }, + "minRetryRate": { + SchemaProps: spec.SchemaProps{ + Description: "MinRetryRate defines the minimum rate of retries that will be allowable over a specified duration of time.\n\nEnsures that requests can still be retried during periods of low traffic.\n\nSupport: Extended", + Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate"}, + } +} + func schema_sigsk8sio_gateway_api_apis_v1alpha2_GRPCRoute(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -6214,6 +6353,33 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_ReferenceGrantList(ref common.Re } } +func schema_sigsk8sio_gateway_api_apis_v1alpha2_RequestRate(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RequestRate expresses a rate of requests over a given period of time.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "count": { + SchemaProps: spec.SchemaProps{ + Description: "Count specifies the number of requests per time interval.\n\nSupport: Extended", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "interval": { + SchemaProps: spec.SchemaProps{ + Description: "Interval specifies the divisor of the rate of requests, the amount of time during which the given count of requests occr.\n\nSupport: Extended", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRoute(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ From 6661e47547c47ba32fbed0c45277ee8163bb407b Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Mon, 10 Feb 2025 12:59:56 -0500 Subject: [PATCH 05/14] Minor change --- apis/v1alpha2/backendtrafficpolicy_types.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apis/v1alpha2/backendtrafficpolicy_types.go b/apis/v1alpha2/backendtrafficpolicy_types.go index 7d342d3918..e91b487fa8 100644 --- a/apis/v1alpha2/backendtrafficpolicy_types.go +++ b/apis/v1alpha2/backendtrafficpolicy_types.go @@ -96,8 +96,9 @@ type CommonRetryPolicy struct { // MinRetryRate defines the minimum rate of retries that will be allowable // over a specified duration of time. // - // Ensures that requests can still be retried during periods of low - // traffic. + // This ensures that requests can still be retried during periods of low + // traffic, where the budget for retries may be calculated as a very low + // value. // // Support: Extended // @@ -115,7 +116,7 @@ type RequestRate struct { Count *int `json:"count,omitempty"` // Interval specifies the divisor of the rate of requests, the amount of - // time during which the given count of requests occr. + // time during which the given count of requests occur. // // Support: Extended // From e359c3e6636e7cd01767d4f639effb001ca4a436 Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Mon, 10 Feb 2025 13:09:10 -0500 Subject: [PATCH 06/14] Require both parameters of RequestRate --- apis/v1alpha2/backendtrafficpolicy_types.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/apis/v1alpha2/backendtrafficpolicy_types.go b/apis/v1alpha2/backendtrafficpolicy_types.go index e91b487fa8..69c7a0f23f 100644 --- a/apis/v1alpha2/backendtrafficpolicy_types.go +++ b/apis/v1alpha2/backendtrafficpolicy_types.go @@ -111,15 +111,11 @@ type RequestRate struct { // Count specifies the number of requests per time interval. // // Support: Extended - // - // +optional Count *int `json:"count,omitempty"` // Interval specifies the divisor of the rate of requests, the amount of // time during which the given count of requests occur. // // Support: Extended - // - // +optional Interval *Duration `json:"interval,omitempty"` } From b166a68141970d2edd13d2f94d992ef5ab1b9990 Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Tue, 11 Feb 2025 11:01:00 -0500 Subject: [PATCH 07/14] Begin fixing Retry description. Add defaults, some validation, in CommonRetryPolicy --- apis/v1alpha2/backendtrafficpolicy_types.go | 15 +++++++++++---- pkg/generated/openapi/zz_generated.openapi.go | 6 +++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apis/v1alpha2/backendtrafficpolicy_types.go b/apis/v1alpha2/backendtrafficpolicy_types.go index 69c7a0f23f..fe0e5291ac 100644 --- a/apis/v1alpha2/backendtrafficpolicy_types.go +++ b/apis/v1alpha2/backendtrafficpolicy_types.go @@ -54,11 +54,13 @@ type BackendTrafficPolicySpec struct { // +kubebuilder:validation:MaxItems=16 TargetRefs []LocalPolicyTargetReference `json:"targetRefs"` - // Retry defines the configuration for when to retry a request to a target - // backend. + // Retry defines the configuration for when to allow or prevent retries to a + // target backend. // - // Implementations SHOULD retry on connection errors (disconnect, reset, timeout, - // TCP failure) if a retry stanza is configured. + // While the static number of retries performed by the client are + // configured within HTTPRoute Retry stanzas, configuring the + // CommonRetryPolicy allows you to constrain further retries after a + // dynamic budget for retries has been exceeded. // // Support: Extended // @@ -83,6 +85,9 @@ type CommonRetryPolicy struct { // Support: Extended // // +optional + // +kubebuilder:default=20 + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=100 BudgetPercent *int `json:"budgetPercent,omitempty"` // BudgetInterval defines the duration in which requests will be considered @@ -91,6 +96,7 @@ type CommonRetryPolicy struct { // Support: Extended // // +optional + // +kubebuilder:default=10s BudgetInterval *Duration `json:"budgetInterval,omitempty"` // MinRetryRate defines the minimum rate of retries that will be allowable @@ -103,6 +109,7 @@ type CommonRetryPolicy struct { // Support: Extended // // +optional + // +kubebuilder:default={count: 10, interval: 1s} MinRetryRate *RequestRate `json:"minRetryRate,omitempty"` } diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 8f462cbe8e..568e51dbc1 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -5901,7 +5901,7 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicySpec(ref com }, "retry": { SchemaProps: spec.SchemaProps{ - Description: "Retry defines the configuration for when to retry a request to a target backend.\n\nImplementations SHOULD retry on connection errors (disconnect, reset, timeout, TCP failure) if a retry stanza is configured.\n\nSupport: Extended\n\n", + Description: "Retry defines the configuration for when to allow or prevent retries to a target backend.\n\nWhile the static number of retries performed by the client are configured within HTTPRoute Retry stanzas, configuring the CommonRetryPolicy allows you to constrain further retries after a dynamic budget for retries has been exceeded.\n\nSupport: Extended\n\n", Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.CommonRetryPolicy"), }, }, @@ -5943,7 +5943,7 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_CommonRetryPolicy(ref common.Ref }, "minRetryRate": { SchemaProps: spec.SchemaProps{ - Description: "MinRetryRate defines the minimum rate of retries that will be allowable over a specified duration of time.\n\nEnsures that requests can still be retried during periods of low traffic.\n\nSupport: Extended", + Description: "MinRetryRate defines the minimum rate of retries that will be allowable over a specified duration of time.\n\nThis ensures that requests can still be retried during periods of low traffic, where the budget for retries may be calculated as a very low value.\n\nSupport: Extended", Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate"), }, }, @@ -6369,7 +6369,7 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_RequestRate(ref common.Reference }, "interval": { SchemaProps: spec.SchemaProps{ - Description: "Interval specifies the divisor of the rate of requests, the amount of time during which the given count of requests occr.\n\nSupport: Extended", + Description: "Interval specifies the divisor of the rate of requests, the amount of time during which the given count of requests occur.\n\nSupport: Extended", Type: []string{"string"}, Format: "", }, From 1a122fa5c91ebe11d73f395941d2768423bc008e Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Wed, 12 Feb 2025 09:37:30 -0500 Subject: [PATCH 08/14] Taking the liberty of renaming CommonRetryPolicy to RetryConstraint --- apis/v1alpha2/backendtrafficpolicy_types.go | 24 +++++---------------- apis/v1alpha2/shared_types.go | 15 +++++++++++++ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/apis/v1alpha2/backendtrafficpolicy_types.go b/apis/v1alpha2/backendtrafficpolicy_types.go index fe0e5291ac..20db629efc 100644 --- a/apis/v1alpha2/backendtrafficpolicy_types.go +++ b/apis/v1alpha2/backendtrafficpolicy_types.go @@ -54,19 +54,19 @@ type BackendTrafficPolicySpec struct { // +kubebuilder:validation:MaxItems=16 TargetRefs []LocalPolicyTargetReference `json:"targetRefs"` - // Retry defines the configuration for when to allow or prevent retries to a + // RetryConstraint defines the configuration for when to allow or prevent retries to a // target backend. // // While the static number of retries performed by the client are // configured within HTTPRoute Retry stanzas, configuring the - // CommonRetryPolicy allows you to constrain further retries after a + // RetryConstraint allows you to constrain further retries after a // dynamic budget for retries has been exceeded. // // Support: Extended // // +optional // - Retry *CommonRetryPolicy `json:"retry,omitempty"` + RetryConstraint *RetryConstraint `json:"retry,omitempty"` // SessionPersistence defines and configures session persistence // for the backend. @@ -77,8 +77,8 @@ type BackendTrafficPolicySpec struct { SessionPersistence *SessionPersistence `json:"sessionPersistence,omitempty"` } -// CommonRetryPolicy defines the configuration for when to retry a request. -type CommonRetryPolicy struct { +// RetryConstraint defines the configuration for when to retry a request. +type RetryConstraint struct { // BudgetPercent defines the maximum percentage of active requests that may // be made up of retries. // @@ -112,17 +112,3 @@ type CommonRetryPolicy struct { // +kubebuilder:default={count: 10, interval: 1s} MinRetryRate *RequestRate `json:"minRetryRate,omitempty"` } - -// RequestRate expresses a rate of requests over a given period of time. -type RequestRate struct { - // Count specifies the number of requests per time interval. - // - // Support: Extended - Count *int `json:"count,omitempty"` - - // Interval specifies the divisor of the rate of requests, the amount of - // time during which the given count of requests occur. - // - // Support: Extended - Interval *Duration `json:"interval,omitempty"` -} diff --git a/apis/v1alpha2/shared_types.go b/apis/v1alpha2/shared_types.go index 2fb84d5f3b..8a40d602f4 100644 --- a/apis/v1alpha2/shared_types.go +++ b/apis/v1alpha2/shared_types.go @@ -389,3 +389,18 @@ const ( // SessionPersistence. // +k8s:deepcopy-gen=false type SessionPersistence = v1.SessionPersistence + +// RequestRate expresses a rate of requests over a given period of time. +type RequestRate struct { + // Count specifies the number of requests per time interval. + // + // Support: Extended + // +kubebuilder:validation:Minimum=0 + Count *int `json:"count,omitempty"` + + // Interval specifies the divisor of the rate of requests, the amount of + // time during which the given count of requests occur. + // + // Support: Extended + Interval *Duration `json:"interval,omitempty"` +} From 5a02c8e440de89f5ef5f6e2cb687ec0c021102f1 Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Wed, 12 Feb 2025 10:00:04 -0500 Subject: [PATCH 09/14] Shamelessly copying from backendlbpolicy and backendtlspolicy to conform with api structure --- .../apis/v1alpha2/backendtrafficpolicy.go | 264 ++++++++++++++++++ .../apis/v1alpha2/backendtrafficpolicyspec.go | 66 +++++ .../apis/v1alpha2/requestrate.go | 52 ++++ .../apis/v1alpha2/retryconstraint.go | 61 ++++ apis/applyconfiguration/internal/internal.go | 61 ++++ apis/applyconfiguration/utils.go | 8 + apis/v1alpha2/backendtrafficpolicy_types.go | 23 +- apis/v1alpha2/zz_generated.deepcopy.go | 106 ++++--- apis/v1alpha2/zz_generated.register.go | 1 + .../typed/apis/v1alpha2/apis_client.go | 5 + .../apis/v1alpha2/backendtrafficpolicy.go | 73 +++++ .../apis/v1alpha2/fake/fake_apis_client.go | 4 + .../fake/fake_backendtrafficpolicy.go | 197 +++++++++++++ .../apis/v1alpha2/generated_expansion.go | 2 + .../apis/v1alpha2/backendtrafficpolicy.go | 90 ++++++ .../apis/v1alpha2/interface.go | 7 + .../informers/externalversions/generic.go | 2 + .../apis/v1alpha2/backendtrafficpolicy.go | 70 +++++ .../apis/v1alpha2/expansion_generated.go | 8 + pkg/generated/openapi/zz_generated.openapi.go | 131 ++++++--- 20 files changed, 1155 insertions(+), 76 deletions(-) create mode 100644 apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicy.go create mode 100644 apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicyspec.go create mode 100644 apis/applyconfiguration/apis/v1alpha2/requestrate.go create mode 100644 apis/applyconfiguration/apis/v1alpha2/retryconstraint.go create mode 100644 pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtrafficpolicy.go create mode 100644 pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtrafficpolicy.go create mode 100644 pkg/client/informers/externalversions/apis/v1alpha2/backendtrafficpolicy.go create mode 100644 pkg/client/listers/apis/v1alpha2/backendtrafficpolicy.go diff --git a/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicy.go b/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicy.go new file mode 100644 index 0000000000..f6ab468e7d --- /dev/null +++ b/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicy.go @@ -0,0 +1,264 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" + apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" +) + +// BackendTrafficPolicyApplyConfiguration represents a declarative configuration of the BackendTrafficPolicy type for use +// with apply. +type BackendTrafficPolicyApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *BackendTrafficPolicySpecApplyConfiguration `json:"spec,omitempty"` + Status *PolicyStatusApplyConfiguration `json:"status,omitempty"` +} + +// BackendTrafficPolicy constructs a declarative configuration of the BackendTrafficPolicy type for use with +// apply. +func BackendTrafficPolicy(name, namespace string) *BackendTrafficPolicyApplyConfiguration { + b := &BackendTrafficPolicyApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("BackendTrafficPolicy") + b.WithAPIVersion("gateway.networking.k8s.io/v1alpha2") + return b +} + +// ExtractBackendTrafficPolicy extracts the applied configuration owned by fieldManager from +// backendTrafficPolicy. If no managedFields are found in backendTrafficPolicy for fieldManager, a +// BackendTrafficPolicyApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// backendTrafficPolicy must be a unmodified BackendTrafficPolicy API object that was retrieved from the Kubernetes API. +// ExtractBackendTrafficPolicy provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractBackendTrafficPolicy(backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicy, fieldManager string) (*BackendTrafficPolicyApplyConfiguration, error) { + return extractBackendTrafficPolicy(backendTrafficPolicy, fieldManager, "") +} + +// ExtractBackendTrafficPolicyStatus is the same as ExtractBackendTrafficPolicy except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractBackendTrafficPolicyStatus(backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicy, fieldManager string) (*BackendTrafficPolicyApplyConfiguration, error) { + return extractBackendTrafficPolicy(backendTrafficPolicy, fieldManager, "status") +} + +func extractBackendTrafficPolicy(backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicy, fieldManager string, subresource string) (*BackendTrafficPolicyApplyConfiguration, error) { + b := &BackendTrafficPolicyApplyConfiguration{} + err := managedfields.ExtractInto(backendTrafficPolicy, internal.Parser().Type("io.k8s.sigs.gateway-api.apis.v1alpha2.BackendTrafficPolicy"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(backendTrafficPolicy.Name) + b.WithNamespace(backendTrafficPolicy.Namespace) + + b.WithKind("BackendTrafficPolicy") + b.WithAPIVersion("gateway.networking.k8s.io/v1alpha2") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithKind(value string) *BackendTrafficPolicyApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithAPIVersion(value string) *BackendTrafficPolicyApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithName(value string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithGenerateName(value string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithNamespace(value string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithUID(value types.UID) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithResourceVersion(value string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithGeneration(value int64) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithCreationTimestamp(value metav1.Time) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *BackendTrafficPolicyApplyConfiguration) WithLabels(entries map[string]string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *BackendTrafficPolicyApplyConfiguration) WithAnnotations(entries map[string]string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *BackendTrafficPolicyApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *BackendTrafficPolicyApplyConfiguration) WithFinalizers(values ...string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *BackendTrafficPolicyApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithSpec(value *BackendTrafficPolicySpecApplyConfiguration) *BackendTrafficPolicyApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithStatus(value *PolicyStatusApplyConfiguration) *BackendTrafficPolicyApplyConfiguration { + b.Status = value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *BackendTrafficPolicyApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicyspec.go b/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicyspec.go new file mode 100644 index 0000000000..e24d652a10 --- /dev/null +++ b/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicyspec.go @@ -0,0 +1,66 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" +) + +// BackendTrafficPolicySpecApplyConfiguration represents a declarative configuration of the BackendTrafficPolicySpec type for use +// with apply. +type BackendTrafficPolicySpecApplyConfiguration struct { + TargetRefs []LocalPolicyTargetReferenceApplyConfiguration `json:"targetRefs,omitempty"` + RetryConstraint *RetryConstraintApplyConfiguration `json:"retry,omitempty"` + SessionPersistence *v1.SessionPersistenceApplyConfiguration `json:"sessionPersistence,omitempty"` +} + +// BackendTrafficPolicySpecApplyConfiguration constructs a declarative configuration of the BackendTrafficPolicySpec type for use with +// apply. +func BackendTrafficPolicySpec() *BackendTrafficPolicySpecApplyConfiguration { + return &BackendTrafficPolicySpecApplyConfiguration{} +} + +// WithTargetRefs adds the given value to the TargetRefs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the TargetRefs field. +func (b *BackendTrafficPolicySpecApplyConfiguration) WithTargetRefs(values ...*LocalPolicyTargetReferenceApplyConfiguration) *BackendTrafficPolicySpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTargetRefs") + } + b.TargetRefs = append(b.TargetRefs, *values[i]) + } + return b +} + +// WithRetryConstraint sets the RetryConstraint field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RetryConstraint field is set to the value of the last call. +func (b *BackendTrafficPolicySpecApplyConfiguration) WithRetryConstraint(value *RetryConstraintApplyConfiguration) *BackendTrafficPolicySpecApplyConfiguration { + b.RetryConstraint = value + return b +} + +// WithSessionPersistence sets the SessionPersistence field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SessionPersistence field is set to the value of the last call. +func (b *BackendTrafficPolicySpecApplyConfiguration) WithSessionPersistence(value *v1.SessionPersistenceApplyConfiguration) *BackendTrafficPolicySpecApplyConfiguration { + b.SessionPersistence = value + return b +} diff --git a/apis/applyconfiguration/apis/v1alpha2/requestrate.go b/apis/applyconfiguration/apis/v1alpha2/requestrate.go new file mode 100644 index 0000000000..e71fcd534a --- /dev/null +++ b/apis/applyconfiguration/apis/v1alpha2/requestrate.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// RequestRateApplyConfiguration represents a declarative configuration of the RequestRate type for use +// with apply. +type RequestRateApplyConfiguration struct { + Count *int `json:"count,omitempty"` + Interval *v1.Duration `json:"interval,omitempty"` +} + +// RequestRateApplyConfiguration constructs a declarative configuration of the RequestRate type for use with +// apply. +func RequestRate() *RequestRateApplyConfiguration { + return &RequestRateApplyConfiguration{} +} + +// WithCount sets the Count field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Count field is set to the value of the last call. +func (b *RequestRateApplyConfiguration) WithCount(value int) *RequestRateApplyConfiguration { + b.Count = &value + return b +} + +// WithInterval sets the Interval field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Interval field is set to the value of the last call. +func (b *RequestRateApplyConfiguration) WithInterval(value v1.Duration) *RequestRateApplyConfiguration { + b.Interval = &value + return b +} diff --git a/apis/applyconfiguration/apis/v1alpha2/retryconstraint.go b/apis/applyconfiguration/apis/v1alpha2/retryconstraint.go new file mode 100644 index 0000000000..36f0068138 --- /dev/null +++ b/apis/applyconfiguration/apis/v1alpha2/retryconstraint.go @@ -0,0 +1,61 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// RetryConstraintApplyConfiguration represents a declarative configuration of the RetryConstraint type for use +// with apply. +type RetryConstraintApplyConfiguration struct { + BudgetPercent *int `json:"budgetPercent,omitempty"` + BudgetInterval *v1.Duration `json:"budgetInterval,omitempty"` + MinRetryRate *RequestRateApplyConfiguration `json:"minRetryRate,omitempty"` +} + +// RetryConstraintApplyConfiguration constructs a declarative configuration of the RetryConstraint type for use with +// apply. +func RetryConstraint() *RetryConstraintApplyConfiguration { + return &RetryConstraintApplyConfiguration{} +} + +// WithBudgetPercent sets the BudgetPercent field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BudgetPercent field is set to the value of the last call. +func (b *RetryConstraintApplyConfiguration) WithBudgetPercent(value int) *RetryConstraintApplyConfiguration { + b.BudgetPercent = &value + return b +} + +// WithBudgetInterval sets the BudgetInterval field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BudgetInterval field is set to the value of the last call. +func (b *RetryConstraintApplyConfiguration) WithBudgetInterval(value v1.Duration) *RetryConstraintApplyConfiguration { + b.BudgetInterval = &value + return b +} + +// WithMinRetryRate sets the MinRetryRate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinRetryRate field is set to the value of the last call. +func (b *RetryConstraintApplyConfiguration) WithMinRetryRate(value *RequestRateApplyConfiguration) *RetryConstraintApplyConfiguration { + b.MinRetryRate = value + return b +} diff --git a/apis/applyconfiguration/internal/internal.go b/apis/applyconfiguration/internal/internal.go index 07a0df71dd..0f03327f8e 100644 --- a/apis/applyconfiguration/internal/internal.go +++ b/apis/applyconfiguration/internal/internal.go @@ -1219,6 +1219,46 @@ var schemaYAML = typed.YAMLObject(`types: - group - kind - name +- name: io.k8s.sigs.gateway-api.apis.v1alpha2.BackendTrafficPolicy + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.sigs.gateway-api.apis.v1alpha2.BackendTrafficPolicySpec + default: {} + - name: status + type: + namedType: io.k8s.sigs.gateway-api.apis.v1alpha2.PolicyStatus + default: {} +- name: io.k8s.sigs.gateway-api.apis.v1alpha2.BackendTrafficPolicySpec + map: + fields: + - name: retry + type: + namedType: io.k8s.sigs.gateway-api.apis.v1alpha2.RetryConstraint + - name: sessionPersistence + type: + namedType: io.k8s.sigs.gateway-api.apis.v1.SessionPersistence + - name: targetRefs + type: + list: + elementType: + namedType: io.k8s.sigs.gateway-api.apis.v1alpha2.LocalPolicyTargetReference + elementRelationship: associative + keys: + - group + - kind + - name - name: io.k8s.sigs.gateway-api.apis.v1alpha2.GRPCRoute map: fields: @@ -1318,6 +1358,27 @@ var schemaYAML = typed.YAMLObject(`types: type: namedType: io.k8s.sigs.gateway-api.apis.v1beta1.ReferenceGrantSpec default: {} +- name: io.k8s.sigs.gateway-api.apis.v1alpha2.RequestRate + map: + fields: + - name: count + type: + scalar: numeric + - name: interval + type: + scalar: string +- name: io.k8s.sigs.gateway-api.apis.v1alpha2.RetryConstraint + map: + fields: + - name: budgetInterval + type: + scalar: string + - name: budgetPercent + type: + scalar: numeric + - name: minRetryRate + type: + namedType: io.k8s.sigs.gateway-api.apis.v1alpha2.RequestRate - name: io.k8s.sigs.gateway-api.apis.v1alpha2.TCPRoute map: fields: diff --git a/apis/applyconfiguration/utils.go b/apis/applyconfiguration/utils.go index debd0d9f68..c66eabcb80 100644 --- a/apis/applyconfiguration/utils.go +++ b/apis/applyconfiguration/utils.go @@ -162,6 +162,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &apisv1alpha2.BackendLBPolicyApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("BackendLBPolicySpec"): return &apisv1alpha2.BackendLBPolicySpecApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("BackendTrafficPolicy"): + return &apisv1alpha2.BackendTrafficPolicyApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("BackendTrafficPolicySpec"): + return &apisv1alpha2.BackendTrafficPolicySpecApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("GRPCRoute"): return &apisv1alpha2.GRPCRouteApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("LocalPolicyTargetReference"): @@ -174,6 +178,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &apisv1alpha2.PolicyStatusApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("ReferenceGrant"): return &apisv1alpha2.ReferenceGrantApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("RequestRate"): + return &apisv1alpha2.RequestRateApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("RetryConstraint"): + return &apisv1alpha2.RetryConstraintApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("TCPRoute"): return &apisv1alpha2.TCPRouteApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("TCPRouteRule"): diff --git a/apis/v1alpha2/backendtrafficpolicy_types.go b/apis/v1alpha2/backendtrafficpolicy_types.go index 20db629efc..c8674bdf99 100644 --- a/apis/v1alpha2/backendtrafficpolicy_types.go +++ b/apis/v1alpha2/backendtrafficpolicy_types.go @@ -20,10 +20,19 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +// +genclient +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:resource:categories=gateway-api,shortName=btrafficpolicy +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` +// +// BackendTrafficPolicy is a Direct Attached Policy. +// +kubebuilder:metadata:labels="gateway.networking.k8s.io/policy=Direct" + +// BackendTrafficPolicy defines the configuration for how traffic to a +// target backend should be handled. type BackendTrafficPolicy struct { - // BackendTrafficPolicy defines the configuration for how traffic to a - // target backend should be handled. - // // Support: Extended // // +optional @@ -41,6 +50,14 @@ type BackendTrafficPolicy struct { Status PolicyStatus `json:"status,omitempty"` } +// BackendTrafficPolicyList contains a list of BackendTrafficPolicies +// +kubebuilder:object:root=true +type BackendTrafficPolicyList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []BackendTrafficPolicy `json:"items"` +} + type BackendTrafficPolicySpec struct { // TargetRef identifies an API object to apply policy to. // Currently, Backends (i.e. Service, ServiceImport, or any diff --git a/apis/v1alpha2/zz_generated.deepcopy.go b/apis/v1alpha2/zz_generated.deepcopy.go index 21679ee6a1..e864499ddd 100644 --- a/apis/v1alpha2/zz_generated.deepcopy.go +++ b/apis/v1alpha2/zz_generated.deepcopy.go @@ -129,62 +129,72 @@ func (in *BackendTrafficPolicy) DeepCopy() *BackendTrafficPolicy { return out } +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackendTrafficPolicy) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendTrafficPolicySpec) DeepCopyInto(out *BackendTrafficPolicySpec) { +func (in *BackendTrafficPolicyList) DeepCopyInto(out *BackendTrafficPolicyList) { *out = *in - if in.TargetRefs != nil { - in, out := &in.TargetRefs, &out.TargetRefs - *out = make([]LocalPolicyTargetReference, len(*in)) - copy(*out, *in) - } - if in.Retry != nil { - in, out := &in.Retry, &out.Retry - *out = new(CommonRetryPolicy) - (*in).DeepCopyInto(*out) - } - if in.SessionPersistence != nil { - in, out := &in.SessionPersistence, &out.SessionPersistence - *out = new(v1.SessionPersistence) - (*in).DeepCopyInto(*out) + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BackendTrafficPolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTrafficPolicySpec. -func (in *BackendTrafficPolicySpec) DeepCopy() *BackendTrafficPolicySpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTrafficPolicyList. +func (in *BackendTrafficPolicyList) DeepCopy() *BackendTrafficPolicyList { if in == nil { return nil } - out := new(BackendTrafficPolicySpec) + out := new(BackendTrafficPolicyList) in.DeepCopyInto(out) return out } +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackendTrafficPolicyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CommonRetryPolicy) DeepCopyInto(out *CommonRetryPolicy) { +func (in *BackendTrafficPolicySpec) DeepCopyInto(out *BackendTrafficPolicySpec) { *out = *in - if in.BudgetPercent != nil { - in, out := &in.BudgetPercent, &out.BudgetPercent - *out = new(int) - **out = **in + if in.TargetRefs != nil { + in, out := &in.TargetRefs, &out.TargetRefs + *out = make([]LocalPolicyTargetReference, len(*in)) + copy(*out, *in) } - if in.BudgetInterval != nil { - in, out := &in.BudgetInterval, &out.BudgetInterval - *out = new(v1.Duration) - **out = **in + if in.RetryConstraint != nil { + in, out := &in.RetryConstraint, &out.RetryConstraint + *out = new(RetryConstraint) + (*in).DeepCopyInto(*out) } - if in.MinRetryRate != nil { - in, out := &in.MinRetryRate, &out.MinRetryRate - *out = new(RequestRate) + if in.SessionPersistence != nil { + in, out := &in.SessionPersistence, &out.SessionPersistence + *out = new(v1.SessionPersistence) (*in).DeepCopyInto(*out) } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonRetryPolicy. -func (in *CommonRetryPolicy) DeepCopy() *CommonRetryPolicy { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTrafficPolicySpec. +func (in *BackendTrafficPolicySpec) DeepCopy() *BackendTrafficPolicySpec { if in == nil { return nil } - out := new(CommonRetryPolicy) + out := new(BackendTrafficPolicySpec) in.DeepCopyInto(out) return out } @@ -432,6 +442,36 @@ func (in *RequestRate) DeepCopy() *RequestRate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RetryConstraint) DeepCopyInto(out *RetryConstraint) { + *out = *in + if in.BudgetPercent != nil { + in, out := &in.BudgetPercent, &out.BudgetPercent + *out = new(int) + **out = **in + } + if in.BudgetInterval != nil { + in, out := &in.BudgetInterval, &out.BudgetInterval + *out = new(v1.Duration) + **out = **in + } + if in.MinRetryRate != nil { + in, out := &in.MinRetryRate, &out.MinRetryRate + *out = new(RequestRate) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetryConstraint. +func (in *RetryConstraint) DeepCopy() *RetryConstraint { + if in == nil { + return nil + } + out := new(RetryConstraint) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TCPRoute) DeepCopyInto(out *TCPRoute) { *out = *in diff --git a/apis/v1alpha2/zz_generated.register.go b/apis/v1alpha2/zz_generated.register.go index 55a3b08811..52495a7675 100644 --- a/apis/v1alpha2/zz_generated.register.go +++ b/apis/v1alpha2/zz_generated.register.go @@ -64,6 +64,7 @@ func addKnownTypes(scheme *runtime.Scheme) error { &BackendLBPolicy{}, &BackendLBPolicyList{}, &BackendTrafficPolicy{}, + &BackendTrafficPolicyList{}, &GRPCRoute{}, &GRPCRouteList{}, &ReferenceGrant{}, diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go index 8431bb1688..c24039215d 100644 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go +++ b/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go @@ -29,6 +29,7 @@ import ( type GatewayV1alpha2Interface interface { RESTClient() rest.Interface BackendLBPoliciesGetter + BackendTrafficPoliciesGetter GRPCRoutesGetter ReferenceGrantsGetter TCPRoutesGetter @@ -45,6 +46,10 @@ func (c *GatewayV1alpha2Client) BackendLBPolicies(namespace string) BackendLBPol return newBackendLBPolicies(c, namespace) } +func (c *GatewayV1alpha2Client) BackendTrafficPolicies(namespace string) BackendTrafficPolicyInterface { + return newBackendTrafficPolicies(c, namespace) +} + func (c *GatewayV1alpha2Client) GRPCRoutes(namespace string) GRPCRouteInterface { return newGRPCRoutes(c, namespace) } diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtrafficpolicy.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtrafficpolicy.go new file mode 100644 index 0000000000..cda9a3272d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtrafficpolicy.go @@ -0,0 +1,73 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "context" + + 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" + apisv1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" + v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" +) + +// 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 *v1alpha2.BackendTrafficPolicy, opts v1.CreateOptions) (*v1alpha2.BackendTrafficPolicy, error) + Update(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendTrafficPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (*v1alpha2.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) (*v1alpha2.BackendTrafficPolicy, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.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 *v1alpha2.BackendTrafficPolicy, err error) + Apply(ctx context.Context, backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) + BackendTrafficPolicyExpansion +} + +// backendTrafficPolicies implements BackendTrafficPolicyInterface +type backendTrafficPolicies struct { + *gentype.ClientWithListAndApply[*v1alpha2.BackendTrafficPolicy, *v1alpha2.BackendTrafficPolicyList, *apisv1alpha2.BackendTrafficPolicyApplyConfiguration] +} + +// newBackendTrafficPolicies returns a BackendTrafficPolicies +func newBackendTrafficPolicies(c *GatewayV1alpha2Client, namespace string) *backendTrafficPolicies { + return &backendTrafficPolicies{ + gentype.NewClientWithListAndApply[*v1alpha2.BackendTrafficPolicy, *v1alpha2.BackendTrafficPolicyList, *apisv1alpha2.BackendTrafficPolicyApplyConfiguration]( + "backendtrafficpolicies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.BackendTrafficPolicy { return &v1alpha2.BackendTrafficPolicy{} }, + func() *v1alpha2.BackendTrafficPolicyList { return &v1alpha2.BackendTrafficPolicyList{} }), + } +} diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go index 7ea0de6477..b50a66de8b 100644 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go +++ b/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go @@ -32,6 +32,10 @@ func (c *FakeGatewayV1alpha2) BackendLBPolicies(namespace string) v1alpha2.Backe return &FakeBackendLBPolicies{c, namespace} } +func (c *FakeGatewayV1alpha2) BackendTrafficPolicies(namespace string) v1alpha2.BackendTrafficPolicyInterface { + return &FakeBackendTrafficPolicies{c, namespace} +} + func (c *FakeGatewayV1alpha2) GRPCRoutes(namespace string) v1alpha2.GRPCRouteInterface { return &FakeGRPCRoutes{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtrafficpolicy.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtrafficpolicy.go new file mode 100644 index 0000000000..a67e1275bf --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtrafficpolicy.go @@ -0,0 +1,197 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + apisv1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" + v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" +) + +// FakeBackendTrafficPolicies implements BackendTrafficPolicyInterface +type FakeBackendTrafficPolicies struct { + Fake *FakeGatewayV1alpha2 + ns string +} + +var backendtrafficpoliciesResource = v1alpha2.SchemeGroupVersion.WithResource("backendtrafficpolicies") + +var backendtrafficpoliciesKind = v1alpha2.SchemeGroupVersion.WithKind("BackendTrafficPolicy") + +// Get takes name of the backendTrafficPolicy, and returns the corresponding backendTrafficPolicy object, and an error if there is any. +func (c *FakeBackendTrafficPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(backendtrafficpoliciesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// List takes label and field selectors, and returns the list of BackendTrafficPolicies that match those selectors. +func (c *FakeBackendTrafficPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.BackendTrafficPolicyList, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicyList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(backendtrafficpoliciesResource, backendtrafficpoliciesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.BackendTrafficPolicyList{ListMeta: obj.(*v1alpha2.BackendTrafficPolicyList).ListMeta} + for _, item := range obj.(*v1alpha2.BackendTrafficPolicyList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested backendTrafficPolicies. +func (c *FakeBackendTrafficPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(backendtrafficpoliciesResource, c.ns, opts)) + +} + +// Create takes the representation of a backendTrafficPolicy and creates it. Returns the server's representation of the backendTrafficPolicy, and an error, if there is any. +func (c *FakeBackendTrafficPolicies) Create(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.CreateOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(backendtrafficpoliciesResource, c.ns, backendTrafficPolicy, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// Update takes the representation of a backendTrafficPolicy and updates it. Returns the server's representation of the backendTrafficPolicy, and an error, if there is any. +func (c *FakeBackendTrafficPolicies) Update(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(backendtrafficpoliciesResource, c.ns, backendTrafficPolicy, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeBackendTrafficPolicies) UpdateStatus(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(backendtrafficpoliciesResource, "status", c.ns, backendTrafficPolicy, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// Delete takes name of the backendTrafficPolicy and deletes it. Returns an error if one occurs. +func (c *FakeBackendTrafficPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(backendtrafficpoliciesResource, c.ns, name, opts), &v1alpha2.BackendTrafficPolicy{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBackendTrafficPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(backendtrafficpoliciesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha2.BackendTrafficPolicyList{}) + return err +} + +// Patch applies the patch and returns the patched backendTrafficPolicy. +func (c *FakeBackendTrafficPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.BackendTrafficPolicy, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(backendtrafficpoliciesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied backendTrafficPolicy. +func (c *FakeBackendTrafficPolicies) Apply(ctx context.Context, backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + if backendTrafficPolicy == nil { + return nil, fmt.Errorf("backendTrafficPolicy provided to Apply must not be nil") + } + data, err := json.Marshal(backendTrafficPolicy) + if err != nil { + return nil, err + } + name := backendTrafficPolicy.Name + if name == nil { + return nil, fmt.Errorf("backendTrafficPolicy.Name must be provided to Apply") + } + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(backendtrafficpoliciesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeBackendTrafficPolicies) ApplyStatus(ctx context.Context, backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + if backendTrafficPolicy == nil { + return nil, fmt.Errorf("backendTrafficPolicy provided to Apply must not be nil") + } + data, err := json.Marshal(backendTrafficPolicy) + if err != nil { + return nil, err + } + name := backendTrafficPolicy.Name + if name == nil { + return nil, fmt.Errorf("backendTrafficPolicy.Name must be provided to Apply") + } + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(backendtrafficpoliciesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go index c0fe07b497..c7a03b33fa 100644 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go @@ -20,6 +20,8 @@ package v1alpha2 type BackendLBPolicyExpansion interface{} +type BackendTrafficPolicyExpansion interface{} + type GRPCRouteExpansion interface{} type ReferenceGrantExpansion interface{} diff --git a/pkg/client/informers/externalversions/apis/v1alpha2/backendtrafficpolicy.go b/pkg/client/informers/externalversions/apis/v1alpha2/backendtrafficpolicy.go new file mode 100644 index 0000000000..2afda1c5f7 --- /dev/null +++ b/pkg/client/informers/externalversions/apis/v1alpha2/backendtrafficpolicy.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + versioned "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" + internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" + v1alpha2 "sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2" +) + +// BackendTrafficPolicyInformer provides access to a shared informer and lister for +// BackendTrafficPolicies. +type BackendTrafficPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.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.GatewayV1alpha2().BackendTrafficPolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha2().BackendTrafficPolicies(namespace).Watch(context.TODO(), options) + }, + }, + &apisv1alpha2.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(&apisv1alpha2.BackendTrafficPolicy{}, f.defaultInformer) +} + +func (f *backendTrafficPolicyInformer) Lister() v1alpha2.BackendTrafficPolicyLister { + return v1alpha2.NewBackendTrafficPolicyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/apis/v1alpha2/interface.go b/pkg/client/informers/externalversions/apis/v1alpha2/interface.go index 8f21c3d8e6..cd253ab0ae 100644 --- a/pkg/client/informers/externalversions/apis/v1alpha2/interface.go +++ b/pkg/client/informers/externalversions/apis/v1alpha2/interface.go @@ -26,6 +26,8 @@ import ( type Interface interface { // BackendLBPolicies returns a BackendLBPolicyInformer. BackendLBPolicies() BackendLBPolicyInformer + // BackendTrafficPolicies returns a BackendTrafficPolicyInformer. + BackendTrafficPolicies() BackendTrafficPolicyInformer // GRPCRoutes returns a GRPCRouteInformer. GRPCRoutes() GRPCRouteInformer // ReferenceGrants returns a ReferenceGrantInformer. @@ -54,6 +56,11 @@ func (v *version) BackendLBPolicies() BackendLBPolicyInformer { return &backendLBPolicyInformer{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} +} + // GRPCRoutes returns a GRPCRouteInformer. func (v *version) GRPCRoutes() GRPCRouteInformer { return &gRPCRouteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 283d2475b2..88f2ce2ce3 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -68,6 +68,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=gateway.networking.k8s.io, Version=v1alpha2 case v1alpha2.SchemeGroupVersion.WithResource("backendlbpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().BackendLBPolicies().Informer()}, nil + case v1alpha2.SchemeGroupVersion.WithResource("backendtrafficpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().BackendTrafficPolicies().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("grpcroutes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().GRPCRoutes().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("referencegrants"): diff --git a/pkg/client/listers/apis/v1alpha2/backendtrafficpolicy.go b/pkg/client/listers/apis/v1alpha2/backendtrafficpolicy.go new file mode 100644 index 0000000000..5c79f7300b --- /dev/null +++ b/pkg/client/listers/apis/v1alpha2/backendtrafficpolicy.go @@ -0,0 +1,70 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" + v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" +) + +// 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 []*v1alpha2.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[*v1alpha2.BackendTrafficPolicy] +} + +// NewBackendTrafficPolicyLister returns a new BackendTrafficPolicyLister. +func NewBackendTrafficPolicyLister(indexer cache.Indexer) BackendTrafficPolicyLister { + return &backendTrafficPolicyLister{listers.New[*v1alpha2.BackendTrafficPolicy](indexer, v1alpha2.Resource("backendtrafficpolicy"))} +} + +// BackendTrafficPolicies returns an object that can list and get BackendTrafficPolicies. +func (s *backendTrafficPolicyLister) BackendTrafficPolicies(namespace string) BackendTrafficPolicyNamespaceLister { + return backendTrafficPolicyNamespaceLister{listers.NewNamespaced[*v1alpha2.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 []*v1alpha2.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) (*v1alpha2.BackendTrafficPolicy, error) + BackendTrafficPolicyNamespaceListerExpansion +} + +// backendTrafficPolicyNamespaceLister implements the BackendTrafficPolicyNamespaceLister +// interface. +type backendTrafficPolicyNamespaceLister struct { + listers.ResourceIndexer[*v1alpha2.BackendTrafficPolicy] +} diff --git a/pkg/client/listers/apis/v1alpha2/expansion_generated.go b/pkg/client/listers/apis/v1alpha2/expansion_generated.go index d311d49157..98516d30c3 100644 --- a/pkg/client/listers/apis/v1alpha2/expansion_generated.go +++ b/pkg/client/listers/apis/v1alpha2/expansion_generated.go @@ -26,6 +26,14 @@ type BackendLBPolicyListerExpansion interface{} // BackendLBPolicyNamespaceLister. type BackendLBPolicyNamespaceListerExpansion 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{} + // GRPCRouteListerExpansion allows custom methods to be added to // GRPCRouteLister. type GRPCRouteListerExpansion interface{} diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 568e51dbc1..2617bf58f4 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -150,8 +150,8 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendLBPolicyList": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendLBPolicyList(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendLBPolicySpec": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendLBPolicySpec(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicy": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicy(ref), + "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicyList": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicyList(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicySpec": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicySpec(ref), - "sigs.k8s.io/gateway-api/apis/v1alpha2.CommonRetryPolicy": schema_sigsk8sio_gateway_api_apis_v1alpha2_CommonRetryPolicy(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.GRPCRoute": schema_sigsk8sio_gateway_api_apis_v1alpha2_GRPCRoute(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.GRPCRouteList": schema_sigsk8sio_gateway_api_apis_v1alpha2_GRPCRouteList(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.LocalPolicyTargetReference": schema_sigsk8sio_gateway_api_apis_v1alpha2_LocalPolicyTargetReference(ref), @@ -162,6 +162,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "sigs.k8s.io/gateway-api/apis/v1alpha2.ReferenceGrant": schema_sigsk8sio_gateway_api_apis_v1alpha2_ReferenceGrant(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.ReferenceGrantList": schema_sigsk8sio_gateway_api_apis_v1alpha2_ReferenceGrantList(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate": schema_sigsk8sio_gateway_api_apis_v1alpha2_RequestRate(ref), + "sigs.k8s.io/gateway-api/apis/v1alpha2.RetryConstraint": schema_sigsk8sio_gateway_api_apis_v1alpha2_RetryConstraint(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.TCPRoute": schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRoute(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.TCPRouteList": schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRouteList(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.TCPRouteRule": schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRouteRule(ref), @@ -5824,7 +5825,8 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicy(ref common. return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, + Description: "BackendTrafficPolicy defines the configuration for how traffic to a target backend should be handled.", + Type: []string{"object"}, Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -5869,6 +5871,55 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicy(ref common. } } +func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicyList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BackendTrafficPolicyList contains a list of BackendTrafficPolicies", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicy"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicy"}, + } +} + func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -5901,8 +5952,8 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicySpec(ref com }, "retry": { SchemaProps: spec.SchemaProps{ - Description: "Retry defines the configuration for when to allow or prevent retries to a target backend.\n\nWhile the static number of retries performed by the client are configured within HTTPRoute Retry stanzas, configuring the CommonRetryPolicy allows you to constrain further retries after a dynamic budget for retries has been exceeded.\n\nSupport: Extended\n\n", - Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.CommonRetryPolicy"), + Description: "RetryConstraint defines the configuration for when to allow or prevent retries to a target backend.\n\nWhile the static number of retries performed by the client are configured within HTTPRoute Retry stanzas, configuring the RetryConstraint allows you to constrain further retries after a dynamic budget for retries has been exceeded.\n\nSupport: Extended\n\n", + Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.RetryConstraint"), }, }, "sessionPersistence": { @@ -5916,42 +5967,7 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicySpec(ref com }, }, Dependencies: []string{ - "sigs.k8s.io/gateway-api/apis/v1.SessionPersistence", "sigs.k8s.io/gateway-api/apis/v1alpha2.CommonRetryPolicy", "sigs.k8s.io/gateway-api/apis/v1alpha2.LocalPolicyTargetReference"}, - } -} - -func schema_sigsk8sio_gateway_api_apis_v1alpha2_CommonRetryPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "CommonRetryPolicy defines the configuration for when to retry a request.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "budgetPercent": { - SchemaProps: spec.SchemaProps{ - Description: "BudgetPercent defines the maximum percentage of active requests that may be made up of retries.\n\nSupport: Extended", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "budgetInterval": { - SchemaProps: spec.SchemaProps{ - Description: "BudgetInterval defines the duration in which requests will be considered for calculating the budget for retries.\n\nSupport: Extended", - Type: []string{"string"}, - Format: "", - }, - }, - "minRetryRate": { - SchemaProps: spec.SchemaProps{ - Description: "MinRetryRate defines the minimum rate of retries that will be allowable over a specified duration of time.\n\nThis ensures that requests can still be retried during periods of low traffic, where the budget for retries may be calculated as a very low value.\n\nSupport: Extended", - Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate"}, + "sigs.k8s.io/gateway-api/apis/v1.SessionPersistence", "sigs.k8s.io/gateway-api/apis/v1alpha2.LocalPolicyTargetReference", "sigs.k8s.io/gateway-api/apis/v1alpha2.RetryConstraint"}, } } @@ -6380,6 +6396,41 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_RequestRate(ref common.Reference } } +func schema_sigsk8sio_gateway_api_apis_v1alpha2_RetryConstraint(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RetryConstraint defines the configuration for when to retry a request.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "budgetPercent": { + SchemaProps: spec.SchemaProps{ + Description: "BudgetPercent defines the maximum percentage of active requests that may be made up of retries.\n\nSupport: Extended", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "budgetInterval": { + SchemaProps: spec.SchemaProps{ + Description: "BudgetInterval defines the duration in which requests will be considered for calculating the budget for retries.\n\nSupport: Extended", + Type: []string{"string"}, + Format: "", + }, + }, + "minRetryRate": { + SchemaProps: spec.SchemaProps{ + Description: "MinRetryRate defines the minimum rate of retries that will be allowable over a specified duration of time.\n\nThis ensures that requests can still be retried during periods of low traffic, where the budget for retries may be calculated as a very low value.\n\nSupport: Extended", + Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate"}, + } +} + func schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRoute(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ From 5f2b55b07cb279b96ff9ecba49ecb652c3359ffb Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Wed, 12 Feb 2025 11:52:55 -0500 Subject: [PATCH 10/14] Fleshing out the description for RetryConstraint --- apis/v1alpha2/backendtrafficpolicy_types.go | 35 ++++++++++++++----- pkg/generated/openapi/zz_generated.openapi.go | 5 +-- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/apis/v1alpha2/backendtrafficpolicy_types.go b/apis/v1alpha2/backendtrafficpolicy_types.go index c8674bdf99..4b0b3aca61 100644 --- a/apis/v1alpha2/backendtrafficpolicy_types.go +++ b/apis/v1alpha2/backendtrafficpolicy_types.go @@ -37,8 +37,6 @@ type BackendTrafficPolicy struct { // // +optional // - // - // Note: there is no Override or Default policy configuration. metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -58,11 +56,14 @@ type BackendTrafficPolicyList struct { Items []BackendTrafficPolicy `json:"items"` } +// BackendTrafficPolicySpec define the desired state of BackendTrafficPolicy +// Note: there is no Override or Default policy configuration. type BackendTrafficPolicySpec struct { // TargetRef identifies an API object to apply policy to. // Currently, Backends (i.e. Service, ServiceImport, or any // implementation-specific backendRef) are the only valid API // target references. + // // +listType=map // +listMapKey=group // +listMapKey=kind @@ -71,13 +72,31 @@ type BackendTrafficPolicySpec struct { // +kubebuilder:validation:MaxItems=16 TargetRefs []LocalPolicyTargetReference `json:"targetRefs"` - // RetryConstraint defines the configuration for when to allow or prevent retries to a - // target backend. + // RetryConstraint defines the configuration for when to allow or prevent + // further retries to a target backend by dynamically calculating a 'retry + // budget'. This budget is calculated based on the percentage of incoming + // traffic composed of retries over a given time interval. Once the budget + // is exceeded, additional retries will be rejected by the backend. + // + // For example, if the retry budget interval is 10 seconds, there have been + // 1000 active requests in the past 10 seconds, and the allowed percentage + // of requests that can be retried is 20% (the default), then 200 of those + // requests may be composed of retries. Active requests will only be + // considered for the duration of the interval when calculating the retry + // budget. + // + // Configuring a RetryConstraint in BackendTrafficPolicy is compatible with + // HTTPRoute Retry settings for each HTTPRouteRule that targets the same + // backend. While the HTTPRouteRule Retry stanza can specify whether a + // request should be retried and the number of retry attempts each client + // may perform, RetryConstraint helps prevent cascading failures, such as + // retry storms, during periods of consistent failures. + // + // After the retry budget has been exceeded, additional retries to the + // backend must return a 503 response to the client. // - // While the static number of retries performed by the client are - // configured within HTTPRoute Retry stanzas, configuring the - // RetryConstraint allows you to constrain further retries after a - // dynamic budget for retries has been exceeded. + // Additional configurations for defining a constraint on retries MAY be + // defined in the future. // // Support: Extended // diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 2617bf58f4..11a1e89248 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -5924,7 +5924,8 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicySpec(ref com return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, + Description: "BackendTrafficPolicySpec define the desired state of BackendTrafficPolicy Note: there is no Override or Default policy configuration.", + Type: []string{"object"}, Properties: map[string]spec.Schema{ "targetRefs": { VendorExtensible: spec.VendorExtensible{ @@ -5952,7 +5953,7 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicySpec(ref com }, "retry": { SchemaProps: spec.SchemaProps{ - Description: "RetryConstraint defines the configuration for when to allow or prevent retries to a target backend.\n\nWhile the static number of retries performed by the client are configured within HTTPRoute Retry stanzas, configuring the RetryConstraint allows you to constrain further retries after a dynamic budget for retries has been exceeded.\n\nSupport: Extended\n\n", + Description: "RetryConstraint defines the configuration for when to allow or prevent further retries to a target backend by dynamically calculating a 'retry budget'. This budget is calculated based on the percentage of incoming traffic composed of retries over a given time interval. Once the budget is exceeded, additional retries will be rejected by the backend.\n\nFor example, if the retry budget interval is 10 seconds, there have been 1000 active requests in the past 10 seconds, and the allowed percentage of requests that can be retried is 20% (the default), then 200 of those requests may be composed of retries. Active requests will only be considered for the duration of the interval when calculating the retry budget.\n\nConfiguring a RetryConstraint in BackendTrafficPolicy is compatible with HTTPRoute Retry settings for each HTTPRouteRule that targets the same backend. While the HTTPRouteRule Retry stanza can specify whether a request should be retried and the number of retry attempts each client may perform, RetryConstraint helps prevent cascading failures, such as retry storms, during periods of consistent failures.\n\nAfter the retry budget has been exceeded, additional retries to the backend must return a 503 response to the client.\n\nAdditional configurations for defining a constraint on retries MAY be defined in the future.\n\nSupport: Extended\n\n", Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.RetryConstraint"), }, }, From d6bcae54db0c79742bda95dd86c9c3e440db4683 Mon Sep 17 00:00:00 2001 From: Dave Protasowski Date: Mon, 3 Feb 2025 16:42:45 -0500 Subject: [PATCH 11/14] refactor codegen scripts to make it easier to generate two clients --- .../openapi/zz_generated.openapi.go | 0 cmd/modelschema/main.go | 4 +- hack/update-clientset.sh | 122 +++++++++++ hack/update-codegen.sh | 197 +----------------- hack/update-protos.sh | 94 +++++++++ pkg/client/clientset/versioned/clientset.go | 24 +-- .../versioned/fake/clientset_generated.go | 10 +- .../clientset/versioned/fake/register.go | 2 +- .../clientset/versioned/scheme/register.go | 2 +- 9 files changed, 239 insertions(+), 216 deletions(-) rename {pkg/generated => apis}/openapi/zz_generated.openapi.go (100%) create mode 100755 hack/update-clientset.sh create mode 100755 hack/update-protos.sh diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/apis/openapi/zz_generated.openapi.go similarity index 100% rename from pkg/generated/openapi/zz_generated.openapi.go rename to apis/openapi/zz_generated.openapi.go diff --git a/cmd/modelschema/main.go b/cmd/modelschema/main.go index 42713567e5..a04294ace5 100644 --- a/cmd/modelschema/main.go +++ b/cmd/modelschema/main.go @@ -24,7 +24,7 @@ import ( "os" "strings" - openapi "sigs.k8s.io/gateway-api/pkg/generated/openapi" + stable "sigs.k8s.io/gateway-api/apis/openapi" "k8s.io/kube-openapi/pkg/common" "k8s.io/kube-openapi/pkg/validation/spec" @@ -43,7 +43,7 @@ func output() error { refFunc := func(name string) spec.Ref { return spec.MustCreateRef(fmt.Sprintf("#/definitions/%s", friendlyName(name))) } - defs := openapi.GetOpenAPIDefinitions(refFunc) + defs := stable.GetOpenAPIDefinitions(refFunc) schemaDefs := make(map[string]spec.Schema, len(defs)) for k, v := range defs { // Replace top-level schema with v2 if a v2 schema is embedded diff --git a/hack/update-clientset.sh b/hack/update-clientset.sh new file mode 100755 index 0000000000..62894d4b5c --- /dev/null +++ b/hack/update-clientset.sh @@ -0,0 +1,122 @@ +#!/usr/bin/env bash + +# Copyright 2025 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o errexit +set -o nounset +set -o pipefail + + +if [[ "${1:-stable}" == "experimental" ]]; then + readonly API_PATH="apisx" +else + readonly API_PATH="apis" +fi + +readonly SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE}")"/.. && pwd)" + +if [[ "${VERIFY_CODEGEN:-}" == "true" ]]; then + echo "Running in verification mode" + readonly VERIFY_FLAG="--verify-only" +fi + +readonly COMMON_FLAGS="${VERIFY_FLAG:-} --go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.generatego.txt" + +readonly APIS_PKG=sigs.k8s.io/gateway-api +readonly CLIENTSET_NAME=versioned +readonly CLIENTSET_PKG_NAME=clientset +readonly VERSIONS=($(find ./${API_PATH} -maxdepth 1 -name "v*" -exec bash -c 'basename {}' \; | xargs)) + +if [[ "${1:-stable}" == "experimental" ]]; then + readonly OUTPUT_DIR=pkg/clientx + readonly OUTPUT_PKG=sigs.k8s.io/gateway-api/pkg/clientx +else + readonly OUTPUT_DIR=pkg/client + readonly OUTPUT_PKG=sigs.k8s.io/gateway-api/pkg/client +fi + +GATEWAY_INPUT_DIRS_SPACE="" +GATEWAY_INPUT_DIRS_COMMA="" +for VERSION in "${VERSIONS[@]}" +do + GATEWAY_INPUT_DIRS_SPACE+="${APIS_PKG}/${API_PATH}/${VERSION} " + GATEWAY_INPUT_DIRS_COMMA+="${APIS_PKG}/${API_PATH}/${VERSION}," +done +GATEWAY_INPUT_DIRS_SPACE="${GATEWAY_INPUT_DIRS_SPACE%,}" # drop trailing space +GATEWAY_INPUT_DIRS_COMMA="${GATEWAY_INPUT_DIRS_COMMA%,}" # drop trailing comma + +# throw away +new_report="$(mktemp -t "$(basename "$0").api_violations.XXXXXX")" + +echo "Generating openapi schema" +go run k8s.io/kube-openapi/cmd/openapi-gen \ + --output-file zz_generated.openapi.go \ + --report-filename "${new_report}" \ + --output-dir "${API_PATH}/openapi" \ + --output-pkg "sigs.k8s.io/gateway-api/${API_PATH}/openapi" \ + ${COMMON_FLAGS} \ + $GATEWAY_INPUT_DIRS_SPACE \ + k8s.io/apimachinery/pkg/apis/meta/v1 \ + k8s.io/apimachinery/pkg/runtime \ + k8s.io/apimachinery/pkg/version + + +echo "Generating apply configuration" +go run k8s.io/code-generator/cmd/applyconfiguration-gen \ + --openapi-schema <(go run ${SCRIPT_ROOT}/cmd/modelschema) \ + --output-dir "${API_PATH}/applyconfiguration" \ + --output-pkg "${APIS_PKG}/${API_PATH}/applyconfiguration" \ + ${COMMON_FLAGS} \ + ${GATEWAY_INPUT_DIRS_SPACE} + +echo "Generating clientset at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" +go run k8s.io/code-generator/cmd/client-gen \ + --clientset-name "${CLIENTSET_NAME}" \ + --input-base "${APIS_PKG}" \ + --input "${GATEWAY_INPUT_DIRS_COMMA//${APIS_PKG}/}" \ + --output-dir "${OUTPUT_DIR}/${CLIENTSET_PKG_NAME}" \ + --output-pkg "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" \ + --apply-configuration-package "${APIS_PKG}/${API_PATH}/applyconfiguration" \ + ${COMMON_FLAGS} + +echo "Generating listers at ${OUTPUT_PKG}/listers" +go run k8s.io/code-generator/cmd/lister-gen \ + --output-dir "${OUTPUT_DIR}/listers" \ + --output-pkg "${OUTPUT_PKG}/listers" \ + ${COMMON_FLAGS} \ + ${GATEWAY_INPUT_DIRS_SPACE} + +echo "Generating informers at ${OUTPUT_PKG}/informers" +go run k8s.io/code-generator/cmd/informer-gen \ + --versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}/${CLIENTSET_NAME}" \ + --listers-package "${OUTPUT_PKG}/listers" \ + --output-dir "${OUTPUT_DIR}/informers" \ + --output-pkg "${OUTPUT_PKG}/informers" \ + ${COMMON_FLAGS} \ + ${GATEWAY_INPUT_DIRS_SPACE} + +echo "Generating ${VERSION} register at ${APIS_PKG}/${API_PATH}/${VERSION}" +go run k8s.io/code-generator/cmd/register-gen \ + --output-file zz_generated.register.go \ + ${COMMON_FLAGS} \ + ${GATEWAY_INPUT_DIRS_SPACE} + +for VERSION in "${VERSIONS[@]}" +do + echo "Generating ${VERSION} deepcopy at ${APIS_PKG}/${API_PATH}/${VERSION}" + go run sigs.k8s.io/controller-tools/cmd/controller-gen \ + object:headerFile=${SCRIPT_ROOT}/hack/boilerplate/boilerplate.generatego.txt \ + paths="${APIS_PKG}/${API_PATH}/${VERSION}" +done \ No newline at end of file diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 2608fc2c4f..9aa562dd7c 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -46,202 +46,9 @@ export GOMODCACHE GO111MODULE GOFLAGS GOPATH mkdir -p "$GOPATH/src/sigs.k8s.io" ln -s "${SCRIPT_ROOT}" "$GOPATH/src/sigs.k8s.io/gateway-api" -readonly OUTPUT_PKG=sigs.k8s.io/gateway-api/pkg/client -readonly APIS_PKG=sigs.k8s.io/gateway-api -readonly CLIENTSET_NAME=versioned -readonly CLIENTSET_PKG_NAME=clientset -readonly VERSIONS=(v1alpha2 v1alpha3 v1beta1 v1) - -GATEWAY_INPUT_DIRS_SPACE="" -GATEWAY_INPUT_DIRS_COMMA="" -for VERSION in "${VERSIONS[@]}" -do - GATEWAY_INPUT_DIRS_SPACE+="${APIS_PKG}/apis/${VERSION} " - GATEWAY_INPUT_DIRS_COMMA+="${APIS_PKG}/apis/${VERSION}," -done -GATEWAY_INPUT_DIRS_SPACE="${GATEWAY_INPUT_DIRS_SPACE%,}" # drop trailing space -GATEWAY_INPUT_DIRS_COMMA="${GATEWAY_INPUT_DIRS_COMMA%,}" # drop trailing comma - - -if [[ "${VERIFY_CODEGEN:-}" == "true" ]]; then - echo "Running in verification mode" - readonly VERIFY_FLAG="--verify-only" -fi - -readonly COMMON_FLAGS="${VERIFY_FLAG:-} --go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.generatego.txt" - echo "Generating CRDs" go run ./pkg/generator -# throw away -new_report="$(mktemp -t "$(basename "$0").api_violations.XXXXXX")" - -echo "Generating openapi schema" -go run k8s.io/kube-openapi/cmd/openapi-gen \ - --output-file zz_generated.openapi.go \ - --report-filename "${new_report}" \ - --output-dir "pkg/generated/openapi" \ - --output-pkg "sigs.k8s.io/gateway-api/pkg/generated/openapi" \ - ${COMMON_FLAGS} \ - $GATEWAY_INPUT_DIRS_SPACE \ - k8s.io/apimachinery/pkg/apis/meta/v1 \ - k8s.io/apimachinery/pkg/runtime \ - k8s.io/apimachinery/pkg/version - - -echo "Generating apply configuration" -go run k8s.io/code-generator/cmd/applyconfiguration-gen \ - --openapi-schema <(go run ${SCRIPT_ROOT}/cmd/modelschema) \ - --output-dir "apis/applyconfiguration" \ - --output-pkg "${APIS_PKG}/apis/applyconfiguration" \ - ${COMMON_FLAGS} \ - ${GATEWAY_INPUT_DIRS_SPACE} - - -# Temporary hack until https://github.com/kubernetes/kubernetes/pull/124371 is released -function fix_applyconfiguration() { - local package="$1" - local version="$(basename $1)" - - echo $package - echo $version - pushd $package > /dev/null - - # Replace import - for filename in *.go; do - import_line=$(grep "$package" "$filename") - if [[ -z "$import_line" ]]; then - continue - fi - import_prefix=$(echo "$import_line" | awk '{print $1}') - sed -i'.bak' -e "s,${import_prefix} \"sigs.k8s.io/gateway-api/${package}\",,g" "$filename" - sed -i'.bak' -e "s,\[\]${import_prefix}\.,\[\],g" "$filename" - sed -i'.bak' -e "s,&${import_prefix}\.,&,g" "$filename" - sed -i'.bak' -e "s,*${import_prefix}\.,*,g" "$filename" - sed -i'.bak' -e "s,^\t${import_prefix}\.,,g" "$filename" - done - - rm *.bak - go fmt . - find . -type f -name "*.go" -exec sed -i'.bak' -e "s,import (),,g" {} \; - rm *.bak - go fmt . - - popd > /dev/null -} - -export -f fix_applyconfiguration -find apis/applyconfiguration/apis -name "v*" -type d -exec bash -c 'fix_applyconfiguration $0' {} \; - -echo "Generating clientset at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" -go run k8s.io/code-generator/cmd/client-gen \ - --clientset-name "${CLIENTSET_NAME}" \ - --input-base "${APIS_PKG}" \ - --input "${GATEWAY_INPUT_DIRS_COMMA//${APIS_PKG}/}" \ - --output-dir "pkg/client/${CLIENTSET_PKG_NAME}" \ - --output-pkg "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" \ - --apply-configuration-package "${APIS_PKG}/apis/applyconfiguration" \ - ${COMMON_FLAGS} - -echo "Generating listers at ${OUTPUT_PKG}/listers" -go run k8s.io/code-generator/cmd/lister-gen \ - --output-dir "pkg/client/listers" \ - --output-pkg "${OUTPUT_PKG}/listers" \ - ${COMMON_FLAGS} \ - ${GATEWAY_INPUT_DIRS_SPACE} - -echo "Generating informers at ${OUTPUT_PKG}/informers" -go run k8s.io/code-generator/cmd/informer-gen \ - --versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}/${CLIENTSET_NAME}" \ - --listers-package "${OUTPUT_PKG}/listers" \ - --output-dir "pkg/client/informers" \ - --output-pkg "${OUTPUT_PKG}/informers" \ - ${COMMON_FLAGS} \ - ${GATEWAY_INPUT_DIRS_SPACE} - -echo "Generating ${VERSION} register at ${APIS_PKG}/apis/${VERSION}" -go run k8s.io/code-generator/cmd/register-gen \ - --output-file zz_generated.register.go \ - ${COMMON_FLAGS} \ - ${GATEWAY_INPUT_DIRS_SPACE} - -for VERSION in "${VERSIONS[@]}" -do - echo "Generating ${VERSION} deepcopy at ${APIS_PKG}/apis/${VERSION}" - go run sigs.k8s.io/controller-tools/cmd/controller-gen \ - object:headerFile=${SCRIPT_ROOT}/hack/boilerplate/boilerplate.generatego.txt \ - paths="${APIS_PKG}/apis/${VERSION}" -done - -echo "Generating gRPC/Protobuf code" - -readonly PROTOC_CACHE_DIR="/tmp/protoc.cache" -readonly PROTOC_BINARY="${PROTOC_CACHE_DIR}/bin/protoc" -readonly PROTOC_VERSION="22.2" -readonly PROTOC_REPO="https://github.com/protocolbuffers/protobuf" - -readonly PROTOC_LINUX_X86_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip" -readonly PROTOC_LINUX_X86_CHECKSUM="4805ba56594556402a6c327a8d885a47640ee363 ${PROTOC_BINARY}" - -readonly PROTOC_LINUX_ARM64_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-aarch_64.zip" -readonly PROTOC_LINUX_ARM64_CHECKSUM="47285b2386f990da319e9eef92cadec2dfa28733 ${PROTOC_BINARY}" - -readonly PROTOC_MAC_UNIVERSAL_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-universal_binary.zip" -readonly PROTOC_MAC_UNIVERSAL_CHECKSUM="2a79d0eb235c808eca8de893762072b94dc6144c ${PROTOC_BINARY}" - -PROTOC_URL="" -PROTOC_CHECKSUM="" - -ARCH=$(uname -m) -OS=$(uname) - -if [[ "${OS}" != "Linux" ]] && [[ "${OS}" != "Darwin" ]]; then - echo "Unsupported operating system ${OS}" >/dev/stderr - exit 1 -fi - -if [[ "${OS}" == "Linux" ]]; then - if [[ "$ARCH" == "x86_64" ]]; then - PROTOC_URL="$PROTOC_LINUX_X86_URL" - PROTOC_CHECKSUM="$PROTOC_LINUX_X86_CHECKSUM" - elif [[ "$ARCH" == "arm64" ]]; then - PROTOC_URL="$PROTOC_LINUX_ARM64_URL" - PROTOC_CHECKSUM="$PROTOC_LINUX_ARM64_CHECKSUM" - elif [[ "$ARCH" == "aarch64" ]]; then - PROTOC_URL="$PROTOC_LINUX_ARM64_URL" - PROTOC_CHECKSUM="$PROTOC_LINUX_ARM64_CHECKSUM" - else - echo "Architecture ${ARCH} is not supported on OS ${OS}." >/dev/stderr - exit 1 - fi -elif [[ "${OS}" == "Darwin" ]]; then - PROTOC_URL="$PROTOC_MAC_UNIVERSAL_URL" - PROTOC_CHECKSUM="$PROTOC_MAC_UNIVERSAL_CHECKSUM" -fi - -function verify_protoc { - if ! echo "${PROTOC_CHECKSUM}" | shasum -c >/dev/null; then - echo "Downloaded protoc binary failed checksum." >/dev/stderr - exit 1 - fi -} - -function ensure_protoc { - mkdir -p "${PROTOC_CACHE_DIR}" - if [ ! -f "${PROTOC_BINARY}" ]; then - curl -sL -o "${PROTOC_CACHE_DIR}/protoc.zip" "${PROTOC_URL}" - unzip -d "${PROTOC_CACHE_DIR}" "${PROTOC_CACHE_DIR}/protoc.zip" - fi - verify_protoc -} - -ensure_protoc -go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 -go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 -(cd conformance/echo-basic && \ - export PATH="$PATH:$GOPATH/bin" && \ - "${PROTOC_BINARY}" --go_out=grpcechoserver --go_opt=paths=source_relative \ - --go-grpc_out=grpcechoserver --go-grpc_opt=paths=source_relative \ - grpcecho.proto -) +./hack/update-clientset.sh +./hack/update-protos.sh \ No newline at end of file diff --git a/hack/update-protos.sh b/hack/update-protos.sh new file mode 100755 index 0000000000..92e888d3e5 --- /dev/null +++ b/hack/update-protos.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +# Copyright 2025 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o errexit +set -o nounset +set -o pipefail + +readonly SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE}")"/.. && pwd)" + +echo "Generating gRPC/Protobuf code" + +readonly PROTOC_CACHE_DIR="/tmp/protoc.cache" +readonly PROTOC_BINARY="${PROTOC_CACHE_DIR}/bin/protoc" +readonly PROTOC_VERSION="22.2" +readonly PROTOC_REPO="https://github.com/protocolbuffers/protobuf" + +readonly PROTOC_LINUX_X86_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip" +readonly PROTOC_LINUX_X86_CHECKSUM="4805ba56594556402a6c327a8d885a47640ee363 ${PROTOC_BINARY}" + +readonly PROTOC_LINUX_ARM64_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-aarch_64.zip" +readonly PROTOC_LINUX_ARM64_CHECKSUM="47285b2386f990da319e9eef92cadec2dfa28733 ${PROTOC_BINARY}" + +readonly PROTOC_MAC_UNIVERSAL_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-universal_binary.zip" +readonly PROTOC_MAC_UNIVERSAL_CHECKSUM="2a79d0eb235c808eca8de893762072b94dc6144c ${PROTOC_BINARY}" + +PROTOC_URL="" +PROTOC_CHECKSUM="" + +ARCH=$(uname -m) +OS=$(uname) + +if [[ "${OS}" != "Linux" ]] && [[ "${OS}" != "Darwin" ]]; then + echo "Unsupported operating system ${OS}" >/dev/stderr + exit 1 +fi + +if [[ "${OS}" == "Linux" ]]; then + if [[ "$ARCH" == "x86_64" ]]; then + PROTOC_URL="$PROTOC_LINUX_X86_URL" + PROTOC_CHECKSUM="$PROTOC_LINUX_X86_CHECKSUM" + elif [[ "$ARCH" == "arm64" ]]; then + PROTOC_URL="$PROTOC_LINUX_ARM64_URL" + PROTOC_CHECKSUM="$PROTOC_LINUX_ARM64_CHECKSUM" + elif [[ "$ARCH" == "aarch64" ]]; then + PROTOC_URL="$PROTOC_LINUX_ARM64_URL" + PROTOC_CHECKSUM="$PROTOC_LINUX_ARM64_CHECKSUM" + else + echo "Architecture ${ARCH} is not supported on OS ${OS}." >/dev/stderr + exit 1 + fi +elif [[ "${OS}" == "Darwin" ]]; then + PROTOC_URL="$PROTOC_MAC_UNIVERSAL_URL" + PROTOC_CHECKSUM="$PROTOC_MAC_UNIVERSAL_CHECKSUM" +fi + +function verify_protoc { + if ! echo "${PROTOC_CHECKSUM}" | shasum -c >/dev/null; then + echo "Downloaded protoc binary failed checksum." >/dev/stderr + exit 1 + fi +} + +function ensure_protoc { + mkdir -p "${PROTOC_CACHE_DIR}" + if [ ! -f "${PROTOC_BINARY}" ]; then + curl -sL -o "${PROTOC_CACHE_DIR}/protoc.zip" "${PROTOC_URL}" + unzip -d "${PROTOC_CACHE_DIR}" "${PROTOC_CACHE_DIR}/protoc.zip" + fi + verify_protoc +} + +ensure_protoc +go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 + +(cd conformance/echo-basic && \ + export PATH="$PATH:$GOPATH/bin" && \ + "${PROTOC_BINARY}" --go_out=grpcechoserver --go_opt=paths=source_relative \ + --go-grpc_out=grpcechoserver --go-grpc_opt=paths=source_relative \ + grpcecho.proto +) \ No newline at end of file diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 116d5cca8a..ef9ef2376f 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -33,19 +33,24 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface + GatewayV1() gatewayv1.GatewayV1Interface GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface GatewayV1alpha3() gatewayv1alpha3.GatewayV1alpha3Interface GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface - GatewayV1() gatewayv1.GatewayV1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient + gatewayV1 *gatewayv1.GatewayV1Client gatewayV1alpha2 *gatewayv1alpha2.GatewayV1alpha2Client gatewayV1alpha3 *gatewayv1alpha3.GatewayV1alpha3Client gatewayV1beta1 *gatewayv1beta1.GatewayV1beta1Client - gatewayV1 *gatewayv1.GatewayV1Client +} + +// GatewayV1 retrieves the GatewayV1Client +func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { + return c.gatewayV1 } // GatewayV1alpha2 retrieves the GatewayV1alpha2Client @@ -63,11 +68,6 @@ func (c *Clientset) GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface { return c.gatewayV1beta1 } -// GatewayV1 retrieves the GatewayV1Client -func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { - return c.gatewayV1 -} - // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -112,19 +112,19 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error - cs.gatewayV1alpha2, err = gatewayv1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.gatewayV1, err = gatewayv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } - cs.gatewayV1alpha3, err = gatewayv1alpha3.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.gatewayV1alpha2, err = gatewayv1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } - cs.gatewayV1beta1, err = gatewayv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.gatewayV1alpha3, err = gatewayv1alpha3.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } - cs.gatewayV1, err = gatewayv1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.gatewayV1beta1, err = gatewayv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -149,10 +149,10 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset + cs.gatewayV1 = gatewayv1.New(c) cs.gatewayV1alpha2 = gatewayv1alpha2.New(c) cs.gatewayV1alpha3 = gatewayv1alpha3.New(c) cs.gatewayV1beta1 = gatewayv1beta1.New(c) - cs.gatewayV1 = gatewayv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 7d165c93ba..7cc8169913 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -122,6 +122,11 @@ var ( _ testing.FakeClient = &Clientset{} ) +// GatewayV1 retrieves the GatewayV1Client +func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { + return &fakegatewayv1.FakeGatewayV1{Fake: &c.Fake} +} + // GatewayV1alpha2 retrieves the GatewayV1alpha2Client func (c *Clientset) GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface { return &fakegatewayv1alpha2.FakeGatewayV1alpha2{Fake: &c.Fake} @@ -136,8 +141,3 @@ func (c *Clientset) GatewayV1alpha3() gatewayv1alpha3.GatewayV1alpha3Interface { func (c *Clientset) GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface { return &fakegatewayv1beta1.FakeGatewayV1beta1{Fake: &c.Fake} } - -// GatewayV1 retrieves the GatewayV1Client -func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { - return &fakegatewayv1.FakeGatewayV1{Fake: &c.Fake} -} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 502a6efc6e..70e71314d6 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -34,10 +34,10 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + gatewayv1.AddToScheme, gatewayv1alpha2.AddToScheme, gatewayv1alpha3.AddToScheme, gatewayv1beta1.AddToScheme, - gatewayv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index c6eca7a83a..715fcc4caa 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -34,10 +34,10 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + gatewayv1.AddToScheme, gatewayv1alpha2.AddToScheme, gatewayv1alpha3.AddToScheme, gatewayv1beta1.AddToScheme, - gatewayv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition From 6f04b8b04b26fcd3e451336c257af2dc292e8154 Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Thu, 13 Feb 2025 08:55:17 -0500 Subject: [PATCH 12/14] Attempting to match the experimental API structure that dprotaso made in #3588 --- apis/applyconfiguration/internal/internal.go | 61 - apis/applyconfiguration/utils.go | 8 - apis/openapi/zz_generated.openapi.go | 218 -- apis/v1alpha2/shared_types.go | 15 - apis/v1alpha2/zz_generated.deepcopy.go | 144 - apis/v1alpha2/zz_generated.register.go | 2 - .../apisx/v1alpha2/backendtrafficpolicy.go | 265 ++ .../v1alpha2/backendtrafficpolicyspec.go | 64 + .../apisx/v1alpha2/requestrate.go | 52 + .../apisx/v1alpha2/retryconstraint.go | 61 + apisx/applyconfiguration/internal/internal.go | 72 + apisx/applyconfiguration/utils.go | 50 + apisx/doc.go | 14 + apisx/openapi/zz_generated.openapi.go | 2893 +++++++++++++++++ .../v1alpha2/backendtrafficpolicy.go | 0 apisx/v1alpha2/doc.go | 20 + apisx/v1alpha2/shared_types.go | 46 + apisx/v1alpha2/zz_generated.deepcopy.go | 171 + apisx/v1alpha2/zz_generated.register.go | 70 + cmd/modelschema/main.go | 4 + .../typed/apis/v1alpha2/apis_client.go | 5 - .../apis/v1alpha2/fake/fake_apis_client.go | 4 - .../apis/v1alpha2/generated_expansion.go | 2 - .../apis/v1alpha2/interface.go | 7 - .../informers/externalversions/generic.go | 2 - .../apis/v1alpha2/expansion_generated.go | 8 - pkg/clientx/clientset/versioned/clientset.go | 120 + .../versioned/fake/clientset_generated.go | 122 + pkg/clientx/clientset/versioned/fake/doc.go | 20 + .../clientset/versioned/fake/register.go | 56 + pkg/clientx/clientset/versioned/scheme/doc.go | 20 + .../clientset/versioned/scheme/register.go | 56 + .../typed/apisx/v1alpha2/apisx_client.go | 107 + .../apisx/v1alpha2/backendtrafficpolicy.go | 73 + .../versioned/typed/apisx/v1alpha2/doc.go | 20 + .../typed/apisx/v1alpha2/fake/doc.go | 20 + .../apisx/v1alpha2/fake/fake_apisx_client.go | 40 + .../fake/fake_backendtrafficpolicy.go | 197 ++ .../apisx/v1alpha2/generated_expansion.go | 21 + .../externalversions/apisx/interface.go | 46 + .../apisx/v1alpha2/backendtrafficpolicy.go | 90 + .../apisx/v1alpha2/interface.go | 45 + .../informers/externalversions/factory.go | 262 ++ .../informers/externalversions/generic.go | 62 + .../internalinterfaces/factory_interfaces.go | 40 + .../apisx/v1alpha2/backendtrafficpolicy.go | 70 + .../apisx/v1alpha2/expansion_generated.go | 27 + 47 files changed, 5296 insertions(+), 476 deletions(-) create mode 100644 apisx/applyconfiguration/apisx/v1alpha2/backendtrafficpolicy.go create mode 100644 apisx/applyconfiguration/apisx/v1alpha2/backendtrafficpolicyspec.go create mode 100644 apisx/applyconfiguration/apisx/v1alpha2/requestrate.go create mode 100644 apisx/applyconfiguration/apisx/v1alpha2/retryconstraint.go create mode 100644 apisx/applyconfiguration/internal/internal.go create mode 100644 apisx/applyconfiguration/utils.go create mode 100644 apisx/doc.go create mode 100644 apisx/openapi/zz_generated.openapi.go rename apis/v1alpha2/backendtrafficpolicy_types.go => apisx/v1alpha2/backendtrafficpolicy.go (100%) create mode 100644 apisx/v1alpha2/doc.go create mode 100644 apisx/v1alpha2/shared_types.go create mode 100644 apisx/v1alpha2/zz_generated.deepcopy.go create mode 100644 apisx/v1alpha2/zz_generated.register.go create mode 100644 pkg/clientx/clientset/versioned/clientset.go create mode 100644 pkg/clientx/clientset/versioned/fake/clientset_generated.go create mode 100644 pkg/clientx/clientset/versioned/fake/doc.go create mode 100644 pkg/clientx/clientset/versioned/fake/register.go create mode 100644 pkg/clientx/clientset/versioned/scheme/doc.go create mode 100644 pkg/clientx/clientset/versioned/scheme/register.go create mode 100644 pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/apisx_client.go create mode 100644 pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/backendtrafficpolicy.go create mode 100644 pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/doc.go create mode 100644 pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/doc.go create mode 100644 pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/fake_apisx_client.go create mode 100644 pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/fake_backendtrafficpolicy.go create mode 100644 pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/generated_expansion.go create mode 100644 pkg/clientx/informers/externalversions/apisx/interface.go create mode 100644 pkg/clientx/informers/externalversions/apisx/v1alpha2/backendtrafficpolicy.go create mode 100644 pkg/clientx/informers/externalversions/apisx/v1alpha2/interface.go create mode 100644 pkg/clientx/informers/externalversions/factory.go create mode 100644 pkg/clientx/informers/externalversions/generic.go create mode 100644 pkg/clientx/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 pkg/clientx/listers/apisx/v1alpha2/backendtrafficpolicy.go create mode 100644 pkg/clientx/listers/apisx/v1alpha2/expansion_generated.go diff --git a/apis/applyconfiguration/internal/internal.go b/apis/applyconfiguration/internal/internal.go index 0f03327f8e..07a0df71dd 100644 --- a/apis/applyconfiguration/internal/internal.go +++ b/apis/applyconfiguration/internal/internal.go @@ -1219,46 +1219,6 @@ var schemaYAML = typed.YAMLObject(`types: - group - kind - name -- name: io.k8s.sigs.gateway-api.apis.v1alpha2.BackendTrafficPolicy - map: - fields: - - name: apiVersion - type: - scalar: string - - name: kind - type: - scalar: string - - name: metadata - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta - default: {} - - name: spec - type: - namedType: io.k8s.sigs.gateway-api.apis.v1alpha2.BackendTrafficPolicySpec - default: {} - - name: status - type: - namedType: io.k8s.sigs.gateway-api.apis.v1alpha2.PolicyStatus - default: {} -- name: io.k8s.sigs.gateway-api.apis.v1alpha2.BackendTrafficPolicySpec - map: - fields: - - name: retry - type: - namedType: io.k8s.sigs.gateway-api.apis.v1alpha2.RetryConstraint - - name: sessionPersistence - type: - namedType: io.k8s.sigs.gateway-api.apis.v1.SessionPersistence - - name: targetRefs - type: - list: - elementType: - namedType: io.k8s.sigs.gateway-api.apis.v1alpha2.LocalPolicyTargetReference - elementRelationship: associative - keys: - - group - - kind - - name - name: io.k8s.sigs.gateway-api.apis.v1alpha2.GRPCRoute map: fields: @@ -1358,27 +1318,6 @@ var schemaYAML = typed.YAMLObject(`types: type: namedType: io.k8s.sigs.gateway-api.apis.v1beta1.ReferenceGrantSpec default: {} -- name: io.k8s.sigs.gateway-api.apis.v1alpha2.RequestRate - map: - fields: - - name: count - type: - scalar: numeric - - name: interval - type: - scalar: string -- name: io.k8s.sigs.gateway-api.apis.v1alpha2.RetryConstraint - map: - fields: - - name: budgetInterval - type: - scalar: string - - name: budgetPercent - type: - scalar: numeric - - name: minRetryRate - type: - namedType: io.k8s.sigs.gateway-api.apis.v1alpha2.RequestRate - name: io.k8s.sigs.gateway-api.apis.v1alpha2.TCPRoute map: fields: diff --git a/apis/applyconfiguration/utils.go b/apis/applyconfiguration/utils.go index c66eabcb80..debd0d9f68 100644 --- a/apis/applyconfiguration/utils.go +++ b/apis/applyconfiguration/utils.go @@ -162,10 +162,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &apisv1alpha2.BackendLBPolicyApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("BackendLBPolicySpec"): return &apisv1alpha2.BackendLBPolicySpecApplyConfiguration{} - case v1alpha2.SchemeGroupVersion.WithKind("BackendTrafficPolicy"): - return &apisv1alpha2.BackendTrafficPolicyApplyConfiguration{} - case v1alpha2.SchemeGroupVersion.WithKind("BackendTrafficPolicySpec"): - return &apisv1alpha2.BackendTrafficPolicySpecApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("GRPCRoute"): return &apisv1alpha2.GRPCRouteApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("LocalPolicyTargetReference"): @@ -178,10 +174,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &apisv1alpha2.PolicyStatusApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("ReferenceGrant"): return &apisv1alpha2.ReferenceGrantApplyConfiguration{} - case v1alpha2.SchemeGroupVersion.WithKind("RequestRate"): - return &apisv1alpha2.RequestRateApplyConfiguration{} - case v1alpha2.SchemeGroupVersion.WithKind("RetryConstraint"): - return &apisv1alpha2.RetryConstraintApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("TCPRoute"): return &apisv1alpha2.TCPRouteApplyConfiguration{} case v1alpha2.SchemeGroupVersion.WithKind("TCPRouteRule"): diff --git a/apis/openapi/zz_generated.openapi.go b/apis/openapi/zz_generated.openapi.go index 11a1e89248..811e47ee48 100644 --- a/apis/openapi/zz_generated.openapi.go +++ b/apis/openapi/zz_generated.openapi.go @@ -149,9 +149,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendLBPolicy": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendLBPolicy(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendLBPolicyList": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendLBPolicyList(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendLBPolicySpec": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendLBPolicySpec(ref), - "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicy": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicy(ref), - "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicyList": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicyList(ref), - "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicySpec": schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicySpec(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.GRPCRoute": schema_sigsk8sio_gateway_api_apis_v1alpha2_GRPCRoute(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.GRPCRouteList": schema_sigsk8sio_gateway_api_apis_v1alpha2_GRPCRouteList(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.LocalPolicyTargetReference": schema_sigsk8sio_gateway_api_apis_v1alpha2_LocalPolicyTargetReference(ref), @@ -161,8 +158,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "sigs.k8s.io/gateway-api/apis/v1alpha2.PolicyStatus": schema_sigsk8sio_gateway_api_apis_v1alpha2_PolicyStatus(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.ReferenceGrant": schema_sigsk8sio_gateway_api_apis_v1alpha2_ReferenceGrant(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.ReferenceGrantList": schema_sigsk8sio_gateway_api_apis_v1alpha2_ReferenceGrantList(ref), - "sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate": schema_sigsk8sio_gateway_api_apis_v1alpha2_RequestRate(ref), - "sigs.k8s.io/gateway-api/apis/v1alpha2.RetryConstraint": schema_sigsk8sio_gateway_api_apis_v1alpha2_RetryConstraint(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.TCPRoute": schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRoute(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.TCPRouteList": schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRouteList(ref), "sigs.k8s.io/gateway-api/apis/v1alpha2.TCPRouteRule": schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRouteRule(ref), @@ -5821,157 +5816,6 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendLBPolicySpec(ref common.R } } -func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "BackendTrafficPolicy defines the configuration for how traffic to a target backend should be handled.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Description: "Spec defines the desired state of BackendTrafficPolicy.", - Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicySpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Description: "Status defines the current state of BackendTrafficPolicy.", - Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.PolicyStatus"), - }, - }, - }, - Required: []string{"spec"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicySpec", "sigs.k8s.io/gateway-api/apis/v1alpha2.PolicyStatus"}, - } -} - -func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicyList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "BackendTrafficPolicyList contains a list of BackendTrafficPolicies", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicy"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "sigs.k8s.io/gateway-api/apis/v1alpha2.BackendTrafficPolicy"}, - } -} - -func schema_sigsk8sio_gateway_api_apis_v1alpha2_BackendTrafficPolicySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "BackendTrafficPolicySpec define the desired state of BackendTrafficPolicy Note: there is no Override or Default policy configuration.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "targetRefs": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-list-map-keys": []interface{}{ - "group", - "kind", - "name", - }, - "x-kubernetes-list-type": "map", - }, - }, - SchemaProps: spec.SchemaProps{ - Description: "TargetRef identifies an API object to apply policy to. Currently, Backends (i.e. Service, ServiceImport, or any implementation-specific backendRef) are the only valid API target references.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.LocalPolicyTargetReference"), - }, - }, - }, - }, - }, - "retry": { - SchemaProps: spec.SchemaProps{ - Description: "RetryConstraint defines the configuration for when to allow or prevent further retries to a target backend by dynamically calculating a 'retry budget'. This budget is calculated based on the percentage of incoming traffic composed of retries over a given time interval. Once the budget is exceeded, additional retries will be rejected by the backend.\n\nFor example, if the retry budget interval is 10 seconds, there have been 1000 active requests in the past 10 seconds, and the allowed percentage of requests that can be retried is 20% (the default), then 200 of those requests may be composed of retries. Active requests will only be considered for the duration of the interval when calculating the retry budget.\n\nConfiguring a RetryConstraint in BackendTrafficPolicy is compatible with HTTPRoute Retry settings for each HTTPRouteRule that targets the same backend. While the HTTPRouteRule Retry stanza can specify whether a request should be retried and the number of retry attempts each client may perform, RetryConstraint helps prevent cascading failures, such as retry storms, during periods of consistent failures.\n\nAfter the retry budget has been exceeded, additional retries to the backend must return a 503 response to the client.\n\nAdditional configurations for defining a constraint on retries MAY be defined in the future.\n\nSupport: Extended\n\n", - Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.RetryConstraint"), - }, - }, - "sessionPersistence": { - SchemaProps: spec.SchemaProps{ - Description: "SessionPersistence defines and configures session persistence for the backend.\n\nSupport: Extended", - Ref: ref("sigs.k8s.io/gateway-api/apis/v1.SessionPersistence"), - }, - }, - }, - Required: []string{"targetRefs"}, - }, - }, - Dependencies: []string{ - "sigs.k8s.io/gateway-api/apis/v1.SessionPersistence", "sigs.k8s.io/gateway-api/apis/v1alpha2.LocalPolicyTargetReference", "sigs.k8s.io/gateway-api/apis/v1alpha2.RetryConstraint"}, - } -} - func schema_sigsk8sio_gateway_api_apis_v1alpha2_GRPCRoute(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -6370,68 +6214,6 @@ func schema_sigsk8sio_gateway_api_apis_v1alpha2_ReferenceGrantList(ref common.Re } } -func schema_sigsk8sio_gateway_api_apis_v1alpha2_RequestRate(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RequestRate expresses a rate of requests over a given period of time.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "count": { - SchemaProps: spec.SchemaProps{ - Description: "Count specifies the number of requests per time interval.\n\nSupport: Extended", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "interval": { - SchemaProps: spec.SchemaProps{ - Description: "Interval specifies the divisor of the rate of requests, the amount of time during which the given count of requests occur.\n\nSupport: Extended", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_sigsk8sio_gateway_api_apis_v1alpha2_RetryConstraint(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RetryConstraint defines the configuration for when to retry a request.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "budgetPercent": { - SchemaProps: spec.SchemaProps{ - Description: "BudgetPercent defines the maximum percentage of active requests that may be made up of retries.\n\nSupport: Extended", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "budgetInterval": { - SchemaProps: spec.SchemaProps{ - Description: "BudgetInterval defines the duration in which requests will be considered for calculating the budget for retries.\n\nSupport: Extended", - Type: []string{"string"}, - Format: "", - }, - }, - "minRetryRate": { - SchemaProps: spec.SchemaProps{ - Description: "MinRetryRate defines the minimum rate of retries that will be allowable over a specified duration of time.\n\nThis ensures that requests can still be retried during periods of low traffic, where the budget for retries may be calculated as a very low value.\n\nSupport: Extended", - Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "sigs.k8s.io/gateway-api/apis/v1alpha2.RequestRate"}, - } -} - func schema_sigsk8sio_gateway_api_apis_v1alpha2_TCPRoute(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/v1alpha2/shared_types.go b/apis/v1alpha2/shared_types.go index 8a40d602f4..2fb84d5f3b 100644 --- a/apis/v1alpha2/shared_types.go +++ b/apis/v1alpha2/shared_types.go @@ -389,18 +389,3 @@ const ( // SessionPersistence. // +k8s:deepcopy-gen=false type SessionPersistence = v1.SessionPersistence - -// RequestRate expresses a rate of requests over a given period of time. -type RequestRate struct { - // Count specifies the number of requests per time interval. - // - // Support: Extended - // +kubebuilder:validation:Minimum=0 - Count *int `json:"count,omitempty"` - - // Interval specifies the divisor of the rate of requests, the amount of - // time during which the given count of requests occur. - // - // Support: Extended - Interval *Duration `json:"interval,omitempty"` -} diff --git a/apis/v1alpha2/zz_generated.deepcopy.go b/apis/v1alpha2/zz_generated.deepcopy.go index e864499ddd..5306ca135d 100644 --- a/apis/v1alpha2/zz_generated.deepcopy.go +++ b/apis/v1alpha2/zz_generated.deepcopy.go @@ -110,95 +110,6 @@ func (in *BackendLBPolicySpec) DeepCopy() *BackendLBPolicySpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendTrafficPolicy) DeepCopyInto(out *BackendTrafficPolicy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTrafficPolicy. -func (in *BackendTrafficPolicy) DeepCopy() *BackendTrafficPolicy { - if in == nil { - return nil - } - out := new(BackendTrafficPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *BackendTrafficPolicy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendTrafficPolicyList) DeepCopyInto(out *BackendTrafficPolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]BackendTrafficPolicy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTrafficPolicyList. -func (in *BackendTrafficPolicyList) DeepCopy() *BackendTrafficPolicyList { - if in == nil { - return nil - } - out := new(BackendTrafficPolicyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *BackendTrafficPolicyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendTrafficPolicySpec) DeepCopyInto(out *BackendTrafficPolicySpec) { - *out = *in - if in.TargetRefs != nil { - in, out := &in.TargetRefs, &out.TargetRefs - *out = make([]LocalPolicyTargetReference, len(*in)) - copy(*out, *in) - } - if in.RetryConstraint != nil { - in, out := &in.RetryConstraint, &out.RetryConstraint - *out = new(RetryConstraint) - (*in).DeepCopyInto(*out) - } - if in.SessionPersistence != nil { - in, out := &in.SessionPersistence, &out.SessionPersistence - *out = new(v1.SessionPersistence) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTrafficPolicySpec. -func (in *BackendTrafficPolicySpec) DeepCopy() *BackendTrafficPolicySpec { - if in == nil { - return nil - } - out := new(BackendTrafficPolicySpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GRPCRoute) DeepCopyInto(out *GRPCRoute) { *out = *in @@ -417,61 +328,6 @@ func (in *ReferenceGrantList) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RequestRate) DeepCopyInto(out *RequestRate) { - *out = *in - if in.Count != nil { - in, out := &in.Count, &out.Count - *out = new(int) - **out = **in - } - if in.Interval != nil { - in, out := &in.Interval, &out.Interval - *out = new(v1.Duration) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequestRate. -func (in *RequestRate) DeepCopy() *RequestRate { - if in == nil { - return nil - } - out := new(RequestRate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RetryConstraint) DeepCopyInto(out *RetryConstraint) { - *out = *in - if in.BudgetPercent != nil { - in, out := &in.BudgetPercent, &out.BudgetPercent - *out = new(int) - **out = **in - } - if in.BudgetInterval != nil { - in, out := &in.BudgetInterval, &out.BudgetInterval - *out = new(v1.Duration) - **out = **in - } - if in.MinRetryRate != nil { - in, out := &in.MinRetryRate, &out.MinRetryRate - *out = new(RequestRate) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetryConstraint. -func (in *RetryConstraint) DeepCopy() *RetryConstraint { - if in == nil { - return nil - } - out := new(RetryConstraint) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TCPRoute) DeepCopyInto(out *TCPRoute) { *out = *in diff --git a/apis/v1alpha2/zz_generated.register.go b/apis/v1alpha2/zz_generated.register.go index 52495a7675..bb133e5dc1 100644 --- a/apis/v1alpha2/zz_generated.register.go +++ b/apis/v1alpha2/zz_generated.register.go @@ -63,8 +63,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &BackendLBPolicy{}, &BackendLBPolicyList{}, - &BackendTrafficPolicy{}, - &BackendTrafficPolicyList{}, &GRPCRoute{}, &GRPCRouteList{}, &ReferenceGrant{}, diff --git a/apisx/applyconfiguration/apisx/v1alpha2/backendtrafficpolicy.go b/apisx/applyconfiguration/apisx/v1alpha2/backendtrafficpolicy.go new file mode 100644 index 0000000000..a81c838094 --- /dev/null +++ b/apisx/applyconfiguration/apisx/v1alpha2/backendtrafficpolicy.go @@ -0,0 +1,265 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + internal "sigs.k8s.io/gateway-api/apisx/applyconfiguration/internal" + apisxv1alpha2 "sigs.k8s.io/gateway-api/apisx/v1alpha2" +) + +// BackendTrafficPolicyApplyConfiguration represents a declarative configuration of the BackendTrafficPolicy type for use +// with apply. +type BackendTrafficPolicyApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *BackendTrafficPolicySpecApplyConfiguration `json:"spec,omitempty"` + Status *apisv1alpha2.PolicyStatus `json:"status,omitempty"` +} + +// BackendTrafficPolicy constructs a declarative configuration of the BackendTrafficPolicy type for use with +// apply. +func BackendTrafficPolicy(name, namespace string) *BackendTrafficPolicyApplyConfiguration { + b := &BackendTrafficPolicyApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("BackendTrafficPolicy") + b.WithAPIVersion("gateway.networking.k8s-x.io/v1alpha2") + return b +} + +// ExtractBackendTrafficPolicy extracts the applied configuration owned by fieldManager from +// backendTrafficPolicy. If no managedFields are found in backendTrafficPolicy for fieldManager, a +// BackendTrafficPolicyApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// backendTrafficPolicy must be a unmodified BackendTrafficPolicy API object that was retrieved from the Kubernetes API. +// ExtractBackendTrafficPolicy provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractBackendTrafficPolicy(backendTrafficPolicy *apisxv1alpha2.BackendTrafficPolicy, fieldManager string) (*BackendTrafficPolicyApplyConfiguration, error) { + return extractBackendTrafficPolicy(backendTrafficPolicy, fieldManager, "") +} + +// ExtractBackendTrafficPolicyStatus is the same as ExtractBackendTrafficPolicy except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractBackendTrafficPolicyStatus(backendTrafficPolicy *apisxv1alpha2.BackendTrafficPolicy, fieldManager string) (*BackendTrafficPolicyApplyConfiguration, error) { + return extractBackendTrafficPolicy(backendTrafficPolicy, fieldManager, "status") +} + +func extractBackendTrafficPolicy(backendTrafficPolicy *apisxv1alpha2.BackendTrafficPolicy, fieldManager string, subresource string) (*BackendTrafficPolicyApplyConfiguration, error) { + b := &BackendTrafficPolicyApplyConfiguration{} + err := managedfields.ExtractInto(backendTrafficPolicy, internal.Parser().Type("io.k8s.sigs.gateway-api.apisx.v1alpha2.BackendTrafficPolicy"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(backendTrafficPolicy.Name) + b.WithNamespace(backendTrafficPolicy.Namespace) + + b.WithKind("BackendTrafficPolicy") + b.WithAPIVersion("gateway.networking.k8s-x.io/v1alpha2") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithKind(value string) *BackendTrafficPolicyApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithAPIVersion(value string) *BackendTrafficPolicyApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithName(value string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithGenerateName(value string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithNamespace(value string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithUID(value types.UID) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithResourceVersion(value string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithGeneration(value int64) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithCreationTimestamp(value metav1.Time) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *BackendTrafficPolicyApplyConfiguration) WithLabels(entries map[string]string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *BackendTrafficPolicyApplyConfiguration) WithAnnotations(entries map[string]string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *BackendTrafficPolicyApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *BackendTrafficPolicyApplyConfiguration) WithFinalizers(values ...string) *BackendTrafficPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *BackendTrafficPolicyApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithSpec(value *BackendTrafficPolicySpecApplyConfiguration) *BackendTrafficPolicyApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *BackendTrafficPolicyApplyConfiguration) WithStatus(value apisv1alpha2.PolicyStatus) *BackendTrafficPolicyApplyConfiguration { + b.Status = &value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *BackendTrafficPolicyApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/apisx/applyconfiguration/apisx/v1alpha2/backendtrafficpolicyspec.go b/apisx/applyconfiguration/apisx/v1alpha2/backendtrafficpolicyspec.go new file mode 100644 index 0000000000..e073f35c01 --- /dev/null +++ b/apisx/applyconfiguration/apisx/v1alpha2/backendtrafficpolicyspec.go @@ -0,0 +1,64 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1 "sigs.k8s.io/gateway-api/apis/v1" + v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" +) + +// BackendTrafficPolicySpecApplyConfiguration represents a declarative configuration of the BackendTrafficPolicySpec type for use +// with apply. +type BackendTrafficPolicySpecApplyConfiguration struct { + TargetRefs []v1alpha2.LocalPolicyTargetReference `json:"targetRefs,omitempty"` + RetryConstraint *RetryConstraintApplyConfiguration `json:"retry,omitempty"` + SessionPersistence *v1.SessionPersistence `json:"sessionPersistence,omitempty"` +} + +// BackendTrafficPolicySpecApplyConfiguration constructs a declarative configuration of the BackendTrafficPolicySpec type for use with +// apply. +func BackendTrafficPolicySpec() *BackendTrafficPolicySpecApplyConfiguration { + return &BackendTrafficPolicySpecApplyConfiguration{} +} + +// WithTargetRefs adds the given value to the TargetRefs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the TargetRefs field. +func (b *BackendTrafficPolicySpecApplyConfiguration) WithTargetRefs(values ...v1alpha2.LocalPolicyTargetReference) *BackendTrafficPolicySpecApplyConfiguration { + for i := range values { + b.TargetRefs = append(b.TargetRefs, values[i]) + } + return b +} + +// WithRetryConstraint sets the RetryConstraint field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RetryConstraint field is set to the value of the last call. +func (b *BackendTrafficPolicySpecApplyConfiguration) WithRetryConstraint(value *RetryConstraintApplyConfiguration) *BackendTrafficPolicySpecApplyConfiguration { + b.RetryConstraint = value + return b +} + +// WithSessionPersistence sets the SessionPersistence field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SessionPersistence field is set to the value of the last call. +func (b *BackendTrafficPolicySpecApplyConfiguration) WithSessionPersistence(value v1.SessionPersistence) *BackendTrafficPolicySpecApplyConfiguration { + b.SessionPersistence = &value + return b +} diff --git a/apisx/applyconfiguration/apisx/v1alpha2/requestrate.go b/apisx/applyconfiguration/apisx/v1alpha2/requestrate.go new file mode 100644 index 0000000000..e71fcd534a --- /dev/null +++ b/apisx/applyconfiguration/apisx/v1alpha2/requestrate.go @@ -0,0 +1,52 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// RequestRateApplyConfiguration represents a declarative configuration of the RequestRate type for use +// with apply. +type RequestRateApplyConfiguration struct { + Count *int `json:"count,omitempty"` + Interval *v1.Duration `json:"interval,omitempty"` +} + +// RequestRateApplyConfiguration constructs a declarative configuration of the RequestRate type for use with +// apply. +func RequestRate() *RequestRateApplyConfiguration { + return &RequestRateApplyConfiguration{} +} + +// WithCount sets the Count field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Count field is set to the value of the last call. +func (b *RequestRateApplyConfiguration) WithCount(value int) *RequestRateApplyConfiguration { + b.Count = &value + return b +} + +// WithInterval sets the Interval field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Interval field is set to the value of the last call. +func (b *RequestRateApplyConfiguration) WithInterval(value v1.Duration) *RequestRateApplyConfiguration { + b.Interval = &value + return b +} diff --git a/apisx/applyconfiguration/apisx/v1alpha2/retryconstraint.go b/apisx/applyconfiguration/apisx/v1alpha2/retryconstraint.go new file mode 100644 index 0000000000..36f0068138 --- /dev/null +++ b/apisx/applyconfiguration/apisx/v1alpha2/retryconstraint.go @@ -0,0 +1,61 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// RetryConstraintApplyConfiguration represents a declarative configuration of the RetryConstraint type for use +// with apply. +type RetryConstraintApplyConfiguration struct { + BudgetPercent *int `json:"budgetPercent,omitempty"` + BudgetInterval *v1.Duration `json:"budgetInterval,omitempty"` + MinRetryRate *RequestRateApplyConfiguration `json:"minRetryRate,omitempty"` +} + +// RetryConstraintApplyConfiguration constructs a declarative configuration of the RetryConstraint type for use with +// apply. +func RetryConstraint() *RetryConstraintApplyConfiguration { + return &RetryConstraintApplyConfiguration{} +} + +// WithBudgetPercent sets the BudgetPercent field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BudgetPercent field is set to the value of the last call. +func (b *RetryConstraintApplyConfiguration) WithBudgetPercent(value int) *RetryConstraintApplyConfiguration { + b.BudgetPercent = &value + return b +} + +// WithBudgetInterval sets the BudgetInterval field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BudgetInterval field is set to the value of the last call. +func (b *RetryConstraintApplyConfiguration) WithBudgetInterval(value v1.Duration) *RetryConstraintApplyConfiguration { + b.BudgetInterval = &value + return b +} + +// WithMinRetryRate sets the MinRetryRate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinRetryRate field is set to the value of the last call. +func (b *RetryConstraintApplyConfiguration) WithMinRetryRate(value *RequestRateApplyConfiguration) *RetryConstraintApplyConfiguration { + b.MinRetryRate = value + return b +} diff --git a/apisx/applyconfiguration/internal/internal.go b/apisx/applyconfiguration/internal/internal.go new file mode 100644 index 0000000000..926627c38a --- /dev/null +++ b/apisx/applyconfiguration/internal/internal.go @@ -0,0 +1,72 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package internal + +import ( + "fmt" + "sync" + + typed "sigs.k8s.io/structured-merge-diff/v4/typed" +) + +func Parser() *typed.Parser { + parserOnce.Do(func() { + var err error + parser, err = typed.NewParser(schemaYAML) + if err != nil { + panic(fmt.Sprintf("Failed to parse schema: %v", err)) + } + }) + return parser +} + +var parserOnce sync.Once +var parser *typed.Parser +var schemaYAML = typed.YAMLObject(`types: +- name: io.k8s.sigs.gateway-api.apisx.v1alpha2.BackendTrafficPolicy + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: __untyped_atomic_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic +- name: __untyped_deduced_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +`) diff --git a/apisx/applyconfiguration/utils.go b/apisx/applyconfiguration/utils.go new file mode 100644 index 0000000000..145c90d36a --- /dev/null +++ b/apisx/applyconfiguration/utils.go @@ -0,0 +1,50 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package applyconfiguration + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" + apisxv1alpha2 "sigs.k8s.io/gateway-api/apisx/applyconfiguration/apisx/v1alpha2" + internal "sigs.k8s.io/gateway-api/apisx/applyconfiguration/internal" + v1alpha2 "sigs.k8s.io/gateway-api/apisx/v1alpha2" +) + +// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no +// apply configuration type exists for the given GroupVersionKind. +func ForKind(kind schema.GroupVersionKind) interface{} { + switch kind { + // Group=gateway.networking.k8s-x.io, Version=v1alpha2 + case v1alpha2.SchemeGroupVersion.WithKind("BackendTrafficPolicy"): + return &apisxv1alpha2.BackendTrafficPolicyApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("BackendTrafficPolicySpec"): + return &apisxv1alpha2.BackendTrafficPolicySpecApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("RequestRate"): + return &apisxv1alpha2.RequestRateApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("RetryConstraint"): + return &apisxv1alpha2.RetryConstraintApplyConfiguration{} + + } + return nil +} + +func NewTypeConverter(scheme *runtime.Scheme) *testing.TypeConverter { + return &testing.TypeConverter{Scheme: scheme, TypeResolver: internal.Parser()} +} diff --git a/apisx/doc.go b/apisx/doc.go new file mode 100644 index 0000000000..1c7f4a234c --- /dev/null +++ b/apisx/doc.go @@ -0,0 +1,14 @@ +/* +Copyright 2025 The Kubernetes Authors. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apix diff --git a/apisx/openapi/zz_generated.openapi.go b/apisx/openapi/zz_generated.openapi.go new file mode 100644 index 0000000000..4059e14b64 --- /dev/null +++ b/apisx/openapi/zz_generated.openapi.go @@ -0,0 +1,2893 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by openapi-gen. DO NOT EDIT. + +package openapi + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + common "k8s.io/kube-openapi/pkg/common" + spec "k8s.io/kube-openapi/pkg/validation/spec" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), + "k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref), + "k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), + "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), + "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + "sigs.k8s.io/gateway-api/apisx/v1alpha2.BackendTrafficPolicy": schema_sigsk8sio_gateway_api_apisx_v1alpha2_BackendTrafficPolicy(ref), + "sigs.k8s.io/gateway-api/apisx/v1alpha2.BackendTrafficPolicyList": schema_sigsk8sio_gateway_api_apisx_v1alpha2_BackendTrafficPolicyList(ref), + "sigs.k8s.io/gateway-api/apisx/v1alpha2.BackendTrafficPolicySpec": schema_sigsk8sio_gateway_api_apisx_v1alpha2_BackendTrafficPolicySpec(ref), + "sigs.k8s.io/gateway-api/apisx/v1alpha2.RequestRate": schema_sigsk8sio_gateway_api_apisx_v1alpha2_RequestRate(ref), + "sigs.k8s.io/gateway-api/apisx/v1alpha2.RetryConstraint": schema_sigsk8sio_gateway_api_apisx_v1alpha2_RetryConstraint(ref), + } +} + +func schema_pkg_apis_meta_v1_APIGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIGroup contains the name, the supported versions, and the preferred version of a group.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the name of the group.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "versions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "versions are the versions supported in this group.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), + }, + }, + }, + }, + }, + "preferredVersion": { + SchemaProps: spec.SchemaProps{ + Description: "preferredVersion is the version preferred by the API server, which probably is the storage version.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), + }, + }, + "serverAddressByClientCIDRs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), + }, + }, + }, + }, + }, + }, + Required: []string{"name", "versions"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery", "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, + } +} + +func schema_pkg_apis_meta_v1_APIGroupList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIGroupList is a list of APIGroup, to allow clients to discover the API at /apis.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "groups": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "groups is a list of APIGroup.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"), + }, + }, + }, + }, + }, + }, + Required: []string{"groups"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"}, + } +} + +func schema_pkg_apis_meta_v1_APIResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIResource specifies the name of a resource and whether it is namespaced.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the plural name of the resource.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "singularName": { + SchemaProps: spec.SchemaProps{ + Description: "singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "namespaced": { + SchemaProps: spec.SchemaProps{ + Description: "namespaced indicates if a resource is namespaced or not.", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "group": { + SchemaProps: spec.SchemaProps{ + Description: "group is the preferred group of the resource. Empty implies the group of the containing resource list. For subresources, this may have a different value, for example: Scale\".", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "version is the preferred version of the resource. Empty implies the version of the containing resource list For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)\".", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "verbs": { + SchemaProps: spec.SchemaProps{ + Description: "verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy)", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "shortNames": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "shortNames is a list of suggested short names of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "categories": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "categories is a list of the grouped resources this resource belongs to (e.g. 'all')", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "storageVersionHash": { + SchemaProps: spec.SchemaProps{ + Description: "The hash value of the storage version, the version this resource is converted to when written to the data store. Value must be treated as opaque by clients. Only equality comparison on the value is valid. This is an alpha feature and may change or be removed in the future. The field is populated by the apiserver only if the StorageVersionHash feature gate is enabled. This field will remain optional even if it graduates.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "singularName", "namespaced", "kind", "verbs"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_APIResourceList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "groupVersion": { + SchemaProps: spec.SchemaProps{ + Description: "groupVersion is the group and version this APIResourceList is for.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "resources": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "resources contains the name of the resources and if they are namespaced.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"), + }, + }, + }, + }, + }, + }, + Required: []string{"groupVersion", "resources"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"}, + } +} + +func schema_pkg_apis_meta_v1_APIVersions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIVersions lists the versions that are available, to allow clients to discover the API at /api, which is the root path of the legacy v1 API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "versions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "versions are the api versions that are available.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "serverAddressByClientCIDRs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), + }, + }, + }, + }, + }, + }, + Required: []string{"versions", "serverAddressByClientCIDRs"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, + } +} + +func schema_pkg_apis_meta_v1_ApplyOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ApplyOptions may be provided when applying an API object. FieldManager is required for apply requests. ApplyOptions is equivalent to PatchOptions. It is provided as a convenience with documentation that speaks specifically to how the options fields relate to apply.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "force": { + SchemaProps: spec.SchemaProps{ + Description: "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people.", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"force", "fieldManager"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Condition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Condition contains details for one aspect of the current state of this API Resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type of condition in CamelCase or in foo.example.com/CamelCase.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "status of the condition, one of True, False, Unknown.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "observedGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Description: "lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "message is a human readable message indicating details about the transition. This may be an empty string.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1_CreateOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CreateOptions may be provided when creating an API object.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_DeleteOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DeleteOptions may be provided when deleting an API object.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "gracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "preconditions": { + SchemaProps: spec.SchemaProps{ + Description: "Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"), + }, + }, + "orphanDependents": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "propagationPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"}, + } +} + +func schema_pkg_apis_meta_v1_Duration(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Duration is a wrapper around time.Duration which supports correct marshaling to YAML and JSON. In particular, it marshals into strings, which can be used as map keys in json.", + Type: v1.Duration{}.OpenAPISchemaType(), + Format: v1.Duration{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FieldSelectorRequirement is a selector that contains values, a key, and an operator that relates the key and values.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "key is the field selector key that the requirement applies to.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. The list of operators may grow in the future.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"key", "operator"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_FieldsV1(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.\n\nEach key is either a '.' representing the field itself, and will always map to an empty set, or a string representing a sub-field or item. The string will follow one of these four formats: 'f:', where is the name of a field in a struct, or key in a map 'v:', where is the exact json formatted value of a list item 'i:', where is position of a item in a list 'k:', where is a map of a list item's key fields to their unique values If a key maps to an empty Fields value, the field that key represents is part of the set.\n\nThe exact format is defined in sigs.k8s.io/structured-merge-diff", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GetOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GetOptions is the standard query options to the standard REST get call.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupKind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "kind"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "resource"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersion(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersion contains the \"group\" and the \"version\", which uniquely identifies the API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensibility.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "groupVersion": { + SchemaProps: spec.SchemaProps{ + Description: "groupVersion specifies the API group and version in the form \"group/version\"", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"groupVersion", "version"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionKind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version", "kind"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version", "resource"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_InternalEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "InternalEvent makes watch.Event versioned", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "Type": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "Object": { + SchemaProps: spec.SchemaProps{ + Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Bookmark: the object (instance of a type being watched) where\n only ResourceVersion field is set. On successful restart of watch from a\n bookmark resourceVersion, client is guaranteed to not get repeat event\n nor miss any events.\n * If Type is Error: *api.Status is recommended; other types may make sense\n depending on context.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.Object"), + }, + }, + }, + Required: []string{"Type", "Object"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.Object"}, + } +} + +func schema_pkg_apis_meta_v1_LabelSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "matchLabels": { + SchemaProps: spec.SchemaProps{ + Description: "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "matchExpressions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "matchExpressions is a list of label selector requirements. The requirements are ANDed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"), + }, + }, + }, + }, + }, + }, + }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-map-type": "atomic", + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"}, + } +} + +func schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "key is the label key that the selector applies to.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"key", "operator"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_List(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "List holds a list of objects, which may not be known by the server.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of objects", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_pkg_apis_meta_v1_ListMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "selfLink": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", + Type: []string{"string"}, + Format: "", + }, + }, + "continue": { + SchemaProps: spec.SchemaProps{ + Description: "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.", + Type: []string{"string"}, + Format: "", + }, + }, + "remainingItemCount": { + SchemaProps: spec.SchemaProps{ + Description: "remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ListOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ListOptions is the query options to a standard REST list call.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "labelSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A selector to restrict the list of returned objects by their labels. Defaults to everything.", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A selector to restrict the list of returned objects by their fields. Defaults to everything.", + Type: []string{"string"}, + Format: "", + }, + }, + "watch": { + SchemaProps: spec.SchemaProps{ + Description: "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "allowWatchBookmarks": { + SchemaProps: spec.SchemaProps{ + Description: "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersionMatch": { + SchemaProps: spec.SchemaProps{ + Description: "resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", + Type: []string{"string"}, + Format: "", + }, + }, + "timeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "limit": { + SchemaProps: spec.SchemaProps{ + Description: "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "continue": { + SchemaProps: spec.SchemaProps{ + Description: "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.", + Type: []string{"string"}, + Format: "", + }, + }, + "sendInitialEvents": { + SchemaProps: spec.SchemaProps{ + Description: "`sendInitialEvents=true` may be set together with `watch=true`. In that case, the watch stream will begin with synthetic events to produce the current state of objects in the collection. Once all such events have been sent, a synthetic \"Bookmark\" event will be sent. The bookmark will report the ResourceVersion (RV) corresponding to the set of objects, and be marked with `\"k8s.io/initial-events-end\": \"true\"` annotation. Afterwards, the watch stream will proceed as usual, sending watch events corresponding to changes (subsequent to the RV) to objects watched.\n\nWhen `sendInitialEvents` option is set, we require `resourceVersionMatch` option to also be set. The semantic of the watch request is as following: - `resourceVersionMatch` = NotOlderThan\n is interpreted as \"data at least as new as the provided `resourceVersion`\"\n and the bookmark event is send when the state is synced\n to a `resourceVersion` at least as fresh as the one provided by the ListOptions.\n If `resourceVersion` is unset, this is interpreted as \"consistent read\" and the\n bookmark event is send when the state is synced at least to the moment\n when request started being processed.\n- `resourceVersionMatch` set to any other value or unset\n Invalid error is returned.\n\nDefaults to true if `resourceVersion=\"\"` or `resourceVersion=\"0\"` (for backward compatibility reasons) and to false otherwise.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the fieldset applies to.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "manager": { + SchemaProps: spec.SchemaProps{ + Description: "Manager is an identifier of the workflow managing these fields.", + Type: []string{"string"}, + Format: "", + }, + }, + "operation": { + SchemaProps: spec.SchemaProps{ + Description: "Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'.", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the version of this resource that this field set applies to. The format is \"group/version\" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted.", + Type: []string{"string"}, + Format: "", + }, + }, + "time": { + SchemaProps: spec.SchemaProps{ + Description: "Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "fieldsType": { + SchemaProps: spec.SchemaProps{ + Description: "FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: \"FieldsV1\"", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldsV1": { + SchemaProps: spec.SchemaProps{ + Description: "FieldsV1 holds the first JSON version format as described in the \"FieldsV1\" type.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1"), + }, + }, + "subresource": { + SchemaProps: spec.SchemaProps{ + Description: "Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1_MicroTime(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MicroTime is version of Time with microsecond level precision.", + Type: v1.MicroTime{}.OpenAPISchemaType(), + Format: v1.MicroTime{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names", + Type: []string{"string"}, + Format: "", + }, + }, + "generateName": { + SchemaProps: spec.SchemaProps{ + Description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will return a 409.\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces", + Type: []string{"string"}, + Format: "", + }, + }, + "selfLink": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", + Type: []string{"string"}, + Format: "", + }, + }, + "generation": { + SchemaProps: spec.SchemaProps{ + Description: "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "creationTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "deletionTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "deletionGracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "annotations": { + SchemaProps: spec.SchemaProps{ + Description: "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "ownerReferences": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "uid", + }, + "x-kubernetes-list-type": "map", + "x-kubernetes-patch-merge-key": "uid", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference"), + }, + }, + }, + }, + }, + "finalizers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "set", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "managedFields": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1_OwnerReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "API version of the referent.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "controller": { + SchemaProps: spec.SchemaProps{ + Description: "If true, this reference points to the managing controller.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "blockOwnerDeletion": { + SchemaProps: spec.SchemaProps{ + Description: "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"apiVersion", "kind", "name", "uid"}, + }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-map-type": "atomic", + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_PartialObjectMetadata(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients to get access to a particular ObjectMeta schema without knowing the details of the version.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PartialObjectMetadataList contains a list of objects containing only their metadata", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "items contains each of the included items.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata"}, + } +} + +func schema_pkg_apis_meta_v1_Patch(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_PatchOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PatchOptions may be provided when patching an API object. PatchOptions is meant to be a superset of UpdateOptions.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "force": { + SchemaProps: spec.SchemaProps{ + Description: "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Preconditions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the target UID.", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the target ResourceVersion", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_RootPaths(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RootPaths lists the paths available at root. For example: \"/healthz\", \"/apis\".", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "paths": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "paths are the paths available at root.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"paths"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "clientCIDR": { + SchemaProps: spec.SchemaProps{ + Description: "The CIDR with which clients can match their IP to figure out the server address that they should use.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "serverAddress": { + SchemaProps: spec.SchemaProps{ + Description: "Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"clientCIDR", "serverAddress"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Status is a return value for calls that don't return other objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of this operation.", + Type: []string{"string"}, + Format: "", + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.", + Type: []string{"string"}, + Format: "", + }, + }, + "details": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"), + }, + }, + "code": { + SchemaProps: spec.SchemaProps{ + Description: "Suggested HTTP return code for this status, 0 if not set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"}, + } +} + +func schema_pkg_apis_meta_v1_StatusCause(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "A machine-readable description of the cause of the error. If this value is empty there is no information available.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the cause of the error. This field may be presented as-is to a reader.", + Type: []string{"string"}, + Format: "", + }, + }, + "field": { + SchemaProps: spec.SchemaProps{ + Description: "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_StatusDetails(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).", + Type: []string{"string"}, + Format: "", + }, + }, + "group": { + SchemaProps: spec.SchemaProps{ + Description: "The group attribute of the resource associated with the status StatusReason.", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "causes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"), + }, + }, + }, + }, + }, + "retryAfterSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"}, + } +} + +func schema_pkg_apis_meta_v1_Table(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Table is a tabular representation of a set of API resources. The server transforms the object into a set of preferred columns for quickly reviewing the objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "columnDefinitions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "columnDefinitions describes each column in the returned items array. The number of cells per row will always match the number of column definitions.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition"), + }, + }, + }, + }, + }, + "rows": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "rows is the list of items in the table.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableRow"), + }, + }, + }, + }, + }, + }, + Required: []string{"columnDefinitions", "rows"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition", "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow"}, + } +} + +func schema_pkg_apis_meta_v1_TableColumnDefinition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableColumnDefinition contains information about a column returned in the Table.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is a human readable name for the column.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type is an OpenAPI type definition for this column, such as number, integer, string, or array. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "format": { + SchemaProps: spec.SchemaProps{ + Description: "format is an optional OpenAPI type modifier for this column. A format modifies the type and imposes additional rules, like date or time formatting for a string. The 'name' format is applied to the primary identifier column which has type 'string' to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "description": { + SchemaProps: spec.SchemaProps{ + Description: "description is a human readable description of this column.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "priority": { + SchemaProps: spec.SchemaProps{ + Description: "priority is an integer defining the relative importance of this column compared to others. Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a higher priority.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"name", "type", "format", "description", "priority"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_TableOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableOptions are used when a Table is requested by the caller.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "includeObject": { + SchemaProps: spec.SchemaProps{ + Description: "includeObject decides whether to include each object along with its columnar information. Specifying \"None\" will return no object, specifying \"Object\" will return the full object contents, and specifying \"Metadata\" (the default) will return the object's metadata in the PartialObjectMetadata kind in version v1beta1 of the meta.k8s.io API group.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_TableRow(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableRow is an individual row in a table.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "cells": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "cells will be as wide as the column definitions array and may contain strings, numbers (float64 or int64), booleans, simple maps, lists, or null. See the type field of the column definition for a more detailed description.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Format: "", + }, + }, + }, + }, + }, + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "conditions describe additional status of a row that are relevant for a human user. These conditions apply to the row, not to the object, and will be specific to table output. The only defined condition type is 'Completed', for a row that indicates a resource that has run to completion and can be given less visual priority.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition"), + }, + }, + }, + }, + }, + "object": { + SchemaProps: spec.SchemaProps{ + Description: "This field contains the requested additional information about each object based on the includeObject policy when requesting the Table. If \"None\", this field is empty, if \"Object\" this will be the default serialization of the object for the current API version, and if \"Metadata\" (the default) will contain the object metadata. Check the returned kind and apiVersion of the object before parsing. The media type of the object will always match the enclosing list - if this as a JSON table, these will be JSON encoded objects.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"cells"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_pkg_apis_meta_v1_TableRowCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableRowCondition allows a row to be marked with additional information.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of row condition. The only defined value is 'Completed' indicating that the object this row represents has reached a completed state and may be given less visual priority than other rows. Clients are not required to honor any conditions but should be consistent where possible about handling the conditions.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the condition, one of True, False, Unknown.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "(brief) machine readable reason for the condition's last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Human readable message indicating details about last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Time(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.", + Type: v1.Time{}.OpenAPISchemaType(), + Format: v1.Time{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Timestamp(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Timestamp is a struct that is equivalent to Time, but intended for protobuf marshalling/unmarshalling. It is generated into a serialization that matches Time. Do not use in Go structs.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "seconds": { + SchemaProps: spec.SchemaProps{ + Description: "Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.", + Default: 0, + Type: []string{"integer"}, + Format: "int64", + }, + }, + "nanos": { + SchemaProps: spec.SchemaProps{ + Description: "Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. This field may be limited in precision depending on context.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"seconds", "nanos"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_TypeMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TypeMeta describes an individual object in an API response or request with strings representing the type of the object and its API schema version. Structures that are versioned or persisted should inline TypeMeta.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_UpdateOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "UpdateOptions may be provided when updating an API object. All fields in UpdateOptions should also be present in PatchOptions.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_WatchEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Event represents a single event to a watched resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "object": { + SchemaProps: spec.SchemaProps{ + Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Error: *Status is recommended; other types may make sense\n depending on context.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"type", "object"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RawExtension is used to hold extensions in external versions.\n\nTo use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.\n\n// Internal package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.Object `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// External package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.RawExtension `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// On the wire, the JSON will look something like this:\n\n\t{\n\t\t\"kind\":\"MyAPIObject\",\n\t\t\"apiVersion\":\"v1\",\n\t\t\"myPlugin\": {\n\t\t\t\"kind\":\"PluginA\",\n\t\t\t\"aOption\":\"foo\",\n\t\t},\n\t}\n\nSo what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)", + Type: []string{"object"}, + }, + }, + } +} + +func schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type, like this:\n\n\ttype MyAwesomeAPIObject struct {\n\t runtime.TypeMeta `json:\",inline\"`\n\t ... // other fields\n\t}\n\nfunc (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind\n\nTypeMeta is provided here for convenience. You may use it directly from this package or define your own with the same fields.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Unknown allows api objects with unknown types to be passed-through. This can be used to deal with the API objects from a plug-in. Unknown objects still have functioning TypeMeta features-- kind, version, etc. metadata and field mutatation.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "ContentEncoding": { + SchemaProps: spec.SchemaProps{ + Description: "ContentEncoding is encoding used to encode 'Raw' data. Unspecified means no encoding.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "ContentType": { + SchemaProps: spec.SchemaProps{ + Description: "ContentType is serialization method used to serialize 'Raw'. Unspecified means ContentTypeJSON.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"ContentEncoding", "ContentType"}, + }, + }, + } +} + +func schema_k8sio_apimachinery_pkg_version_Info(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Info contains versioning information. how we'll want to distribute that information.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "major": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "minor": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitVersion": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitCommit": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitTreeState": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "buildDate": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "goVersion": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "compiler": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "platform": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"major", "minor", "gitVersion", "gitCommit", "gitTreeState", "buildDate", "goVersion", "compiler", "platform"}, + }, + }, + } +} + +func schema_sigsk8sio_gateway_api_apisx_v1alpha2_BackendTrafficPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BackendTrafficPolicy defines the configuration for how traffic to a target backend should be handled.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec defines the desired state of BackendTrafficPolicy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/gateway-api/apisx/v1alpha2.BackendTrafficPolicySpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status defines the current state of BackendTrafficPolicy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.PolicyStatus"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "sigs.k8s.io/gateway-api/apis/v1alpha2.PolicyStatus", "sigs.k8s.io/gateway-api/apisx/v1alpha2.BackendTrafficPolicySpec"}, + } +} + +func schema_sigsk8sio_gateway_api_apisx_v1alpha2_BackendTrafficPolicyList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BackendTrafficPolicyList contains a list of BackendTrafficPolicies", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/gateway-api/apisx/v1alpha2.BackendTrafficPolicy"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "sigs.k8s.io/gateway-api/apisx/v1alpha2.BackendTrafficPolicy"}, + } +} + +func schema_sigsk8sio_gateway_api_apisx_v1alpha2_BackendTrafficPolicySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BackendTrafficPolicySpec define the desired state of BackendTrafficPolicy Note: there is no Override or Default policy configuration.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "targetRefs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "group", + "kind", + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "TargetRef identifies an API object to apply policy to. Currently, Backends (i.e. Service, ServiceImport, or any implementation-specific backendRef) are the only valid API target references.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/gateway-api/apis/v1alpha2.LocalPolicyTargetReference"), + }, + }, + }, + }, + }, + "retry": { + SchemaProps: spec.SchemaProps{ + Description: "RetryConstraint defines the configuration for when to allow or prevent further retries to a target backend by dynamically calculating a 'retry budget'. This budget is calculated based on the percentage of incoming traffic composed of retries over a given time interval. Once the budget is exceeded, additional retries will be rejected by the backend.\n\nFor example, if the retry budget interval is 10 seconds, there have been 1000 active requests in the past 10 seconds, and the allowed percentage of requests that can be retried is 20% (the default), then 200 of those requests may be composed of retries. Active requests will only be considered for the duration of the interval when calculating the retry budget.\n\nConfiguring a RetryConstraint in BackendTrafficPolicy is compatible with HTTPRoute Retry settings for each HTTPRouteRule that targets the same backend. While the HTTPRouteRule Retry stanza can specify whether a request should be retried and the number of retry attempts each client may perform, RetryConstraint helps prevent cascading failures, such as retry storms, during periods of consistent failures.\n\nAfter the retry budget has been exceeded, additional retries to the backend must return a 503 response to the client.\n\nAdditional configurations for defining a constraint on retries MAY be defined in the future.\n\nSupport: Extended\n\n", + Ref: ref("sigs.k8s.io/gateway-api/apisx/v1alpha2.RetryConstraint"), + }, + }, + "sessionPersistence": { + SchemaProps: spec.SchemaProps{ + Description: "SessionPersistence defines and configures session persistence for the backend.\n\nSupport: Extended", + Ref: ref("sigs.k8s.io/gateway-api/apis/v1.SessionPersistence"), + }, + }, + }, + Required: []string{"targetRefs"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/gateway-api/apis/v1.SessionPersistence", "sigs.k8s.io/gateway-api/apis/v1alpha2.LocalPolicyTargetReference", "sigs.k8s.io/gateway-api/apisx/v1alpha2.RetryConstraint"}, + } +} + +func schema_sigsk8sio_gateway_api_apisx_v1alpha2_RequestRate(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RequestRate expresses a rate of requests over a given period of time.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "count": { + SchemaProps: spec.SchemaProps{ + Description: "Count specifies the number of requests per time interval.\n\nSupport: Extended", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "interval": { + SchemaProps: spec.SchemaProps{ + Description: "Interval specifies the divisor of the rate of requests, the amount of time during which the given count of requests occur.\n\nSupport: Extended", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_sigsk8sio_gateway_api_apisx_v1alpha2_RetryConstraint(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RetryConstraint defines the configuration for when to retry a request.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "budgetPercent": { + SchemaProps: spec.SchemaProps{ + Description: "BudgetPercent defines the maximum percentage of active requests that may be made up of retries.\n\nSupport: Extended", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "budgetInterval": { + SchemaProps: spec.SchemaProps{ + Description: "BudgetInterval defines the duration in which requests will be considered for calculating the budget for retries.\n\nSupport: Extended", + Type: []string{"string"}, + Format: "", + }, + }, + "minRetryRate": { + SchemaProps: spec.SchemaProps{ + Description: "MinRetryRate defines the minimum rate of retries that will be allowable over a specified duration of time.\n\nThis ensures that requests can still be retried during periods of low traffic, where the budget for retries may be calculated as a very low value.\n\nSupport: Extended", + Ref: ref("sigs.k8s.io/gateway-api/apisx/v1alpha2.RequestRate"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/gateway-api/apisx/v1alpha2.RequestRate"}, + } +} diff --git a/apis/v1alpha2/backendtrafficpolicy_types.go b/apisx/v1alpha2/backendtrafficpolicy.go similarity index 100% rename from apis/v1alpha2/backendtrafficpolicy_types.go rename to apisx/v1alpha2/backendtrafficpolicy.go diff --git a/apisx/v1alpha2/doc.go b/apisx/v1alpha2/doc.go new file mode 100644 index 0000000000..f0040c2d02 --- /dev/null +++ b/apisx/v1alpha2/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2025 The Kubernetes Authors. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1alpha2 contains API Schema definitions for the gateway.networking.k8s-x.io +// API group. +// +// +k8s:openapi-gen=true +// +kubebuilder:object:generate=true +// +groupName=gateway.networking.k8s-x.io +package v1alpha2 diff --git a/apisx/v1alpha2/shared_types.go b/apisx/v1alpha2/shared_types.go new file mode 100644 index 0000000000..d558a28819 --- /dev/null +++ b/apisx/v1alpha2/shared_types.go @@ -0,0 +1,46 @@ +/* +Copyright 2025 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import v1 "sigs.k8s.io/gateway-api/apis/v1" +import v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + +type ( + // +k8s:deepcopy-gen=false + SessionPersistence = v1.SessionPersistence + // +k8s:deepcopy-gen=false + Duration = v1.Duration + // +k8s:deepcopy-gen=false + PolicyStatus = v1alpha2.PolicyStatus + // +k8s:deepcopy-gen=false + LocalPolicyTargetReference = v1alpha2.LocalPolicyTargetReference +) + +// RequestRate expresses a rate of requests over a given period of time. +type RequestRate struct { + // Count specifies the number of requests per time interval. + // + // Support: Extended + // +kubebuilder:validation:Minimum=0 + Count *int `json:"count,omitempty"` + + // Interval specifies the divisor of the rate of requests, the amount of + // time during which the given count of requests occur. + // + // Support: Extended + Interval *Duration `json:"interval,omitempty"` +} diff --git a/apisx/v1alpha2/zz_generated.deepcopy.go b/apisx/v1alpha2/zz_generated.deepcopy.go new file mode 100644 index 0000000000..92268a7fac --- /dev/null +++ b/apisx/v1alpha2/zz_generated.deepcopy.go @@ -0,0 +1,171 @@ +//go:build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/gateway-api/apis/v1" + apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendTrafficPolicy) DeepCopyInto(out *BackendTrafficPolicy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTrafficPolicy. +func (in *BackendTrafficPolicy) DeepCopy() *BackendTrafficPolicy { + if in == nil { + return nil + } + out := new(BackendTrafficPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackendTrafficPolicy) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendTrafficPolicyList) DeepCopyInto(out *BackendTrafficPolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BackendTrafficPolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTrafficPolicyList. +func (in *BackendTrafficPolicyList) DeepCopy() *BackendTrafficPolicyList { + if in == nil { + return nil + } + out := new(BackendTrafficPolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackendTrafficPolicyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendTrafficPolicySpec) DeepCopyInto(out *BackendTrafficPolicySpec) { + *out = *in + if in.TargetRefs != nil { + in, out := &in.TargetRefs, &out.TargetRefs + *out = make([]apisv1alpha2.LocalPolicyTargetReference, len(*in)) + copy(*out, *in) + } + if in.RetryConstraint != nil { + in, out := &in.RetryConstraint, &out.RetryConstraint + *out = new(RetryConstraint) + (*in).DeepCopyInto(*out) + } + if in.SessionPersistence != nil { + in, out := &in.SessionPersistence, &out.SessionPersistence + *out = new(v1.SessionPersistence) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTrafficPolicySpec. +func (in *BackendTrafficPolicySpec) DeepCopy() *BackendTrafficPolicySpec { + if in == nil { + return nil + } + out := new(BackendTrafficPolicySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RequestRate) DeepCopyInto(out *RequestRate) { + *out = *in + if in.Count != nil { + in, out := &in.Count, &out.Count + *out = new(int) + **out = **in + } + if in.Interval != nil { + in, out := &in.Interval, &out.Interval + *out = new(v1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequestRate. +func (in *RequestRate) DeepCopy() *RequestRate { + if in == nil { + return nil + } + out := new(RequestRate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RetryConstraint) DeepCopyInto(out *RetryConstraint) { + *out = *in + if in.BudgetPercent != nil { + in, out := &in.BudgetPercent, &out.BudgetPercent + *out = new(int) + **out = **in + } + if in.BudgetInterval != nil { + in, out := &in.BudgetInterval, &out.BudgetInterval + *out = new(v1.Duration) + **out = **in + } + if in.MinRetryRate != nil { + in, out := &in.MinRetryRate, &out.MinRetryRate + *out = new(RequestRate) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetryConstraint. +func (in *RetryConstraint) DeepCopy() *RetryConstraint { + if in == nil { + return nil + } + out := new(RetryConstraint) + in.DeepCopyInto(out) + return out +} diff --git a/apisx/v1alpha2/zz_generated.register.go b/apisx/v1alpha2/zz_generated.register.go new file mode 100644 index 0000000000..76ec2c9672 --- /dev/null +++ b/apisx/v1alpha2/zz_generated.register.go @@ -0,0 +1,70 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by register-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName specifies the group name used to register the objects. +const GroupName = "gateway.networking.k8s-x.io" + +// GroupVersion specifies the group and the version used to register the objects. +var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha2"} + +// SchemeGroupVersion is group version used to register these objects +// Deprecated: use GroupVersion instead. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + // Deprecated: use Install instead + AddToScheme = localSchemeBuilder.AddToScheme + Install = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &BackendTrafficPolicy{}, + &BackendTrafficPolicyList{}, + ) + // AddToGroupVersion allows the serialization of client types like ListOptions. + v1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/cmd/modelschema/main.go b/cmd/modelschema/main.go index a04294ace5..314ed9b72d 100644 --- a/cmd/modelschema/main.go +++ b/cmd/modelschema/main.go @@ -21,10 +21,12 @@ package main import ( "encoding/json" "fmt" + //"maps" "os" "strings" stable "sigs.k8s.io/gateway-api/apis/openapi" + //experimental "sigs.k8s.io/gateway-api/apisx/openapi" "k8s.io/kube-openapi/pkg/common" "k8s.io/kube-openapi/pkg/validation/spec" @@ -44,6 +46,8 @@ func output() error { return spec.MustCreateRef(fmt.Sprintf("#/definitions/%s", friendlyName(name))) } defs := stable.GetOpenAPIDefinitions(refFunc) + //maps.Copy(defs, experimental.GetOpenAPIDefinitions(refFunc)) + schemaDefs := make(map[string]spec.Schema, len(defs)) for k, v := range defs { // Replace top-level schema with v2 if a v2 schema is embedded diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go index c24039215d..8431bb1688 100644 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go +++ b/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go @@ -29,7 +29,6 @@ import ( type GatewayV1alpha2Interface interface { RESTClient() rest.Interface BackendLBPoliciesGetter - BackendTrafficPoliciesGetter GRPCRoutesGetter ReferenceGrantsGetter TCPRoutesGetter @@ -46,10 +45,6 @@ func (c *GatewayV1alpha2Client) BackendLBPolicies(namespace string) BackendLBPol return newBackendLBPolicies(c, namespace) } -func (c *GatewayV1alpha2Client) BackendTrafficPolicies(namespace string) BackendTrafficPolicyInterface { - return newBackendTrafficPolicies(c, namespace) -} - func (c *GatewayV1alpha2Client) GRPCRoutes(namespace string) GRPCRouteInterface { return newGRPCRoutes(c, namespace) } diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go index b50a66de8b..7ea0de6477 100644 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go +++ b/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go @@ -32,10 +32,6 @@ func (c *FakeGatewayV1alpha2) BackendLBPolicies(namespace string) v1alpha2.Backe return &FakeBackendLBPolicies{c, namespace} } -func (c *FakeGatewayV1alpha2) BackendTrafficPolicies(namespace string) v1alpha2.BackendTrafficPolicyInterface { - return &FakeBackendTrafficPolicies{c, namespace} -} - func (c *FakeGatewayV1alpha2) GRPCRoutes(namespace string) v1alpha2.GRPCRouteInterface { return &FakeGRPCRoutes{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go index c7a03b33fa..c0fe07b497 100644 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go @@ -20,8 +20,6 @@ package v1alpha2 type BackendLBPolicyExpansion interface{} -type BackendTrafficPolicyExpansion interface{} - type GRPCRouteExpansion interface{} type ReferenceGrantExpansion interface{} diff --git a/pkg/client/informers/externalversions/apis/v1alpha2/interface.go b/pkg/client/informers/externalversions/apis/v1alpha2/interface.go index cd253ab0ae..8f21c3d8e6 100644 --- a/pkg/client/informers/externalversions/apis/v1alpha2/interface.go +++ b/pkg/client/informers/externalversions/apis/v1alpha2/interface.go @@ -26,8 +26,6 @@ import ( type Interface interface { // BackendLBPolicies returns a BackendLBPolicyInformer. BackendLBPolicies() BackendLBPolicyInformer - // BackendTrafficPolicies returns a BackendTrafficPolicyInformer. - BackendTrafficPolicies() BackendTrafficPolicyInformer // GRPCRoutes returns a GRPCRouteInformer. GRPCRoutes() GRPCRouteInformer // ReferenceGrants returns a ReferenceGrantInformer. @@ -56,11 +54,6 @@ func (v *version) BackendLBPolicies() BackendLBPolicyInformer { return &backendLBPolicyInformer{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} -} - // GRPCRoutes returns a GRPCRouteInformer. func (v *version) GRPCRoutes() GRPCRouteInformer { return &gRPCRouteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 88f2ce2ce3..283d2475b2 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -68,8 +68,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=gateway.networking.k8s.io, Version=v1alpha2 case v1alpha2.SchemeGroupVersion.WithResource("backendlbpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().BackendLBPolicies().Informer()}, nil - case v1alpha2.SchemeGroupVersion.WithResource("backendtrafficpolicies"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().BackendTrafficPolicies().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("grpcroutes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().GRPCRoutes().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("referencegrants"): diff --git a/pkg/client/listers/apis/v1alpha2/expansion_generated.go b/pkg/client/listers/apis/v1alpha2/expansion_generated.go index 98516d30c3..d311d49157 100644 --- a/pkg/client/listers/apis/v1alpha2/expansion_generated.go +++ b/pkg/client/listers/apis/v1alpha2/expansion_generated.go @@ -26,14 +26,6 @@ type BackendLBPolicyListerExpansion interface{} // BackendLBPolicyNamespaceLister. type BackendLBPolicyNamespaceListerExpansion 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{} - // GRPCRouteListerExpansion allows custom methods to be added to // GRPCRouteLister. type GRPCRouteListerExpansion interface{} diff --git a/pkg/clientx/clientset/versioned/clientset.go b/pkg/clientx/clientset/versioned/clientset.go new file mode 100644 index 0000000000..bcd9673959 --- /dev/null +++ b/pkg/clientx/clientset/versioned/clientset.go @@ -0,0 +1,120 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + "fmt" + "net/http" + + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" + gatewayv1alpha2 "sigs.k8s.io/gateway-api/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface +} + +// Clientset contains the clients for groups. +type Clientset struct { + *discovery.DiscoveryClient + gatewayV1alpha2 *gatewayv1alpha2.GatewayV1alpha2Client +} + +// GatewayV1alpha2 retrieves the GatewayV1alpha2Client +func (c *Clientset) GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface { + return c.gatewayV1alpha2 +} + +// 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.gatewayV1alpha2, err = gatewayv1alpha2.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.gatewayV1alpha2 = gatewayv1alpha2.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/pkg/clientx/clientset/versioned/fake/clientset_generated.go b/pkg/clientx/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..d34e83fbd6 --- /dev/null +++ b/pkg/clientx/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,122 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "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" + applyconfiguration "sigs.k8s.io/gateway-api/apisx/applyconfiguration" + clientset "sigs.k8s.io/gateway-api/pkg/clientx/clientset/versioned" + gatewayv1alpha2 "sigs.k8s.io/gateway-api/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2" + fakegatewayv1alpha2 "sigs.k8s.io/gateway-api/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake" +) + +// 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) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + 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 +} + +// NewClientset 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 validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewClientset(objects ...runtime.Object) *Clientset { + o := testing.NewFieldManagedObjectTracker( + scheme, + codecs.UniversalDecoder(), + applyconfiguration.NewTypeConverter(scheme), + ) + 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) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +var ( + _ clientset.Interface = &Clientset{} + _ testing.FakeClient = &Clientset{} +) + +// GatewayV1alpha2 retrieves the GatewayV1alpha2Client +func (c *Clientset) GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface { + return &fakegatewayv1alpha2.FakeGatewayV1alpha2{Fake: &c.Fake} +} diff --git a/pkg/clientx/clientset/versioned/fake/doc.go b/pkg/clientx/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..9b99e71670 --- /dev/null +++ b/pkg/clientx/clientset/versioned/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/clientx/clientset/versioned/fake/register.go b/pkg/clientx/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..00545e05f4 --- /dev/null +++ b/pkg/clientx/clientset/versioned/fake/register.go @@ -0,0 +1,56 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + 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" + gatewayv1alpha2 "sigs.k8s.io/gateway-api/apisx/v1alpha2" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) + +var localSchemeBuilder = runtime.SchemeBuilder{ + gatewayv1alpha2.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/clientx/clientset/versioned/scheme/doc.go b/pkg/clientx/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..7dc3756168 --- /dev/null +++ b/pkg/clientx/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/pkg/clientx/clientset/versioned/scheme/register.go b/pkg/clientx/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..74ac3ad54a --- /dev/null +++ b/pkg/clientx/clientset/versioned/scheme/register.go @@ -0,0 +1,56 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + 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" + gatewayv1alpha2 "sigs.k8s.io/gateway-api/apisx/v1alpha2" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + gatewayv1alpha2.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/clientx/clientset/versioned/typed/apisx/v1alpha2/apisx_client.go b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/apisx_client.go new file mode 100644 index 0000000000..1bd8a8caa0 --- /dev/null +++ b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/apisx_client.go @@ -0,0 +1,107 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "net/http" + + rest "k8s.io/client-go/rest" + v1alpha2 "sigs.k8s.io/gateway-api/apisx/v1alpha2" + "sigs.k8s.io/gateway-api/pkg/clientx/clientset/versioned/scheme" +) + +type GatewayV1alpha2Interface interface { + RESTClient() rest.Interface + BackendTrafficPoliciesGetter +} + +// GatewayV1alpha2Client is used to interact with features provided by the gateway.networking.k8s-x.io group. +type GatewayV1alpha2Client struct { + restClient rest.Interface +} + +func (c *GatewayV1alpha2Client) BackendTrafficPolicies(namespace string) BackendTrafficPolicyInterface { + return newBackendTrafficPolicies(c, namespace) +} + +// NewForConfig creates a new GatewayV1alpha2Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*GatewayV1alpha2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new GatewayV1alpha2Client 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) (*GatewayV1alpha2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &GatewayV1alpha2Client{client}, nil +} + +// NewForConfigOrDie creates a new GatewayV1alpha2Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *GatewayV1alpha2Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new GatewayV1alpha2Client for the given RESTClient. +func New(c rest.Interface) *GatewayV1alpha2Client { + return &GatewayV1alpha2Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha2.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *GatewayV1alpha2Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/backendtrafficpolicy.go b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/backendtrafficpolicy.go new file mode 100644 index 0000000000..5ff0a5219e --- /dev/null +++ b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/backendtrafficpolicy.go @@ -0,0 +1,73 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "context" + + 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" + apisxv1alpha2 "sigs.k8s.io/gateway-api/apisx/applyconfiguration/apisx/v1alpha2" + v1alpha2 "sigs.k8s.io/gateway-api/apisx/v1alpha2" + scheme "sigs.k8s.io/gateway-api/pkg/clientx/clientset/versioned/scheme" +) + +// 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 *v1alpha2.BackendTrafficPolicy, opts v1.CreateOptions) (*v1alpha2.BackendTrafficPolicy, error) + Update(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendTrafficPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (*v1alpha2.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) (*v1alpha2.BackendTrafficPolicy, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.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 *v1alpha2.BackendTrafficPolicy, err error) + Apply(ctx context.Context, backendTrafficPolicy *apisxv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, backendTrafficPolicy *apisxv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) + BackendTrafficPolicyExpansion +} + +// backendTrafficPolicies implements BackendTrafficPolicyInterface +type backendTrafficPolicies struct { + *gentype.ClientWithListAndApply[*v1alpha2.BackendTrafficPolicy, *v1alpha2.BackendTrafficPolicyList, *apisxv1alpha2.BackendTrafficPolicyApplyConfiguration] +} + +// newBackendTrafficPolicies returns a BackendTrafficPolicies +func newBackendTrafficPolicies(c *GatewayV1alpha2Client, namespace string) *backendTrafficPolicies { + return &backendTrafficPolicies{ + gentype.NewClientWithListAndApply[*v1alpha2.BackendTrafficPolicy, *v1alpha2.BackendTrafficPolicyList, *apisxv1alpha2.BackendTrafficPolicyApplyConfiguration]( + "backendtrafficpolicies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.BackendTrafficPolicy { return &v1alpha2.BackendTrafficPolicy{} }, + func() *v1alpha2.BackendTrafficPolicyList { return &v1alpha2.BackendTrafficPolicyList{} }), + } +} diff --git a/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/doc.go b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/doc.go new file mode 100644 index 0000000000..baaf2d9853 --- /dev/null +++ b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha2 diff --git a/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/doc.go b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/doc.go new file mode 100644 index 0000000000..16f4439906 --- /dev/null +++ b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/fake_apisx_client.go b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/fake_apisx_client.go new file mode 100644 index 0000000000..e10c727845 --- /dev/null +++ b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/fake_apisx_client.go @@ -0,0 +1,40 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v1alpha2 "sigs.k8s.io/gateway-api/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2" +) + +type FakeGatewayV1alpha2 struct { + *testing.Fake +} + +func (c *FakeGatewayV1alpha2) BackendTrafficPolicies(namespace string) v1alpha2.BackendTrafficPolicyInterface { + return &FakeBackendTrafficPolicies{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeGatewayV1alpha2) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/fake_backendtrafficpolicy.go b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/fake_backendtrafficpolicy.go new file mode 100644 index 0000000000..cee9f4fbe4 --- /dev/null +++ b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/fake/fake_backendtrafficpolicy.go @@ -0,0 +1,197 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + apisxv1alpha2 "sigs.k8s.io/gateway-api/apisx/applyconfiguration/apisx/v1alpha2" + v1alpha2 "sigs.k8s.io/gateway-api/apisx/v1alpha2" +) + +// FakeBackendTrafficPolicies implements BackendTrafficPolicyInterface +type FakeBackendTrafficPolicies struct { + Fake *FakeGatewayV1alpha2 + ns string +} + +var backendtrafficpoliciesResource = v1alpha2.SchemeGroupVersion.WithResource("backendtrafficpolicies") + +var backendtrafficpoliciesKind = v1alpha2.SchemeGroupVersion.WithKind("BackendTrafficPolicy") + +// Get takes name of the backendTrafficPolicy, and returns the corresponding backendTrafficPolicy object, and an error if there is any. +func (c *FakeBackendTrafficPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(backendtrafficpoliciesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// List takes label and field selectors, and returns the list of BackendTrafficPolicies that match those selectors. +func (c *FakeBackendTrafficPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.BackendTrafficPolicyList, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicyList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(backendtrafficpoliciesResource, backendtrafficpoliciesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.BackendTrafficPolicyList{ListMeta: obj.(*v1alpha2.BackendTrafficPolicyList).ListMeta} + for _, item := range obj.(*v1alpha2.BackendTrafficPolicyList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested backendTrafficPolicies. +func (c *FakeBackendTrafficPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(backendtrafficpoliciesResource, c.ns, opts)) + +} + +// Create takes the representation of a backendTrafficPolicy and creates it. Returns the server's representation of the backendTrafficPolicy, and an error, if there is any. +func (c *FakeBackendTrafficPolicies) Create(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.CreateOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(backendtrafficpoliciesResource, c.ns, backendTrafficPolicy, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// Update takes the representation of a backendTrafficPolicy and updates it. Returns the server's representation of the backendTrafficPolicy, and an error, if there is any. +func (c *FakeBackendTrafficPolicies) Update(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(backendtrafficpoliciesResource, c.ns, backendTrafficPolicy, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeBackendTrafficPolicies) UpdateStatus(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(backendtrafficpoliciesResource, "status", c.ns, backendTrafficPolicy, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// Delete takes name of the backendTrafficPolicy and deletes it. Returns an error if one occurs. +func (c *FakeBackendTrafficPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(backendtrafficpoliciesResource, c.ns, name, opts), &v1alpha2.BackendTrafficPolicy{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBackendTrafficPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(backendtrafficpoliciesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha2.BackendTrafficPolicyList{}) + return err +} + +// Patch applies the patch and returns the patched backendTrafficPolicy. +func (c *FakeBackendTrafficPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.BackendTrafficPolicy, err error) { + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(backendtrafficpoliciesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied backendTrafficPolicy. +func (c *FakeBackendTrafficPolicies) Apply(ctx context.Context, backendTrafficPolicy *apisxv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + if backendTrafficPolicy == nil { + return nil, fmt.Errorf("backendTrafficPolicy provided to Apply must not be nil") + } + data, err := json.Marshal(backendTrafficPolicy) + if err != nil { + return nil, err + } + name := backendTrafficPolicy.Name + if name == nil { + return nil, fmt.Errorf("backendTrafficPolicy.Name must be provided to Apply") + } + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(backendtrafficpoliciesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeBackendTrafficPolicies) ApplyStatus(ctx context.Context, backendTrafficPolicy *apisxv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { + if backendTrafficPolicy == nil { + return nil, fmt.Errorf("backendTrafficPolicy provided to Apply must not be nil") + } + data, err := json.Marshal(backendTrafficPolicy) + if err != nil { + return nil, err + } + name := backendTrafficPolicy.Name + if name == nil { + return nil, fmt.Errorf("backendTrafficPolicy.Name must be provided to Apply") + } + emptyResult := &v1alpha2.BackendTrafficPolicy{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(backendtrafficpoliciesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.BackendTrafficPolicy), err +} diff --git a/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/generated_expansion.go b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/generated_expansion.go new file mode 100644 index 0000000000..2ca07ad3bf --- /dev/null +++ b/pkg/clientx/clientset/versioned/typed/apisx/v1alpha2/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +type BackendTrafficPolicyExpansion interface{} diff --git a/pkg/clientx/informers/externalversions/apisx/interface.go b/pkg/clientx/informers/externalversions/apisx/interface.go new file mode 100644 index 0000000000..0b7ed24fe5 --- /dev/null +++ b/pkg/clientx/informers/externalversions/apisx/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package apisx + +import ( + v1alpha2 "sigs.k8s.io/gateway-api/pkg/clientx/informers/externalversions/apisx/v1alpha2" + internalinterfaces "sigs.k8s.io/gateway-api/pkg/clientx/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha2 provides access to shared informers for resources in V1alpha2. + V1alpha2() v1alpha2.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha2 returns a new v1alpha2.Interface. +func (g *group) V1alpha2() v1alpha2.Interface { + return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clientx/informers/externalversions/apisx/v1alpha2/backendtrafficpolicy.go b/pkg/clientx/informers/externalversions/apisx/v1alpha2/backendtrafficpolicy.go new file mode 100644 index 0000000000..0d944706ea --- /dev/null +++ b/pkg/clientx/informers/externalversions/apisx/v1alpha2/backendtrafficpolicy.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + apisxv1alpha2 "sigs.k8s.io/gateway-api/apisx/v1alpha2" + versioned "sigs.k8s.io/gateway-api/pkg/clientx/clientset/versioned" + internalinterfaces "sigs.k8s.io/gateway-api/pkg/clientx/informers/externalversions/internalinterfaces" + v1alpha2 "sigs.k8s.io/gateway-api/pkg/clientx/listers/apisx/v1alpha2" +) + +// BackendTrafficPolicyInformer provides access to a shared informer and lister for +// BackendTrafficPolicies. +type BackendTrafficPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.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.GatewayV1alpha2().BackendTrafficPolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha2().BackendTrafficPolicies(namespace).Watch(context.TODO(), options) + }, + }, + &apisxv1alpha2.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(&apisxv1alpha2.BackendTrafficPolicy{}, f.defaultInformer) +} + +func (f *backendTrafficPolicyInformer) Lister() v1alpha2.BackendTrafficPolicyLister { + return v1alpha2.NewBackendTrafficPolicyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clientx/informers/externalversions/apisx/v1alpha2/interface.go b/pkg/clientx/informers/externalversions/apisx/v1alpha2/interface.go new file mode 100644 index 0000000000..6c901cbd9c --- /dev/null +++ b/pkg/clientx/informers/externalversions/apisx/v1alpha2/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + internalinterfaces "sigs.k8s.io/gateway-api/pkg/clientx/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // BackendTrafficPolicies returns a BackendTrafficPolicyInformer. + BackendTrafficPolicies() BackendTrafficPolicyInformer +} + +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} +} + +// BackendTrafficPolicies returns a BackendTrafficPolicyInformer. +func (v *version) BackendTrafficPolicies() BackendTrafficPolicyInformer { + return &backendTrafficPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clientx/informers/externalversions/factory.go b/pkg/clientx/informers/externalversions/factory.go new file mode 100644 index 0000000000..e1e5b181b6 --- /dev/null +++ b/pkg/clientx/informers/externalversions/factory.go @@ -0,0 +1,262 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + 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" + versioned "sigs.k8s.io/gateway-api/pkg/clientx/clientset/versioned" + apisx "sigs.k8s.io/gateway-api/pkg/clientx/informers/externalversions/apisx" + internalinterfaces "sigs.k8s.io/gateway-api/pkg/clientx/informers/externalversions/internalinterfaces" +) + +// 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() apisx.Interface +} + +func (f *sharedInformerFactory) Gateway() apisx.Interface { + return apisx.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/clientx/informers/externalversions/generic.go b/pkg/clientx/informers/externalversions/generic.go new file mode 100644 index 0000000000..36bcda90c0 --- /dev/null +++ b/pkg/clientx/informers/externalversions/generic.go @@ -0,0 +1,62 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + v1alpha2 "sigs.k8s.io/gateway-api/apisx/v1alpha2" +) + +// 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.networking.k8s-x.io, Version=v1alpha2 + case v1alpha2.SchemeGroupVersion.WithResource("backendtrafficpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().BackendTrafficPolicies().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/pkg/clientx/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/clientx/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..62ea99f2d0 --- /dev/null +++ b/pkg/clientx/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,40 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + versioned "sigs.k8s.io/gateway-api/pkg/clientx/clientset/versioned" +) + +// 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/clientx/listers/apisx/v1alpha2/backendtrafficpolicy.go b/pkg/clientx/listers/apisx/v1alpha2/backendtrafficpolicy.go new file mode 100644 index 0000000000..8e8f95ba67 --- /dev/null +++ b/pkg/clientx/listers/apisx/v1alpha2/backendtrafficpolicy.go @@ -0,0 +1,70 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" + v1alpha2 "sigs.k8s.io/gateway-api/apisx/v1alpha2" +) + +// 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 []*v1alpha2.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[*v1alpha2.BackendTrafficPolicy] +} + +// NewBackendTrafficPolicyLister returns a new BackendTrafficPolicyLister. +func NewBackendTrafficPolicyLister(indexer cache.Indexer) BackendTrafficPolicyLister { + return &backendTrafficPolicyLister{listers.New[*v1alpha2.BackendTrafficPolicy](indexer, v1alpha2.Resource("backendtrafficpolicy"))} +} + +// BackendTrafficPolicies returns an object that can list and get BackendTrafficPolicies. +func (s *backendTrafficPolicyLister) BackendTrafficPolicies(namespace string) BackendTrafficPolicyNamespaceLister { + return backendTrafficPolicyNamespaceLister{listers.NewNamespaced[*v1alpha2.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 []*v1alpha2.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) (*v1alpha2.BackendTrafficPolicy, error) + BackendTrafficPolicyNamespaceListerExpansion +} + +// backendTrafficPolicyNamespaceLister implements the BackendTrafficPolicyNamespaceLister +// interface. +type backendTrafficPolicyNamespaceLister struct { + listers.ResourceIndexer[*v1alpha2.BackendTrafficPolicy] +} diff --git a/pkg/clientx/listers/apisx/v1alpha2/expansion_generated.go b/pkg/clientx/listers/apisx/v1alpha2/expansion_generated.go new file mode 100644 index 0000000000..ff3d49e565 --- /dev/null +++ b/pkg/clientx/listers/apisx/v1alpha2/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +// BackendTrafficPolicyListerExpansion allows custom methods to be added to +// BackendTrafficPolicyLister. +type BackendTrafficPolicyListerExpansion interface{} + +// BackendTrafficPolicyNamespaceListerExpansion allows custom methods to be added to +// BackendTrafficPolicyNamespaceLister. +type BackendTrafficPolicyNamespaceListerExpansion interface{} From dcc5729ad5c264c56efc9566b020db70392991a3 Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Thu, 13 Feb 2025 09:02:44 -0500 Subject: [PATCH 13/14] Delete files that were generated before moving to apisx --- .../apis/v1alpha2/backendtrafficpolicy.go | 264 ------------------ .../apis/v1alpha2/backendtrafficpolicyspec.go | 66 ----- .../apis/v1alpha2/requestrate.go | 52 ---- .../apis/v1alpha2/retryconstraint.go | 61 ---- .../apis/v1alpha2/backendtrafficpolicy.go | 73 ----- .../fake/fake_backendtrafficpolicy.go | 197 ------------- .../apis/v1alpha2/backendtrafficpolicy.go | 90 ------ .../apis/v1alpha2/backendtrafficpolicy.go | 70 ----- 8 files changed, 873 deletions(-) delete mode 100644 apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicy.go delete mode 100644 apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicyspec.go delete mode 100644 apis/applyconfiguration/apis/v1alpha2/requestrate.go delete mode 100644 apis/applyconfiguration/apis/v1alpha2/retryconstraint.go delete mode 100644 pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtrafficpolicy.go delete mode 100644 pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtrafficpolicy.go delete mode 100644 pkg/client/informers/externalversions/apis/v1alpha2/backendtrafficpolicy.go delete mode 100644 pkg/client/listers/apis/v1alpha2/backendtrafficpolicy.go diff --git a/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicy.go b/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicy.go deleted file mode 100644 index f6ab468e7d..0000000000 --- a/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicy.go +++ /dev/null @@ -1,264 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - managedfields "k8s.io/apimachinery/pkg/util/managedfields" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" - internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" - apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" -) - -// BackendTrafficPolicyApplyConfiguration represents a declarative configuration of the BackendTrafficPolicy type for use -// with apply. -type BackendTrafficPolicyApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - Spec *BackendTrafficPolicySpecApplyConfiguration `json:"spec,omitempty"` - Status *PolicyStatusApplyConfiguration `json:"status,omitempty"` -} - -// BackendTrafficPolicy constructs a declarative configuration of the BackendTrafficPolicy type for use with -// apply. -func BackendTrafficPolicy(name, namespace string) *BackendTrafficPolicyApplyConfiguration { - b := &BackendTrafficPolicyApplyConfiguration{} - b.WithName(name) - b.WithNamespace(namespace) - b.WithKind("BackendTrafficPolicy") - b.WithAPIVersion("gateway.networking.k8s.io/v1alpha2") - return b -} - -// ExtractBackendTrafficPolicy extracts the applied configuration owned by fieldManager from -// backendTrafficPolicy. If no managedFields are found in backendTrafficPolicy for fieldManager, a -// BackendTrafficPolicyApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. It is possible that no managed fields were found for because other -// field managers have taken ownership of all the fields previously owned by fieldManager, or because -// the fieldManager never owned fields any fields. -// backendTrafficPolicy must be a unmodified BackendTrafficPolicy API object that was retrieved from the Kubernetes API. -// ExtractBackendTrafficPolicy provides a way to perform a extract/modify-in-place/apply workflow. -// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously -// applied if another fieldManager has updated or force applied any of the previously applied fields. -// Experimental! -func ExtractBackendTrafficPolicy(backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicy, fieldManager string) (*BackendTrafficPolicyApplyConfiguration, error) { - return extractBackendTrafficPolicy(backendTrafficPolicy, fieldManager, "") -} - -// ExtractBackendTrafficPolicyStatus is the same as ExtractBackendTrafficPolicy except -// that it extracts the status subresource applied configuration. -// Experimental! -func ExtractBackendTrafficPolicyStatus(backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicy, fieldManager string) (*BackendTrafficPolicyApplyConfiguration, error) { - return extractBackendTrafficPolicy(backendTrafficPolicy, fieldManager, "status") -} - -func extractBackendTrafficPolicy(backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicy, fieldManager string, subresource string) (*BackendTrafficPolicyApplyConfiguration, error) { - b := &BackendTrafficPolicyApplyConfiguration{} - err := managedfields.ExtractInto(backendTrafficPolicy, internal.Parser().Type("io.k8s.sigs.gateway-api.apis.v1alpha2.BackendTrafficPolicy"), fieldManager, b, subresource) - if err != nil { - return nil, err - } - b.WithName(backendTrafficPolicy.Name) - b.WithNamespace(backendTrafficPolicy.Namespace) - - b.WithKind("BackendTrafficPolicy") - b.WithAPIVersion("gateway.networking.k8s.io/v1alpha2") - return b, nil -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithKind(value string) *BackendTrafficPolicyApplyConfiguration { - b.Kind = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithAPIVersion(value string) *BackendTrafficPolicyApplyConfiguration { - b.APIVersion = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithName(value string) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Name = &value - return b -} - -// WithGenerateName sets the GenerateName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GenerateName field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithGenerateName(value string) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.GenerateName = &value - return b -} - -// WithNamespace sets the Namespace field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Namespace field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithNamespace(value string) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Namespace = &value - return b -} - -// WithUID sets the UID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the UID field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithUID(value types.UID) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.UID = &value - return b -} - -// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithResourceVersion(value string) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.ResourceVersion = &value - return b -} - -// WithGeneration sets the Generation field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Generation field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithGeneration(value int64) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Generation = &value - return b -} - -// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithCreationTimestamp(value metav1.Time) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.CreationTimestamp = &value - return b -} - -// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionTimestamp = &value - return b -} - -// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionGracePeriodSeconds = &value - return b -} - -// WithLabels puts the entries into the Labels field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Labels field, -// overwriting an existing map entries in Labels field with the same key. -func (b *BackendTrafficPolicyApplyConfiguration) WithLabels(entries map[string]string) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Labels == nil && len(entries) > 0 { - b.Labels = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Labels[k] = v - } - return b -} - -// WithAnnotations puts the entries into the Annotations field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Annotations field, -// overwriting an existing map entries in Annotations field with the same key. -func (b *BackendTrafficPolicyApplyConfiguration) WithAnnotations(entries map[string]string) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Annotations == nil && len(entries) > 0 { - b.Annotations = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Annotations[k] = v - } - return b -} - -// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *BackendTrafficPolicyApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - if values[i] == nil { - panic("nil value passed to WithOwnerReferences") - } - b.OwnerReferences = append(b.OwnerReferences, *values[i]) - } - return b -} - -// WithFinalizers adds the given value to the Finalizers field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *BackendTrafficPolicyApplyConfiguration) WithFinalizers(values ...string) *BackendTrafficPolicyApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - b.Finalizers = append(b.Finalizers, values[i]) - } - return b -} - -func (b *BackendTrafficPolicyApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { - if b.ObjectMetaApplyConfiguration == nil { - b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} - } -} - -// WithSpec sets the Spec field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Spec field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithSpec(value *BackendTrafficPolicySpecApplyConfiguration) *BackendTrafficPolicyApplyConfiguration { - b.Spec = value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *BackendTrafficPolicyApplyConfiguration) WithStatus(value *PolicyStatusApplyConfiguration) *BackendTrafficPolicyApplyConfiguration { - b.Status = value - return b -} - -// GetName retrieves the value of the Name field in the declarative configuration. -func (b *BackendTrafficPolicyApplyConfiguration) GetName() *string { - b.ensureObjectMetaApplyConfigurationExists() - return b.Name -} diff --git a/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicyspec.go b/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicyspec.go deleted file mode 100644 index e24d652a10..0000000000 --- a/apis/applyconfiguration/apis/v1alpha2/backendtrafficpolicyspec.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" -) - -// BackendTrafficPolicySpecApplyConfiguration represents a declarative configuration of the BackendTrafficPolicySpec type for use -// with apply. -type BackendTrafficPolicySpecApplyConfiguration struct { - TargetRefs []LocalPolicyTargetReferenceApplyConfiguration `json:"targetRefs,omitempty"` - RetryConstraint *RetryConstraintApplyConfiguration `json:"retry,omitempty"` - SessionPersistence *v1.SessionPersistenceApplyConfiguration `json:"sessionPersistence,omitempty"` -} - -// BackendTrafficPolicySpecApplyConfiguration constructs a declarative configuration of the BackendTrafficPolicySpec type for use with -// apply. -func BackendTrafficPolicySpec() *BackendTrafficPolicySpecApplyConfiguration { - return &BackendTrafficPolicySpecApplyConfiguration{} -} - -// WithTargetRefs adds the given value to the TargetRefs field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the TargetRefs field. -func (b *BackendTrafficPolicySpecApplyConfiguration) WithTargetRefs(values ...*LocalPolicyTargetReferenceApplyConfiguration) *BackendTrafficPolicySpecApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithTargetRefs") - } - b.TargetRefs = append(b.TargetRefs, *values[i]) - } - return b -} - -// WithRetryConstraint sets the RetryConstraint field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the RetryConstraint field is set to the value of the last call. -func (b *BackendTrafficPolicySpecApplyConfiguration) WithRetryConstraint(value *RetryConstraintApplyConfiguration) *BackendTrafficPolicySpecApplyConfiguration { - b.RetryConstraint = value - return b -} - -// WithSessionPersistence sets the SessionPersistence field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the SessionPersistence field is set to the value of the last call. -func (b *BackendTrafficPolicySpecApplyConfiguration) WithSessionPersistence(value *v1.SessionPersistenceApplyConfiguration) *BackendTrafficPolicySpecApplyConfiguration { - b.SessionPersistence = value - return b -} diff --git a/apis/applyconfiguration/apis/v1alpha2/requestrate.go b/apis/applyconfiguration/apis/v1alpha2/requestrate.go deleted file mode 100644 index e71fcd534a..0000000000 --- a/apis/applyconfiguration/apis/v1alpha2/requestrate.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - v1 "sigs.k8s.io/gateway-api/apis/v1" -) - -// RequestRateApplyConfiguration represents a declarative configuration of the RequestRate type for use -// with apply. -type RequestRateApplyConfiguration struct { - Count *int `json:"count,omitempty"` - Interval *v1.Duration `json:"interval,omitempty"` -} - -// RequestRateApplyConfiguration constructs a declarative configuration of the RequestRate type for use with -// apply. -func RequestRate() *RequestRateApplyConfiguration { - return &RequestRateApplyConfiguration{} -} - -// WithCount sets the Count field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Count field is set to the value of the last call. -func (b *RequestRateApplyConfiguration) WithCount(value int) *RequestRateApplyConfiguration { - b.Count = &value - return b -} - -// WithInterval sets the Interval field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Interval field is set to the value of the last call. -func (b *RequestRateApplyConfiguration) WithInterval(value v1.Duration) *RequestRateApplyConfiguration { - b.Interval = &value - return b -} diff --git a/apis/applyconfiguration/apis/v1alpha2/retryconstraint.go b/apis/applyconfiguration/apis/v1alpha2/retryconstraint.go deleted file mode 100644 index 36f0068138..0000000000 --- a/apis/applyconfiguration/apis/v1alpha2/retryconstraint.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - v1 "sigs.k8s.io/gateway-api/apis/v1" -) - -// RetryConstraintApplyConfiguration represents a declarative configuration of the RetryConstraint type for use -// with apply. -type RetryConstraintApplyConfiguration struct { - BudgetPercent *int `json:"budgetPercent,omitempty"` - BudgetInterval *v1.Duration `json:"budgetInterval,omitempty"` - MinRetryRate *RequestRateApplyConfiguration `json:"minRetryRate,omitempty"` -} - -// RetryConstraintApplyConfiguration constructs a declarative configuration of the RetryConstraint type for use with -// apply. -func RetryConstraint() *RetryConstraintApplyConfiguration { - return &RetryConstraintApplyConfiguration{} -} - -// WithBudgetPercent sets the BudgetPercent field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the BudgetPercent field is set to the value of the last call. -func (b *RetryConstraintApplyConfiguration) WithBudgetPercent(value int) *RetryConstraintApplyConfiguration { - b.BudgetPercent = &value - return b -} - -// WithBudgetInterval sets the BudgetInterval field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the BudgetInterval field is set to the value of the last call. -func (b *RetryConstraintApplyConfiguration) WithBudgetInterval(value v1.Duration) *RetryConstraintApplyConfiguration { - b.BudgetInterval = &value - return b -} - -// WithMinRetryRate sets the MinRetryRate field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MinRetryRate field is set to the value of the last call. -func (b *RetryConstraintApplyConfiguration) WithMinRetryRate(value *RequestRateApplyConfiguration) *RetryConstraintApplyConfiguration { - b.MinRetryRate = value - return b -} diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtrafficpolicy.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtrafficpolicy.go deleted file mode 100644 index cda9a3272d..0000000000 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtrafficpolicy.go +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - "context" - - 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" - apisv1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" - v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" - scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" -) - -// 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 *v1alpha2.BackendTrafficPolicy, opts v1.CreateOptions) (*v1alpha2.BackendTrafficPolicy, error) - Update(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendTrafficPolicy, error) - // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (*v1alpha2.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) (*v1alpha2.BackendTrafficPolicy, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.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 *v1alpha2.BackendTrafficPolicy, err error) - Apply(ctx context.Context, backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) - // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). - ApplyStatus(ctx context.Context, backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) - BackendTrafficPolicyExpansion -} - -// backendTrafficPolicies implements BackendTrafficPolicyInterface -type backendTrafficPolicies struct { - *gentype.ClientWithListAndApply[*v1alpha2.BackendTrafficPolicy, *v1alpha2.BackendTrafficPolicyList, *apisv1alpha2.BackendTrafficPolicyApplyConfiguration] -} - -// newBackendTrafficPolicies returns a BackendTrafficPolicies -func newBackendTrafficPolicies(c *GatewayV1alpha2Client, namespace string) *backendTrafficPolicies { - return &backendTrafficPolicies{ - gentype.NewClientWithListAndApply[*v1alpha2.BackendTrafficPolicy, *v1alpha2.BackendTrafficPolicyList, *apisv1alpha2.BackendTrafficPolicyApplyConfiguration]( - "backendtrafficpolicies", - c.RESTClient(), - scheme.ParameterCodec, - namespace, - func() *v1alpha2.BackendTrafficPolicy { return &v1alpha2.BackendTrafficPolicy{} }, - func() *v1alpha2.BackendTrafficPolicyList { return &v1alpha2.BackendTrafficPolicyList{} }), - } -} diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtrafficpolicy.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtrafficpolicy.go deleted file mode 100644 index a67e1275bf..0000000000 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtrafficpolicy.go +++ /dev/null @@ -1,197 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - json "encoding/json" - "fmt" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - apisv1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" - v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" -) - -// FakeBackendTrafficPolicies implements BackendTrafficPolicyInterface -type FakeBackendTrafficPolicies struct { - Fake *FakeGatewayV1alpha2 - ns string -} - -var backendtrafficpoliciesResource = v1alpha2.SchemeGroupVersion.WithResource("backendtrafficpolicies") - -var backendtrafficpoliciesKind = v1alpha2.SchemeGroupVersion.WithKind("BackendTrafficPolicy") - -// Get takes name of the backendTrafficPolicy, and returns the corresponding backendTrafficPolicy object, and an error if there is any. -func (c *FakeBackendTrafficPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { - emptyResult := &v1alpha2.BackendTrafficPolicy{} - obj, err := c.Fake. - Invokes(testing.NewGetActionWithOptions(backendtrafficpoliciesResource, c.ns, name, options), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha2.BackendTrafficPolicy), err -} - -// List takes label and field selectors, and returns the list of BackendTrafficPolicies that match those selectors. -func (c *FakeBackendTrafficPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.BackendTrafficPolicyList, err error) { - emptyResult := &v1alpha2.BackendTrafficPolicyList{} - obj, err := c.Fake. - Invokes(testing.NewListActionWithOptions(backendtrafficpoliciesResource, backendtrafficpoliciesKind, c.ns, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha2.BackendTrafficPolicyList{ListMeta: obj.(*v1alpha2.BackendTrafficPolicyList).ListMeta} - for _, item := range obj.(*v1alpha2.BackendTrafficPolicyList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested backendTrafficPolicies. -func (c *FakeBackendTrafficPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchActionWithOptions(backendtrafficpoliciesResource, c.ns, opts)) - -} - -// Create takes the representation of a backendTrafficPolicy and creates it. Returns the server's representation of the backendTrafficPolicy, and an error, if there is any. -func (c *FakeBackendTrafficPolicies) Create(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.CreateOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { - emptyResult := &v1alpha2.BackendTrafficPolicy{} - obj, err := c.Fake. - Invokes(testing.NewCreateActionWithOptions(backendtrafficpoliciesResource, c.ns, backendTrafficPolicy, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha2.BackendTrafficPolicy), err -} - -// Update takes the representation of a backendTrafficPolicy and updates it. Returns the server's representation of the backendTrafficPolicy, and an error, if there is any. -func (c *FakeBackendTrafficPolicies) Update(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { - emptyResult := &v1alpha2.BackendTrafficPolicy{} - obj, err := c.Fake. - Invokes(testing.NewUpdateActionWithOptions(backendtrafficpoliciesResource, c.ns, backendTrafficPolicy, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha2.BackendTrafficPolicy), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeBackendTrafficPolicies) UpdateStatus(ctx context.Context, backendTrafficPolicy *v1alpha2.BackendTrafficPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { - emptyResult := &v1alpha2.BackendTrafficPolicy{} - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceActionWithOptions(backendtrafficpoliciesResource, "status", c.ns, backendTrafficPolicy, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha2.BackendTrafficPolicy), err -} - -// Delete takes name of the backendTrafficPolicy and deletes it. Returns an error if one occurs. -func (c *FakeBackendTrafficPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(backendtrafficpoliciesResource, c.ns, name, opts), &v1alpha2.BackendTrafficPolicy{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeBackendTrafficPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionActionWithOptions(backendtrafficpoliciesResource, c.ns, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha2.BackendTrafficPolicyList{}) - return err -} - -// Patch applies the patch and returns the patched backendTrafficPolicy. -func (c *FakeBackendTrafficPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.BackendTrafficPolicy, err error) { - emptyResult := &v1alpha2.BackendTrafficPolicy{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(backendtrafficpoliciesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha2.BackendTrafficPolicy), err -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied backendTrafficPolicy. -func (c *FakeBackendTrafficPolicies) Apply(ctx context.Context, backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { - if backendTrafficPolicy == nil { - return nil, fmt.Errorf("backendTrafficPolicy provided to Apply must not be nil") - } - data, err := json.Marshal(backendTrafficPolicy) - if err != nil { - return nil, err - } - name := backendTrafficPolicy.Name - if name == nil { - return nil, fmt.Errorf("backendTrafficPolicy.Name must be provided to Apply") - } - emptyResult := &v1alpha2.BackendTrafficPolicy{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(backendtrafficpoliciesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha2.BackendTrafficPolicy), err -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeBackendTrafficPolicies) ApplyStatus(ctx context.Context, backendTrafficPolicy *apisv1alpha2.BackendTrafficPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendTrafficPolicy, err error) { - if backendTrafficPolicy == nil { - return nil, fmt.Errorf("backendTrafficPolicy provided to Apply must not be nil") - } - data, err := json.Marshal(backendTrafficPolicy) - if err != nil { - return nil, err - } - name := backendTrafficPolicy.Name - if name == nil { - return nil, fmt.Errorf("backendTrafficPolicy.Name must be provided to Apply") - } - emptyResult := &v1alpha2.BackendTrafficPolicy{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(backendtrafficpoliciesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha2.BackendTrafficPolicy), err -} diff --git a/pkg/client/informers/externalversions/apis/v1alpha2/backendtrafficpolicy.go b/pkg/client/informers/externalversions/apis/v1alpha2/backendtrafficpolicy.go deleted file mode 100644 index 2afda1c5f7..0000000000 --- a/pkg/client/informers/externalversions/apis/v1alpha2/backendtrafficpolicy.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" - versioned "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" - internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2" -) - -// BackendTrafficPolicyInformer provides access to a shared informer and lister for -// BackendTrafficPolicies. -type BackendTrafficPolicyInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha2.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.GatewayV1alpha2().BackendTrafficPolicies(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.GatewayV1alpha2().BackendTrafficPolicies(namespace).Watch(context.TODO(), options) - }, - }, - &apisv1alpha2.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(&apisv1alpha2.BackendTrafficPolicy{}, f.defaultInformer) -} - -func (f *backendTrafficPolicyInformer) Lister() v1alpha2.BackendTrafficPolicyLister { - return v1alpha2.NewBackendTrafficPolicyLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/apis/v1alpha2/backendtrafficpolicy.go b/pkg/client/listers/apis/v1alpha2/backendtrafficpolicy.go deleted file mode 100644 index 5c79f7300b..0000000000 --- a/pkg/client/listers/apis/v1alpha2/backendtrafficpolicy.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/listers" - "k8s.io/client-go/tools/cache" - v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" -) - -// 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 []*v1alpha2.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[*v1alpha2.BackendTrafficPolicy] -} - -// NewBackendTrafficPolicyLister returns a new BackendTrafficPolicyLister. -func NewBackendTrafficPolicyLister(indexer cache.Indexer) BackendTrafficPolicyLister { - return &backendTrafficPolicyLister{listers.New[*v1alpha2.BackendTrafficPolicy](indexer, v1alpha2.Resource("backendtrafficpolicy"))} -} - -// BackendTrafficPolicies returns an object that can list and get BackendTrafficPolicies. -func (s *backendTrafficPolicyLister) BackendTrafficPolicies(namespace string) BackendTrafficPolicyNamespaceLister { - return backendTrafficPolicyNamespaceLister{listers.NewNamespaced[*v1alpha2.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 []*v1alpha2.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) (*v1alpha2.BackendTrafficPolicy, error) - BackendTrafficPolicyNamespaceListerExpansion -} - -// backendTrafficPolicyNamespaceLister implements the BackendTrafficPolicyNamespaceLister -// interface. -type backendTrafficPolicyNamespaceLister struct { - listers.ResourceIndexer[*v1alpha2.BackendTrafficPolicy] -} From ededf821d5f584102a5bb6c1fe0fc9840c76e960 Mon Sep 17 00:00:00 2001 From: ericdbishop Date: Thu, 13 Feb 2025 09:04:44 -0500 Subject: [PATCH 14/14] undo commenting --- cmd/modelschema/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/modelschema/main.go b/cmd/modelschema/main.go index 314ed9b72d..42dd9e497b 100644 --- a/cmd/modelschema/main.go +++ b/cmd/modelschema/main.go @@ -21,12 +21,12 @@ package main import ( "encoding/json" "fmt" - //"maps" + "maps" "os" "strings" stable "sigs.k8s.io/gateway-api/apis/openapi" - //experimental "sigs.k8s.io/gateway-api/apisx/openapi" + experimental "sigs.k8s.io/gateway-api/apisx/openapi" "k8s.io/kube-openapi/pkg/common" "k8s.io/kube-openapi/pkg/validation/spec" @@ -46,7 +46,7 @@ func output() error { return spec.MustCreateRef(fmt.Sprintf("#/definitions/%s", friendlyName(name))) } defs := stable.GetOpenAPIDefinitions(refFunc) - //maps.Copy(defs, experimental.GetOpenAPIDefinitions(refFunc)) + maps.Copy(defs, experimental.GetOpenAPIDefinitions(refFunc)) schemaDefs := make(map[string]spec.Schema, len(defs)) for k, v := range defs {