cuelang.org/go@v0.10.1/encoding/protobuf/testdata/gateway.proto.out.cue (about)

     1  // Copyright 2019 CUE Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Copyright 2017 Istio Authors
    16  //
    17  //   Licensed under the Apache License, Version 2.0 (the "License");
    18  //   you may not use this file except in compliance with the License.
    19  //   You may obtain a copy of the License at
    20  //
    21  //       http://www.apache.org/licenses/LICENSE-2.0
    22  //
    23  //   Unless required by applicable law or agreed to in writing, software
    24  //   distributed under the License is distributed on an "AS IS" BASIS,
    25  //   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    26  //   See the License for the specific language governing permissions and
    27  //   limitations under the License.
    28  
    29  // $title: Gateway
    30  // $description: Configuration affecting edge load balancer.
    31  // $location: https://istio.io/docs/reference/config/networking/v1alpha3/gateway.html
    32  
    33  // `Gateway` describes a load balancer operating at the edge of the mesh
    34  // receiving incoming or outgoing HTTP/TCP connections. The specification
    35  // describes a set of ports that should be exposed, the type of protocol to
    36  // use, SNI configuration for the load balancer, etc.
    37  //
    38  // For example, the following Gateway configuration sets up a proxy to act
    39  // as a load balancer exposing port 80 and 9080 (http), 443 (https),
    40  // 9443(https) and port 2379 (TCP) for ingress.  The gateway will be
    41  // applied to the proxy running on a pod with labels `app:
    42  // my-gateway-controller`. While Istio will configure the proxy to listen
    43  // on these ports, it is the responsibility of the user to ensure that
    44  // external traffic to these ports are allowed into the mesh.
    45  //
    46  // ```yaml
    47  // apiVersion: networking.istio.io/v1alpha3
    48  // kind: Gateway
    49  // metadata:
    50  //   name: my-gateway
    51  //   namespace: some-config-namespace
    52  // spec:
    53  //   selector:
    54  //     app: my-gateway-controller
    55  //   servers:
    56  //   - port:
    57  //       number: 80
    58  //       name: http
    59  //       protocol: HTTP
    60  //     hosts:
    61  //     - uk.bookinfo.com
    62  //     - eu.bookinfo.com
    63  //     tls:
    64  //       httpsRedirect: true # sends 301 redirect for http requests
    65  //   - port:
    66  //       number: 443
    67  //       name: https-443
    68  //       protocol: HTTPS
    69  //     hosts:
    70  //     - uk.bookinfo.com
    71  //     - eu.bookinfo.com
    72  //     tls:
    73  //       mode: SIMPLE # enables HTTPS on this port
    74  //       serverCertificate: /etc/certs/servercert.pem
    75  //       privateKey: /etc/certs/privatekey.pem
    76  //   - port:
    77  //       number: 9443
    78  //       name: https-9443
    79  //       protocol: HTTPS
    80  //     hosts:
    81  //     - "bookinfo-namespace/*.bookinfo.com"
    82  //     tls:
    83  //       mode: SIMPLE # enables HTTPS on this port
    84  //       credentialName: bookinfo-secret # fetches certs from Kubernetes secret
    85  //   - port:
    86  //       number: 9080
    87  //       name: http-wildcard
    88  //       protocol: HTTP
    89  //     hosts:
    90  //     - "*"
    91  //   - port:
    92  //       number: 2379 # to expose internal service via external port 2379
    93  //       name: mongo
    94  //       protocol: MONGO
    95  //     hosts:
    96  //     - "*"
    97  // ```
    98  //
    99  // The Gateway specification above describes the L4-L6 properties of a load
   100  // balancer. A `VirtualService` can then be bound to a gateway to control
   101  // the forwarding of traffic arriving at a particular host or gateway port.
   102  //
   103  // For example, the following VirtualService splits traffic for
   104  // `https://uk.bookinfo.com/reviews`, `https://eu.bookinfo.com/reviews`,
   105  // `http://uk.bookinfo.com:9080/reviews`,
   106  // `http://eu.bookinfo.com:9080/reviews` into two versions (prod and qa) of
   107  // an internal reviews service on port 9080. In addition, requests
   108  // containing the cookie "user: dev-123" will be sent to special port 7777
   109  // in the qa version. The same rule is also applicable inside the mesh for
   110  // requests to the "reviews.prod.svc.cluster.local" service. This rule is
   111  // applicable across ports 443, 9080. Note that `http://uk.bookinfo.com`
   112  // gets redirected to `https://uk.bookinfo.com` (i.e. 80 redirects to 443).
   113  //
   114  // ```yaml
   115  // apiVersion: networking.istio.io/v1alpha3
   116  // kind: VirtualService
   117  // metadata:
   118  //   name: bookinfo-rule
   119  //   namespace: bookinfo-namespace
   120  // spec:
   121  //   hosts:
   122  //   - reviews.prod.svc.cluster.local
   123  //   - uk.bookinfo.com
   124  //   - eu.bookinfo.com
   125  //   gateways:
   126  //   - some-config-namespace/my-gateway
   127  //   - mesh # applies to all the sidecars in the mesh
   128  //   http:
   129  //   - match:
   130  //     - headers:
   131  //         cookie:
   132  //           exact: "user=dev-123"
   133  //     route:
   134  //     - destination:
   135  //         port:
   136  //           number: 7777
   137  //         host: reviews.qa.svc.cluster.local
   138  //   - match:
   139  //     - uri:
   140  //         prefix: /reviews/
   141  //     route:
   142  //     - destination:
   143  //         port:
   144  //           number: 9080 # can be omitted if it's the only port for reviews
   145  //         host: reviews.prod.svc.cluster.local
   146  //       weight: 80
   147  //     - destination:
   148  //         host: reviews.qa.svc.cluster.local
   149  //       weight: 20
   150  // ```
   151  //
   152  // The following VirtualService forwards traffic arriving at (external)
   153  // port 27017 to internal Mongo server on port 5555. This rule is not
   154  // applicable internally in the mesh as the gateway list omits the
   155  // reserved name `mesh`.
   156  //
   157  // ```yaml
   158  // apiVersion: networking.istio.io/v1alpha3
   159  // kind: VirtualService
   160  // metadata:
   161  //   name: bookinfo-Mongo
   162  //   namespace: bookinfo-namespace
   163  // spec:
   164  //   hosts:
   165  //   - mongosvr.prod.svc.cluster.local # name of internal Mongo service
   166  //   gateways:
   167  //   - some-config-namespace/my-gateway # can omit the namespace if gateway is in same
   168  //                                        namespace as virtual service.
   169  //   tcp:
   170  //   - match:
   171  //     - port: 27017
   172  //     route:
   173  //     - destination:
   174  //         host: mongo.prod.svc.cluster.local
   175  //         port:
   176  //           number: 5555
   177  // ```
   178  //
   179  // It is possible to restrict the set of virtual services that can bind to
   180  // a gateway server using the namespace/hostname syntax in the hosts field.
   181  // For example, the following Gateway allows any virtual service in the ns1
   182  // namespace to bind to it, while restricting only the virtual service with
   183  // foo.bar.com host in the ns2 namespace to bind to it.
   184  //
   185  // ```yaml
   186  // apiVersion: networking.istio.io/v1alpha3
   187  // kind: Gateway
   188  // metadata:
   189  //   name: my-gateway
   190  //   namespace: some-config-namespace
   191  // spec:
   192  //   selector:
   193  //     app: my-gateway-controller
   194  //   servers:
   195  //   - port:
   196  //       number: 80
   197  //       name: http
   198  //       protocol: HTTP
   199  //     hosts:
   200  //     - "ns1/*"
   201  //     - "ns2/foo.bar.com"
   202  // ```
   203  //
   204  package v1alpha3
   205  
   206  #Gateway: {
   207  	// REQUIRED: A list of server specifications.
   208  	servers: [...#Server] @protobuf(1,Server)
   209  
   210  	// REQUIRED: One or more labels that indicate a specific set of pods/VMs
   211  	// on which this gateway configuration should be applied. The scope of
   212  	// label search is restricted to the configuration namespace in which the
   213  	// the resource is present. In other words, the Gateway resource must
   214  	// reside in the same namespace as the gateway workload instance.
   215  	selector?: {
   216  		[string]: string
   217  	} @protobuf(2,map[string]string)
   218  	selector?: [name=_]: name
   219  }
   220  
   221  // `Server` describes the properties of the proxy on a given load balancer
   222  // port. For example,
   223  //
   224  // ```yaml
   225  // apiVersion: networking.istio.io/v1alpha3
   226  // kind: Gateway
   227  // metadata:
   228  //   name: my-ingress
   229  // spec:
   230  //   selector:
   231  //     app: my-ingress-gateway
   232  //   servers:
   233  //   - port:
   234  //       number: 80
   235  //       name: http2
   236  //       protocol: HTTP2
   237  //     hosts:
   238  //     - "*"
   239  // ```
   240  //
   241  // Another example
   242  //
   243  // ```yaml
   244  // apiVersion: networking.istio.io/v1alpha3
   245  // kind: Gateway
   246  // metadata:
   247  //   name: my-tcp-ingress
   248  // spec:
   249  //   selector:
   250  //     app: my-tcp-ingress-gateway
   251  //   servers:
   252  //   - port:
   253  //       number: 27018
   254  //       name: mongo
   255  //       protocol: MONGO
   256  //     hosts:
   257  //     - "*"
   258  // ```
   259  //
   260  // The following is an example of TLS configuration for port 443
   261  //
   262  // ```yaml
   263  // apiVersion: networking.istio.io/v1alpha3
   264  // kind: Gateway
   265  // metadata:
   266  //   name: my-tls-ingress
   267  // spec:
   268  //   selector:
   269  //     app: my-tls-ingress-gateway
   270  //   servers:
   271  //   - port:
   272  //       number: 443
   273  //       name: https
   274  //       protocol: HTTPS
   275  //     hosts:
   276  //     - "*"
   277  //     tls:
   278  //       mode: SIMPLE
   279  //       serverCertificate: /etc/certs/server.pem
   280  //       privateKey: /etc/certs/privatekey.pem
   281  // ```
   282  #Server: {
   283  	// REQUIRED: The Port on which the proxy should listen for incoming
   284  	// connections.
   285  	port?: #Port @protobuf(1,Port)
   286  	port?: >10 & <100
   287  
   288  	// $hide_from_docs
   289  	// The ip or the Unix domain socket to which the listener should be bound
   290  	// to. Format: `x.x.x.x` or `unix:///path/to/uds` or `unix://@foobar`
   291  	// (Linux abstract namespace). When using Unix domain sockets, the port
   292  	// number should be 0.
   293  	bind?: string @protobuf(4,string)
   294  
   295  	// REQUIRED. One or more hosts exposed by this gateway.
   296  	// While typically applicable to
   297  	// HTTP services, it can also be used for TCP services using TLS with SNI.
   298  	// A host is specified as a `dnsName` with an optional `namespace/` prefix.
   299  	// The `dnsName` should be specified using FQDN format, optionally including
   300  	// a wildcard character in the left-most component (e.g., `prod/*.example.com`).
   301  	// Set the `dnsName` to `*` to select all `VirtualService` hosts from the
   302  	// specified namespace (e.g.,`prod/*`). If no `namespace/` is specified,
   303  	// the `VirtualService` hosts will be selected from any available namespace.
   304  	// Any associated `DestinationRule` in the same namespace will also be used.
   305  	//
   306  	// A `VirtualService` must be bound to the gateway and must have one or
   307  	// more hosts that match the hosts specified in a server. The match
   308  	// could be an exact match or a suffix match with the server's hosts. For
   309  	// example, if the server's hosts specifies `*.example.com`, a
   310  	// `VirtualService` with hosts `dev.example.com` or `prod.example.com` will
   311  	// match. However, a `VirtualService` with host `example.com` or
   312  	// `newexample.com` will not match.
   313  	//
   314  	// NOTE: Only virtual services exported to the gateway's namespace
   315  	// (e.g., `exportTo` value of `*`) can be referenced.
   316  	// Private configurations (e.g., `exportTo` set to `.`) will not be
   317  	// available. Refer to the `exportTo` setting in `VirtualService`,
   318  	// `DestinationRule`, and `ServiceEntry` configurations for details.
   319  	hosts?: [...string] @protobuf(2,string)
   320  
   321  	#TLSOptions: {
   322  		// If set to true, the load balancer will send a 301 redirect for all
   323  		// http connections, asking the clients to use HTTPS.
   324  		httpsRedirect?: bool @protobuf(1,bool,name=https_redirect)
   325  
   326  		// TLS modes enforced by the proxy
   327  		#TLSmode: {
   328  			// The SNI string presented by the client will be used as the match
   329  			// criterion in a VirtualService TLS route to determine the
   330  			// destination service from the service registry.
   331  			"PASSTHROUGH"
   332  			#enumValue: 0
   333  		} | {
   334  			// Secure connections with standard TLS semantics.
   335  			"SIMPLE"
   336  			#enumValue: 1
   337  		} | {
   338  			// Secure connections to the upstream using mutual TLS by presenting
   339  			// client certificates for authentication.
   340  			"MUTUAL"
   341  			#enumValue: 2
   342  		} | {
   343  			// Similar to the passthrough mode, except servers with this TLS mode
   344  			// do not require an associated VirtualService to map from the SNI
   345  			// value to service in the registry. The destination details such as
   346  			// the service/subset/port are encoded in the SNI value. The proxy
   347  			// will forward to the upstream (Envoy) cluster (a group of
   348  			// endpoints) specified by the SNI value. This server is typically
   349  			// used to provide connectivity between services in disparate L3
   350  			// networks that otherwise do not have direct connectivity between
   351  			// their respective endpoints. Use of this mode assumes that both the
   352  			// source and the destination are using Istio mTLS to secure traffic.
   353  			"AUTO_PASSTHROUGH"
   354  			#enumValue: 3
   355  		}
   356  
   357  		#TLSmode_value: {
   358  			PASSTHROUGH:      0
   359  			SIMPLE:           1
   360  			MUTUAL:           2
   361  			AUTO_PASSTHROUGH: 3
   362  		}
   363  
   364  		// Optional: Indicates whether connections to this port should be
   365  		// secured using TLS. The value of this field determines how TLS is
   366  		// enforced.
   367  		mode?: #TLSmode @protobuf(2,TLSmode)
   368  		// Extra comment.
   369  
   370  		// REQUIRED if mode is `SIMPLE` or `MUTUAL`. The path to the file
   371  		// holding the server-side TLS certificate to use.
   372  		serverCertificate?: string @protobuf(3,string,name=server_certificate)
   373  
   374  		// REQUIRED if mode is `SIMPLE` or `MUTUAL`. The path to the file
   375  		// holding the server's private key.
   376  		privateKey?: string @protobuf(4,string,name=private_key)
   377  
   378  		// REQUIRED if mode is `MUTUAL`. The path to a file containing
   379  		// certificate authority certificates to use in verifying a presented
   380  		// client side certificate.
   381  		caCertificates?: string @protobuf(5,string,name=ca_certificates)
   382  
   383  		// The credentialName stands for a unique identifier that can be used
   384  		// to identify the serverCertificate and the privateKey. The
   385  		// credentialName appended with suffix "-cacert" is used to identify
   386  		// the CaCertificates associated with this server. Gateway workloads
   387  		// capable of fetching credentials from a remote credential store such
   388  		// as Kubernetes secrets, will be configured to retrieve the
   389  		// serverCertificate and the privateKey using credentialName, instead
   390  		// of using the file system paths specified above. If using mutual TLS,
   391  		// gateway workload instances will retrieve the CaCertificates using
   392  		// credentialName-cacert. The semantics of the name are platform
   393  		// dependent.  In Kubernetes, the default Istio supplied credential
   394  		// server expects the credentialName to match the name of the
   395  		// Kubernetes secret that holds the server certificate, the private
   396  		// key, and the CA certificate (if using mutual TLS). Set the
   397  		// `ISTIO_META_USER_SDS` metadata variable in the gateway's proxy to
   398  		// enable the dynamic credential fetching feature.
   399  		credentialName?: string @protobuf(10,string,name=credential_name)
   400  
   401  		// A list of alternate names to verify the subject identity in the
   402  		// certificate presented by the client.
   403  		subjectAltNames?: [...string] @protobuf(6,string,name=subject_alt_names)
   404  
   405  		// TLS protocol versions.
   406  		#TLSProtocol: {
   407  			"TLS_AUTO" // Automatically choose the optimal TLS version.
   408  			#enumValue: 0
   409  		} | {
   410  			"TLSV1_0" // TLS version 1.0
   411  			#enumValue: 1
   412  		} | {
   413  			"TLSV1_1" // TLS version 1.1
   414  			#enumValue: 2
   415  		} | {
   416  			"TLSV1_2" // TLS version 1.2
   417  			#enumValue: 3
   418  		} | {
   419  			"TLSV1_3" // TLS version 1.3
   420  			#enumValue: 4
   421  		}
   422  
   423  		#TLSProtocol_value: {
   424  			TLS_AUTO: 0
   425  			TLSV1_0:  1
   426  			TLSV1_1:  2
   427  			TLSV1_2:  3
   428  			TLSV1_3:  4
   429  		}
   430  
   431  		// Optional: Minimum TLS protocol version.
   432  		minProtocolVersion?: #TLSProtocol @protobuf(7,TLSProtocol,name=min_protocol_version)
   433  
   434  		// Optional: Maximum TLS protocol version.
   435  		maxProtocolVersion?: #TLSProtocol @protobuf(8,TLSProtocol,name=max_protocol_version)
   436  
   437  		// Optional: If specified, only support the specified cipher list.
   438  		// Otherwise default to the default cipher list supported by Envoy.
   439  		cipherSuites?: [...string] @protobuf(9,string,name=cipher_suites)
   440  	}
   441  
   442  	// Set of TLS related options that govern the server's behavior. Use
   443  	// these options to control if all http requests should be redirected to
   444  	// https, and the TLS modes to use.
   445  	tls?: #TLSOptions @protobuf(3,TLSOptions)
   446  
   447  	// The loopback IP endpoint or Unix domain socket to which traffic should
   448  	// be forwarded to by default. Format should be `127.0.0.1:PORT` or
   449  	// `unix:///path/to/socket` or `unix://@foobar` (Linux abstract namespace).
   450  	defaultEndpoint?: string @protobuf(5,string,name=default_endpoint)
   451  }
   452  
   453  // Port describes the properties of a specific port of a service.
   454  #Port: {
   455  	// REQUIRED: A valid non-negative integer port number.
   456  	number?: uint32 @protobuf(1,uint32)
   457  
   458  	// REQUIRED: The protocol exposed on the port.
   459  	// MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP|TLS.
   460  	// TLS implies the connection will be routed based on the SNI header to
   461  	// the destination without terminating the TLS connection.
   462  	protocol?: string @protobuf(2,string)
   463  
   464  	// Label assigned to the port.
   465  	name?: string @protobuf(3,string)
   466  }