...

Source file src/sigs.k8s.io/gateway-api/apis/v1beta1/gateway_types.go

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

     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 v1beta1
    18  
    19  import (
    20  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  
    22  	v1 "sigs.k8s.io/gateway-api/apis/v1"
    23  )
    24  
    25  // +genclient
    26  // +kubebuilder:object:root=true
    27  // +kubebuilder:resource:categories=gateway-api,shortName=gtw
    28  // +kubebuilder:storageversion
    29  // +kubebuilder:subresource:status
    30  // +kubebuilder:printcolumn:name="Class",type=string,JSONPath=`.spec.gatewayClassName`
    31  // +kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.addresses[*].value`
    32  // +kubebuilder:printcolumn:name="Programmed",type=string,JSONPath=`.status.conditions[?(@.type=="Programmed")].status`
    33  // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
    34  
    35  // Gateway represents an instance of a service-traffic handling infrastructure
    36  // by binding Listeners to a set of IP addresses.
    37  type Gateway v1.Gateway
    38  
    39  // +kubebuilder:object:root=true
    40  
    41  // GatewayList contains a list of Gateways.
    42  type GatewayList struct {
    43  	metav1.TypeMeta `json:",inline"`
    44  	metav1.ListMeta `json:"metadata,omitempty"`
    45  	Items           []Gateway `json:"items"`
    46  }
    47  
    48  // GatewaySpec defines the desired state of Gateway.
    49  //
    50  // Not all possible combinations of options specified in the Spec are
    51  // valid. Some invalid configurations can be caught synchronously via a
    52  // webhook, but there are many cases that will require asynchronous
    53  // signaling via the GatewayStatus block.
    54  // +k8s:deepcopy-gen=false
    55  type GatewaySpec = v1.GatewaySpec
    56  
    57  // Listener embodies the concept of a logical endpoint where a Gateway accepts
    58  // network connections.
    59  // +k8s:deepcopy-gen=false
    60  type Listener = v1.Listener
    61  
    62  // ProtocolType defines the application protocol accepted by a Listener.
    63  // Implementations are not required to accept all the defined protocols. If an
    64  // implementation does not support a specified protocol, it MUST set the
    65  // "Accepted" condition to False for the affected Listener with a reason of
    66  // "UnsupportedProtocol".
    67  //
    68  // Core ProtocolType values are listed in the table below.
    69  //
    70  // Implementations can define their own protocols if a core ProtocolType does not
    71  // exist. Such definitions must use prefixed name, such as
    72  // `mycompany.com/my-custom-protocol`. Un-prefixed names are reserved for core
    73  // protocols. Any protocol defined by implementations will fall under
    74  // implementation-specific conformance.
    75  //
    76  // Valid values include:
    77  //
    78  // * "HTTP" - Core support
    79  // * "example.com/bar" - Implementation-specific support
    80  //
    81  // Invalid values include:
    82  //
    83  // * "example.com" - must include path if domain is used
    84  // * "foo.example.com" - must include path if domain is used
    85  //
    86  // +kubebuilder:validation:MinLength=1
    87  // +kubebuilder:validation:MaxLength=255
    88  // +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([-a-zSA-Z0-9]*[a-zA-Z0-9])?$|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9]+$`
    89  // +k8s:deepcopy-gen=false
    90  type ProtocolType = v1.ProtocolType
    91  
    92  // GatewayTLSConfig describes a TLS configuration.
    93  // +k8s:deepcopy-gen=false
    94  type GatewayTLSConfig = v1.GatewayTLSConfig
    95  
    96  // TLSModeType type defines how a Gateway handles TLS sessions.
    97  //
    98  // Note that values may be added to this enum, implementations
    99  // must ensure that unknown values will not cause a crash.
   100  //
   101  // Unknown values here must result in the implementation setting the
   102  // Ready Condition for the Listener to `status: False`, with a
   103  // Reason of `Invalid`.
   104  //
   105  // +kubebuilder:validation:Enum=Terminate;Passthrough
   106  // +k8s:deepcopy-gen=false
   107  type TLSModeType = v1.TLSModeType
   108  
   109  // AllowedRoutes defines which Routes may be attached to this Listener.
   110  // +k8s:deepcopy-gen=false
   111  type AllowedRoutes = v1.AllowedRoutes
   112  
   113  // FromNamespaces specifies namespace from which Routes may be attached to a
   114  // Gateway.
   115  //
   116  // Note that values may be added to this enum, implementations
   117  // must ensure that unknown values will not cause a crash.
   118  //
   119  // Unknown values here must result in the implementation setting the
   120  // Ready Condition for the Listener to `status: False`, with a
   121  // Reason of `Invalid`.
   122  //
   123  // +kubebuilder:validation:Enum=All;Selector;Same
   124  // +k8s:deepcopy-gen=false
   125  type FromNamespaces = v1.FromNamespaces
   126  
   127  // RouteNamespaces indicate which namespaces Routes should be selected from.
   128  // +k8s:deepcopy-gen=false
   129  type RouteNamespaces = v1.RouteNamespaces
   130  
   131  // RouteGroupKind indicates the group and kind of a Route resource.
   132  // +k8s:deepcopy-gen=false
   133  type RouteGroupKind = v1.RouteGroupKind
   134  
   135  // GatewayAddress describes an address that can be bound to a Gateway.
   136  // +k8s:deepcopy-gen=false
   137  type GatewayAddress = v1.GatewayAddress
   138  
   139  // GatewayStatus defines the observed state of Gateway.
   140  // +k8s:deepcopy-gen=false
   141  type GatewayStatus = v1.GatewayStatus
   142  
   143  // GatewayConditionType is a type of condition associated with a
   144  // Gateway. This type should be used with the GatewayStatus.Conditions
   145  // field.
   146  // +k8s:deepcopy-gen=false
   147  type GatewayConditionType = v1.GatewayConditionType
   148  
   149  // GatewayConditionReason defines the set of reasons that explain why a
   150  // particular Gateway condition type has been raised.
   151  // +k8s:deepcopy-gen=false
   152  type GatewayConditionReason = v1.GatewayConditionReason
   153  
   154  // ListenerStatus is the status associated with a Listener.
   155  // +k8s:deepcopy-gen=false
   156  type ListenerStatus = v1.ListenerStatus
   157  
   158  // ListenerConditionType is a type of condition associated with the
   159  // listener. This type should be used with the ListenerStatus.Conditions
   160  // field.
   161  // +k8s:deepcopy-gen=false
   162  type ListenerConditionType = v1.ListenerConditionType
   163  
   164  // ListenerConditionReason defines the set of reasons that explain
   165  // why a particular Listener condition type has been raised.
   166  // +k8s:deepcopy-gen=false
   167  type ListenerConditionReason = v1.ListenerConditionReason
   168  

View as plain text