Skip to content

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

Merged
merged 3 commits into from
Feb 9, 2018
Merged

Update STYLE-GUIDE.md #343

merged 3 commits into from
Feb 9, 2018

Conversation

wora
Copy link
Contributor

@wora wora commented Feb 1, 2018

Mention the CRD kind must match proto message.

Mention the CRD kind must match proto message.
@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Feb 1, 2018
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.
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.
Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor Author

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.
@wora
Copy link
Contributor Author

wora commented Feb 2, 2018

I addressed the concern of apiVersion vs group/version.

@wora
Copy link
Contributor Author

wora commented Feb 4, 2018

@geeknoid Can you merge this PR?

@ozevren
Copy link
Contributor

ozevren commented Feb 5, 2018

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

, follow these guidelines:

@geeknoid
Copy link
Contributor

geeknoid commented Feb 5, 2018

@ozevren Doesn't the sentence "When defining Kubernetes Custom Resource Definition" cover the case you're worried about? LRO is specifically not a CRD.

@ozevren
Copy link
Contributor

ozevren commented Feb 5, 2018 via email

@wora
Copy link
Contributor Author

wora commented Feb 5, 2018

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.

@geeknoid
Copy link
Contributor

geeknoid commented Feb 5, 2018 via email

@rshriram
Copy link
Member

rshriram commented Feb 5, 2018

I have no idea about LROs, but as such, I am not against this proposal for routing section.

@wora
Copy link
Contributor Author

wora commented Feb 9, 2018

Can someone merge this PR or let me any further feedback? Thanks.

@geeknoid geeknoid merged commit c68809c into istio:master Feb 9, 2018
@xiaolanz xiaolanz mentioned this pull request Feb 13, 2018
5 tasks
ayj pushed a commit to ayj/api that referenced this pull request Feb 14, 2018
* 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.
incfly pushed a commit to incfly/api that referenced this pull request Jun 13, 2018
* 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
nacx pushed a commit to nacx/api that referenced this pull request Feb 23, 2022
Adds configuration and API to support token exchange grants.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants