-
Notifications
You must be signed in to change notification settings - Fork 573
Update STYLE-GUIDE.md #343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Mention the CRD kind must match proto message.
STYLE-GUIDE.md
Outdated
@@ -38,7 +38,8 @@ naming convention: | |||
## Versioning | |||
|
|||
When defining Kubernetes Custom Resource Definition (CRD) using | |||
proto3, the proto versioning should match the Kubernetes versioning, | |||
proto3, the proto versioning must match the Kubernetes versioning, | |||
and the proto message type must match the CRD kind name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should group names and version also be consistent with CRDs? We've defined versioned package in istio/api but these all map to the same CRD group and version (config.istio.io).
For example, does the following mapping make sense?
group = routing.api.istio.io
version = v1alpha2
kind = RouteRule
group = rbac.api.istio.io
version = v1alpha1
kind = ServiceRoleBinding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ayj this is exactly what I am proposing: https://groups.google.com/d/msg/istio-config/CzH6nRBT_o0/3lvIBao_AgAJ
I like this to be consistent with api group too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I should have made that more clear. The CRD apiVersion must match proto package name, minus the .io
suffix, and the ordering. I will update the text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are apiGroup. not apiVersion.
Mention `apiVersion` must match proto package.
STYLE-GUIDE.md
Outdated
* The proto `package` name must match the Kubernetes `apiVersion`, | ||
excluding the `.io` DNS suffix and reversing the DNS segment | ||
ordering. | ||
* The proto message type must match the CRD `kind` name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if its worth highlighting here, but the apiVersion
as shown in the YAML snippet is the concatenation of the Kubernetes API group and version. In the example below, config.istio.io
is the group and v1alpha
is the version of that group. Together they identify the versioned schema the object should have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe in the yaml example, listing out a full CRD definition. We probably also need to make rule that CRD resource name should be in format of plurals + api group.
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: serviceclasses.config.istio.io
spec:
group: config.istio.io
version: v1alpha1
names:
plural: serviceclasses
singular: serviceclass
kind: ServiceClass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we address this question in another PR? Let's make some incremental improvement first.
Explain apiVersion = group/version.
I addressed the concern of apiVersion vs group/version. |
@geeknoid Can you merge this PR? |
With this guidance, is it possible to create meta-APIs such as LROs? It looks like requiring 1-1 mapping between proto package name and apigroup seems to be work against this. |
@@ -38,8 +38,14 @@ naming convention: | |||
## Versioning | |||
|
|||
When defining Kubernetes Custom Resource Definition (CRD) using | |||
proto3, the proto versioning should match the Kubernetes versioning, | |||
see the following example. | |||
`proto3`, follow the following guidelines: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
, follow these guidelines:
@ozevren Doesn't the sentence "When defining Kubernetes Custom Resource Definition" cover the case you're worried about? LRO is specifically not a CRD. |
Meant to use LRO as an example. It is a meta-API. We're using CRDs to
create a public API surface (which happens to be backed by the API Server).
Adding this constraint implies you cannot create a meta set of protos to
use as top-level mix-in resources. And, it also means you cannot re-use
top-level CRD protos for another "API group" without violating this rule
(i.e. think of the Config Click Stop-0 we've been talking about).
…On Mon, Feb 5, 2018 at 11:08 AM, Martin Taillefer ***@***.***> wrote:
@ozevren <https://github.com/ozevren> Doesn't the sentence "When defining
Kubernetes Custom Resource Definition" cover the case you're worried about?
LRO is specifically not a CRD.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#343 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQR8I9wNNBBl6rar1jC8o1Cb8cQiurUHks5tR1GlgaJpZM4R2azS>
.
|
K8s APIs support watch semantics, which is equivalent to LRO. I don't think watch semantics is implemented by any api group. It is more like a design pattern. We need to address it next, but I don't think it is blocked by this discussion. |
Oz was using LRO as an example of a pattern, not as a specific case.
As stated right now, the guide doesn't allow for common definitions that
can be shared between multiple APIs because we are forcing a 1:1 mapping
pattern. We just need to add more nuance to the text to allow for those
cases.
…On Mon, Feb 5, 2018 at 1:31 PM, Hong Zhang ***@***.***> wrote:
K8s APIs support watch semantics, which is equivalent to LRO. I don't
think watch semantics is implemented by any api group. It is more like a
design pattern. We need to address it next, but I don't think it is blocked
by this discussion.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#343 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AVucHej-MOnpDo5l7o2QY3Fw194ibVMaks5tR3NHgaJpZM4R2azS>
.
|
I have no idea about LROs, but as such, I am not against this proposal for routing section. |
Can someone merge this PR or let me any further feedback? Thanks. |
* Update STYLE-GUIDE.md Mention the CRD kind must match proto message. * Update STYLE-GUIDE.md Mention `apiVersion` must match proto package. * Update STYLE-GUIDE.md Explain apiVersion = group/version.
* ApiManager uses ConfigManager to download the service config * Removed uncessary header file inclusion * Moved all initialization into Init() * Reverted copyright year to 2016 * Reverted copyright year to 2016 * Added a local auto variable for ServiceContext creation * Fixed backward compatibility * Added the rollout_strategy check * Added service_config argument to ConfigManager * Moved service_config_ variable to GlobalContext class * Fixed code formatting * Reverted storing service_config in GlobalContext * Renamed and changed data type of const * Moved callback function argument from constructor to Init
Adds configuration and API to support token exchange grants.
Mention the CRD kind must match proto message.