Merge pull request #58103 from php-coder/describe_group_and_version_fields

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add comments for explaining the group/version fields

**What this PR does / why we need it**:
This PR adds comments for explaining group/version fields. This is my understanding of what @deads2k told me today. Please, correct me if I'm wrong or you see how it can be further improved.

I didn't find where it's documented, so I hope that this PR makes it easy for other new contributors addition of new APIs.

**Release note**:
```release-note
NONE
```

PTAL @deads2k 
CC @simo5
pull/6/head
Kubernetes Submit Queue 2018-01-15 06:37:36 -08:00 committed by GitHub
commit e290741719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -187,8 +187,12 @@ func makeAPIServiceAvailableHealthzCheck(name string, apiServices []*apiregistra
}) })
} }
// priority defines group priority that is used in discovery. This controls
// group position in the kubectl output.
type priority struct { type priority struct {
// group indicates the order of the group relative to other groups.
group int32 group int32
// version indicates the relative order of the version inside of its group.
version int32 version int32
} }
@ -229,6 +233,9 @@ var apiVersionPriorities = map[schema.GroupVersion]priority{
{Group: "admissionregistration.k8s.io", Version: "v1beta1"}: {group: 16700, version: 12}, {Group: "admissionregistration.k8s.io", Version: "v1beta1"}: {group: 16700, version: 12},
{Group: "admissionregistration.k8s.io", Version: "v1alpha1"}: {group: 16700, version: 9}, {Group: "admissionregistration.k8s.io", Version: "v1alpha1"}: {group: 16700, version: 9},
{Group: "scheduling.k8s.io", Version: "v1alpha1"}: {group: 16600, version: 9}, {Group: "scheduling.k8s.io", Version: "v1alpha1"}: {group: 16600, version: 9},
// Append a new group to the end of the list if unsure.
// You can use min(existing group)-100 as the initial value for a group.
// Version can be set to 9 (to have space around) for a new group.
} }
func apiServicesToRegister(delegateAPIServer genericapiserver.DelegationTarget, registration autoregister.AutoAPIServiceRegistration) []*apiregistration.APIService { func apiServicesToRegister(delegateAPIServer genericapiserver.DelegationTarget, registration autoregister.AutoAPIServiceRegistration) []*apiregistration.APIService {