...

Source file src/sigs.k8s.io/gateway-api/apis/v1alpha2/udproute_types.go

Documentation: sigs.k8s.io/gateway-api/apis/v1alpha2

     1  /*
     2  Copyright 2020 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package v1alpha2
    18  
    19  import (
    20  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  )
    22  
    23  // +genclient
    24  // +kubebuilder:object:root=true
    25  // +kubebuilder:resource:categories=gateway-api
    26  // +kubebuilder:subresource:status
    27  // +kubebuilder:storageversion
    28  // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
    29  
    30  // UDPRoute provides a way to route UDP traffic. When combined with a Gateway
    31  // listener, it can be used to forward traffic on the port specified by the
    32  // listener to a set of backends specified by the UDPRoute.
    33  type UDPRoute struct {
    34  	metav1.TypeMeta   `json:",inline"`
    35  	metav1.ObjectMeta `json:"metadata,omitempty"`
    36  
    37  	// Spec defines the desired state of UDPRoute.
    38  	Spec UDPRouteSpec `json:"spec"`
    39  
    40  	// Status defines the current state of UDPRoute.
    41  	Status UDPRouteStatus `json:"status,omitempty"`
    42  }
    43  
    44  // UDPRouteSpec defines the desired state of UDPRoute.
    45  type UDPRouteSpec struct {
    46  	CommonRouteSpec `json:",inline"`
    47  
    48  	// Rules are a list of UDP matchers and actions.
    49  	//
    50  	// +kubebuilder:validation:MinItems=1
    51  	// +kubebuilder:validation:MaxItems=16
    52  	Rules []UDPRouteRule `json:"rules"`
    53  }
    54  
    55  // UDPRouteStatus defines the observed state of UDPRoute.
    56  type UDPRouteStatus struct {
    57  	RouteStatus `json:",inline"`
    58  }
    59  
    60  // UDPRouteRule is the configuration for a given rule.
    61  type UDPRouteRule struct {
    62  	// BackendRefs defines the backend(s) where matching requests should be
    63  	// sent. If unspecified or invalid (refers to a non-existent resource or a
    64  	// Service with no endpoints), the underlying implementation MUST actively
    65  	// reject connection attempts to this backend. Packet drops must
    66  	// respect weight; if an invalid backend is requested to have 80% of
    67  	// the packets, then 80% of packets must be dropped instead.
    68  	//
    69  	// Support: Core for Kubernetes Service
    70  	//
    71  	// Support: Extended for Kubernetes ServiceImport
    72  	//
    73  	// Support: Implementation-specific for any other resource
    74  	//
    75  	// Support for weight: Extended
    76  	//
    77  	// +kubebuilder:validation:MinItems=1
    78  	// +kubebuilder:validation:MaxItems=16
    79  	BackendRefs []BackendRef `json:"backendRefs,omitempty"`
    80  }
    81  
    82  // +kubebuilder:object:root=true
    83  
    84  // UDPRouteList contains a list of UDPRoute
    85  type UDPRouteList struct {
    86  	metav1.TypeMeta `json:",inline"`
    87  	metav1.ListMeta `json:"metadata,omitempty"`
    88  	Items           []UDPRoute `json:"items"`
    89  }
    90  

View as plain text