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