1d95609fb7
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.
69 lines
1.2 KiB
Plaintext
69 lines
1.2 KiB
Plaintext
*.attr
|
|
*.exe
|
|
*.log
|
|
*.old
|
|
*.swp
|
|
*.test
|
|
.envrc
|
|
.gotools
|
|
.protobuf
|
|
.vagrant/
|
|
/pkg
|
|
bin/
|
|
changelog.tmp
|
|
exit-code
|
|
Thumbs.db
|
|
.idea
|
|
.vscode
|
|
__debug_bin
|
|
coverage.out
|
|
*.tmp
|
|
|
|
# MacOS
|
|
.DS_Store
|
|
.AppleDouble
|
|
.LSOverride
|
|
.fseventsd
|
|
|
|
# Web artifacts
|
|
website/.bundle
|
|
website/build/
|
|
website/npm-debug.log
|
|
website/vendor
|
|
|
|
### Terraform gitignore ###
|
|
# Local .terraform directories
|
|
**/.terraform/*
|
|
|
|
# .tfstate files
|
|
*.tfstate
|
|
*.tfstate.*
|
|
|
|
# Crash log files
|
|
crash.log
|
|
|
|
# Exclude all .tfvars files, which are likely to contain sentitive data, such as
|
|
# password, private keys, and other secrets. These should not be part of version
|
|
# control as they are data points which are potentially sensitive and subject
|
|
# to change depending on the environment.
|
|
#
|
|
*.tfvars
|
|
|
|
# Ignore override files as they are usually used to override resources locally and so
|
|
# are not checked in
|
|
override.tf
|
|
override.tf.json
|
|
*_override.tf
|
|
*_override.tf.json
|
|
|
|
# Include override files you do wish to add to version control using negated pattern
|
|
#
|
|
# !example_override.tf
|
|
|
|
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
|
|
# example: *tfplan*
|
|
|
|
# Ignore CLI configuration files
|
|
.terraformrc
|
|
terraform.rc
|