...

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

View as plain text