mirror of https://github.com/istio/api.git
Create Istio API Guidelines (#320)
* Create Istio API Guidelines * Rename STYLE.md -> STYLE-GUIDE.md and address review comments. * Polishing English wording
This commit is contained in:
parent
4ea90f7a85
commit
4c341dfc0d
|
|
@ -12,6 +12,12 @@ repository. This repository *will not* depend on any other repos
|
|||
All components of an Istio installation operate on a shared vocabulary of attributes,
|
||||
as defined in this repo.
|
||||
|
||||
## Style guide
|
||||
|
||||
When designing proto-based APIs in the Istio project, please follow the
|
||||
[Istio API Style Guide](./STYLE-GUIDE.md).
|
||||
|
||||
## Updating
|
||||
|
||||
After the [protobuf](https://github.com/google/protobuf) definitions are updated, the corresponding `*pb.go` files must be generated by running `scripts/generate-protos.sh` and submitted as part of the same PR as the updated definitions.
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
# Istio API Style Guide
|
||||
|
||||
This page defines the design guidelines for Istio APIs. They apply to
|
||||
all proto files in the Istio project. Developers who create their APIs
|
||||
using Istio may find these guidelines useful as well.
|
||||
|
||||
Since Istio APIs are based on _proto3_ and _gRPC_, we will use
|
||||
Google's [API Design Guide](https://cloud.google.com/apis/design) as
|
||||
the baseline. Because Envoy APIs also uses the same baseline, the
|
||||
commonality across Envoy, Istio, proto3 and gRPC will greatly help
|
||||
developer experience in the long term.
|
||||
|
||||
In addition to Google's guide, the following conventions should be
|
||||
followed for Istio APIs.
|
||||
|
||||
## Versioning
|
||||
|
||||
When defining Kubernetes Custom Resource Definition (CRD) using
|
||||
proto3, the proto versioning should match the Kubernetes versioning,
|
||||
see the following example.
|
||||
|
||||
The Kubernetes CRD:
|
||||
|
||||
```yaml
|
||||
apiVersion: config.istio.io/v1alpha1
|
||||
kind: Authorization
|
||||
```
|
||||
|
||||
The proto message definition:
|
||||
```proto
|
||||
package istio.config.v1alpha1;
|
||||
message Authorization {...}
|
||||
```
|
||||
Loading…
Reference in New Issue