consul/test
Dan Upton d4c435856b
grpc: `protoc` plugin for generating gRPC rate limit specifications (#15564)
Adds automation for generating the map of `gRPC Method Name → Rate Limit Type`
used by the middleware introduced in #15550, and will ensure we don't forget
to add new endpoints.

Engineers must annotate their RPCs in the proto file like so:

```
rpc Foo(FooRequest) returns (FooResponse) {
  option (consul.internal.ratelimit.spec) = {
    operation_type: READ,
  };
}
```

When they run `make proto` a protoc plugin `protoc-gen-consul-rate-limit` will
be installed that writes rate-limit specs as a JSON array to a file called
`.ratelimit.tmp` (one per protobuf package/directory).

After running Buf, `make proto` will execute a post-process script that will
ingest all of the `.ratelimit.tmp` files and generate a Go file containing the
mappings in the `agent/grpc-middleware` package. In the enterprise repository,
it will write an additional file with the enterprise-only endpoints.

If an engineer forgets to add the annotation to a new RPC, the plugin will
return an error like so:

```
RPC Foo is missing rate-limit specification, fix it with:

	import "proto-public/annotations/ratelimit/ratelimit.proto";

	service Bar {
	  rpc Foo(...) returns (...) {
	    option (hashicorp.consul.internal.ratelimit.spec) = {
	      operation_type: OPERATION_READ | OPERATION_WRITE | OPERATION_EXEMPT,
	    };
	  }
	}
```

In the future, this annotation can be extended to support rate-limit
category (e.g. KV vs Catalog) and to determine the retry policy.
2023-01-04 16:07:02 +00:00
..
bin test: log exit code in cluster.bash 2017-06-08 14:06:10 +02:00
ca Regenerate test certificates. (#15218) 2022-11-01 10:51:13 -05:00
ca_path Add tls client options to api/cli 2017-04-14 13:37:29 -07:00
client_certs Regenerate test certificates. (#15218) 2022-11-01 10:51:13 -05:00
command/merge Add utility types to enable checking for unset flags 2017-02-07 20:14:41 -05:00
hostname Regenerate test certificates. (#15218) 2022-11-01 10:51:13 -05:00
integration grpc: `protoc` plugin for generating gRPC rate limit specifications (#15564) 2023-01-04 16:07:02 +00:00
key Regenerate test certificates. (#15218) 2022-11-01 10:51:13 -05:00
load Load test, upgrade packer version, fix k6s installation (#13382) 2022-06-15 09:29:38 -04:00
snapshot snapshot: read meta.json correctly. (#5193) 2019-01-08 17:06:28 +01:00
CA-GENERATION.md regenerate expired certs (#11462) 2021-11-01 11:40:16 -04:00
notes.txt Adding testing certificates 2014-04-07 15:07:00 -07:00