github.com/nginxinc/kubernetes-ingress@v1.12.5/pkg/apis/configuration/v1alpha1/types.go (about)

     1  package v1alpha1
     2  
     3  import (
     4  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     5  )
     6  
     7  const (
     8  	// TLSPassthroughListenerName is the name of a built-in TLS Passthrough listener.
     9  	TLSPassthroughListenerName = "tls-passthrough"
    10  	// TLSPassthroughListenerProtocol is the protocol of a built-in TLS Passthrough listener.
    11  	TLSPassthroughListenerProtocol = "TLS_PASSTHROUGH"
    12  )
    13  
    14  // +genclient
    15  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    16  // +kubebuilder:validation:Optional
    17  // +kubebuilder:resource:shortName=gc
    18  
    19  // GlobalConfiguration defines the GlobalConfiguration resource.
    20  type GlobalConfiguration struct {
    21  	metav1.TypeMeta   `json:",inline"`
    22  	metav1.ObjectMeta `json:"metadata,omitempty"`
    23  
    24  	Spec GlobalConfigurationSpec `json:"spec"`
    25  }
    26  
    27  // GlobalConfigurationSpec is the spec of the GlobalConfiguration resource.
    28  type GlobalConfigurationSpec struct {
    29  	Listeners []Listener `json:"listeners"`
    30  }
    31  
    32  // Listener defines a listener.
    33  type Listener struct {
    34  	Name     string `json:"name"`
    35  	Port     int    `json:"port"`
    36  	Protocol string `json:"protocol"`
    37  }
    38  
    39  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    40  
    41  // GlobalConfigurationList is a list of the GlobalConfiguration resources.
    42  type GlobalConfigurationList struct {
    43  	metav1.TypeMeta `json:",inline"`
    44  	metav1.ListMeta `json:"metadata"`
    45  
    46  	Items []GlobalConfiguration `json:"items"`
    47  }
    48  
    49  // +genclient
    50  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    51  // +kubebuilder:validation:Optional
    52  // +kubebuilder:resource:shortName=ts
    53  // +kubebuilder:subresource:status
    54  // +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state`,description="Current state of the TransportServer. If the resource has a valid status, it means it has been validated and accepted by the Ingress Controller."
    55  // +kubebuilder:printcolumn:name="Reason",type=string,JSONPath=`.status.reason`
    56  // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
    57  
    58  // TransportServer defines the TransportServer resource.
    59  type TransportServer struct {
    60  	metav1.TypeMeta   `json:",inline"`
    61  	metav1.ObjectMeta `json:"metadata,omitempty"`
    62  
    63  	Spec   TransportServerSpec   `json:"spec"`
    64  	Status TransportServerStatus `json:"status"`
    65  }
    66  
    67  // TransportServerSpec is the spec of the TransportServer resource.
    68  type TransportServerSpec struct {
    69  	IngressClass       string                  `json:"ingressClassName"`
    70  	Listener           TransportServerListener `json:"listener"`
    71  	ServerSnippets     string                  `json:"serverSnippets"`
    72  	StreamSnippets     string                  `json:"streamSnippets"`
    73  	Host               string                  `json:"host"`
    74  	Upstreams          []Upstream              `json:"upstreams"`
    75  	UpstreamParameters *UpstreamParameters     `json:"upstreamParameters"`
    76  	SessionParameters  *SessionParameters      `json:"sessionParameters"`
    77  	Action             *Action                 `json:"action"`
    78  }
    79  
    80  // TransportServerListener defines a listener for a TransportServer.
    81  type TransportServerListener struct {
    82  	Name     string `json:"name"`
    83  	Protocol string `json:"protocol"`
    84  }
    85  
    86  // Upstream defines an upstream.
    87  type Upstream struct {
    88  	Name                string       `json:"name"`
    89  	Service             string       `json:"service"`
    90  	Port                int          `json:"port"`
    91  	FailTimeout         string       `json:"failTimeout"`
    92  	MaxFails            *int         `json:"maxFails"`
    93  	MaxConns            *int         `json:"maxConns"`
    94  	HealthCheck         *HealthCheck `json:"healthCheck"`
    95  	LoadBalancingMethod string       `json:"loadBalancingMethod"`
    96  }
    97  
    98  // HealthCheck defines the parameters for active Upstream HealthChecks.
    99  type HealthCheck struct {
   100  	Enabled  bool   `json:"enable"`
   101  	Timeout  string `json:"timeout"`
   102  	Jitter   string `json:"jitter"`
   103  	Port     int    `json:"port"`
   104  	Interval string `json:"interval"`
   105  	Passes   int    `json:"passes"`
   106  	Fails    int    `json:"fails"`
   107  	Match    *Match `json:"match"`
   108  }
   109  
   110  // Match defines the parameters of a custom health check.
   111  type Match struct {
   112  	Send   string `json:"send"`
   113  	Expect string `json:"expect"`
   114  }
   115  
   116  // UpstreamParameters defines parameters for an upstream.
   117  type UpstreamParameters struct {
   118  	UDPRequests  *int `json:"udpRequests"`
   119  	UDPResponses *int `json:"udpResponses"`
   120  
   121  	ConnectTimeout      string `json:"connectTimeout"`
   122  	NextUpstream        bool   `json:"nextUpstream"`
   123  	NextUpstreamTimeout string `json:"nextUpstreamTimeout"`
   124  	NextUpstreamTries   int    `json:"nextUpstreamTries"`
   125  }
   126  
   127  // SessionParameters defines session parameters.
   128  type SessionParameters struct {
   129  	Timeout string `json:"timeout"`
   130  }
   131  
   132  // Action defines an action.
   133  type Action struct {
   134  	Pass string `json:"pass"`
   135  }
   136  
   137  // TransportServerStatus defines the status for the TransportServer resource.
   138  type TransportServerStatus struct {
   139  	State   string `json:"state"`
   140  	Reason  string `json:"reason"`
   141  	Message string `json:"message"`
   142  }
   143  
   144  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   145  
   146  // TransportServerList is a list of the TransportServer resources.
   147  type TransportServerList struct {
   148  	metav1.TypeMeta `json:",inline"`
   149  	metav1.ListMeta `json:"metadata"`
   150  
   151  	Items []TransportServer `json:"items"`
   152  }