From 179e48c4bec99ed5ece670cd9119baa33e2afef1 Mon Sep 17 00:00:00 2001 From: Mike Spreitzer Date: Thu, 24 Jun 2021 13:51:31 -0400 Subject: [PATCH] Add missing comments in APF API types --- api/openapi-spec/swagger.json | 11 +++++++---- hack/.descriptions_failures | 2 -- pkg/apis/flowcontrol/types.go | 4 ++++ .../k8s.io/api/flowcontrol/v1alpha1/generated.proto | 4 ++++ staging/src/k8s.io/api/flowcontrol/v1alpha1/types.go | 4 ++++ .../v1alpha1/types_swagger_doc_generated.go | 7 +++++-- .../k8s.io/api/flowcontrol/v1beta1/generated.proto | 4 ++++ staging/src/k8s.io/api/flowcontrol/v1beta1/types.go | 4 ++++ .../v1beta1/types_swagger_doc_generated.go | 7 +++++-- 9 files changed, 37 insertions(+), 10 deletions(-) diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index b29164acefd..8b6e129b427 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -11098,17 +11098,20 @@ "description": "Subject matches the originator of a request, as identified by the request authentication system. There are three ways of matching an originator; by user, group, or service account.", "properties": { "group": { - "$ref": "#/definitions/io.k8s.api.flowcontrol.v1beta1.GroupSubject" + "$ref": "#/definitions/io.k8s.api.flowcontrol.v1beta1.GroupSubject", + "description": "`group` matches based on user group name." }, "kind": { - "description": "Required", + "description": "`kind` indicates which one of the other fields is non-empty. Required", "type": "string" }, "serviceAccount": { - "$ref": "#/definitions/io.k8s.api.flowcontrol.v1beta1.ServiceAccountSubject" + "$ref": "#/definitions/io.k8s.api.flowcontrol.v1beta1.ServiceAccountSubject", + "description": "`serviceAccount` matches ServiceAccounts." }, "user": { - "$ref": "#/definitions/io.k8s.api.flowcontrol.v1beta1.UserSubject" + "$ref": "#/definitions/io.k8s.api.flowcontrol.v1beta1.UserSubject", + "description": "`user` matches based on username." } }, "required": [ diff --git a/hack/.descriptions_failures b/hack/.descriptions_failures index 9843e847f7d..5d89d37803d 100644 --- a/hack/.descriptions_failures +++ b/hack/.descriptions_failures @@ -4,7 +4,5 @@ ./staging/src/k8s.io/api/certificates/v1/types.go ./staging/src/k8s.io/api/certificates/v1beta1/types.go ./staging/src/k8s.io/api/core/v1/types.go -./staging/src/k8s.io/api/flowcontrol/v1alpha1/types.go -./staging/src/k8s.io/api/flowcontrol/v1beta1/types.go ./staging/src/k8s.io/api/networking/v1/types.go ./staging/src/k8s.io/api/networking/v1beta1/types.go diff --git a/pkg/apis/flowcontrol/types.go b/pkg/apis/flowcontrol/types.go index 2d8553e6de2..546efc06587 100644 --- a/pkg/apis/flowcontrol/types.go +++ b/pkg/apis/flowcontrol/types.go @@ -171,13 +171,17 @@ type PolicyRulesWithSubjects struct { // ways of matching an originator; by user, group, or service account. // +union type Subject struct { + // `kind` indicates which one of the other fields is non-empty. // Required // +unionDiscriminator Kind SubjectKind + // `user` matches based on username. // +optional User *UserSubject + // `group` matches based on user group name. // +optional Group *GroupSubject + // `serviceAccount` matches ServiceAccounts. // +optional ServiceAccount *ServiceAccountSubject } diff --git a/staging/src/k8s.io/api/flowcontrol/v1alpha1/generated.proto b/staging/src/k8s.io/api/flowcontrol/v1alpha1/generated.proto index 7b19a273e54..2e0d0eae2aa 100644 --- a/staging/src/k8s.io/api/flowcontrol/v1alpha1/generated.proto +++ b/staging/src/k8s.io/api/flowcontrol/v1alpha1/generated.proto @@ -411,16 +411,20 @@ message ServiceAccountSubject { // ways of matching an originator; by user, group, or service account. // +union message Subject { + // `kind` indicates which one of the other fields is non-empty. // Required // +unionDiscriminator optional string kind = 1; + // `user` matches based on username. // +optional optional UserSubject user = 2; + // `group` matches based on user group name. // +optional optional GroupSubject group = 3; + // `serviceAccount` matches ServiceAccounts. // +optional optional ServiceAccountSubject serviceAccount = 4; } diff --git a/staging/src/k8s.io/api/flowcontrol/v1alpha1/types.go b/staging/src/k8s.io/api/flowcontrol/v1alpha1/types.go index 1e9701fc36c..afcc6fa34e6 100644 --- a/staging/src/k8s.io/api/flowcontrol/v1alpha1/types.go +++ b/staging/src/k8s.io/api/flowcontrol/v1alpha1/types.go @@ -185,13 +185,17 @@ type PolicyRulesWithSubjects struct { // ways of matching an originator; by user, group, or service account. // +union type Subject struct { + // `kind` indicates which one of the other fields is non-empty. // Required // +unionDiscriminator Kind SubjectKind `json:"kind" protobuf:"bytes,1,opt,name=kind"` + // `user` matches based on username. // +optional User *UserSubject `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"` + // `group` matches based on user group name. // +optional Group *GroupSubject `json:"group,omitempty" protobuf:"bytes,3,opt,name=group"` + // `serviceAccount` matches ServiceAccounts. // +optional ServiceAccount *ServiceAccountSubject `json:"serviceAccount,omitempty" protobuf:"bytes,4,opt,name=serviceAccount"` } diff --git a/staging/src/k8s.io/api/flowcontrol/v1alpha1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/flowcontrol/v1alpha1/types_swagger_doc_generated.go index 211d55e5e8b..8171360bbd3 100644 --- a/staging/src/k8s.io/api/flowcontrol/v1alpha1/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/api/flowcontrol/v1alpha1/types_swagger_doc_generated.go @@ -238,8 +238,11 @@ func (ServiceAccountSubject) SwaggerDoc() map[string]string { } var map_Subject = map[string]string{ - "": "Subject matches the originator of a request, as identified by the request authentication system. There are three ways of matching an originator; by user, group, or service account.", - "kind": "Required", + "": "Subject matches the originator of a request, as identified by the request authentication system. There are three ways of matching an originator; by user, group, or service account.", + "kind": "`kind` indicates which one of the other fields is non-empty. Required", + "user": "`user` matches based on username.", + "group": "`group` matches based on user group name.", + "serviceAccount": "`serviceAccount` matches ServiceAccounts.", } func (Subject) SwaggerDoc() map[string]string { diff --git a/staging/src/k8s.io/api/flowcontrol/v1beta1/generated.proto b/staging/src/k8s.io/api/flowcontrol/v1beta1/generated.proto index 9ddfc5465bd..40f441c5c26 100644 --- a/staging/src/k8s.io/api/flowcontrol/v1beta1/generated.proto +++ b/staging/src/k8s.io/api/flowcontrol/v1beta1/generated.proto @@ -411,16 +411,20 @@ message ServiceAccountSubject { // ways of matching an originator; by user, group, or service account. // +union message Subject { + // `kind` indicates which one of the other fields is non-empty. // Required // +unionDiscriminator optional string kind = 1; + // `user` matches based on username. // +optional optional UserSubject user = 2; + // `group` matches based on user group name. // +optional optional GroupSubject group = 3; + // `serviceAccount` matches ServiceAccounts. // +optional optional ServiceAccountSubject serviceAccount = 4; } diff --git a/staging/src/k8s.io/api/flowcontrol/v1beta1/types.go b/staging/src/k8s.io/api/flowcontrol/v1beta1/types.go index 673cde42dc7..c38021d6976 100644 --- a/staging/src/k8s.io/api/flowcontrol/v1beta1/types.go +++ b/staging/src/k8s.io/api/flowcontrol/v1beta1/types.go @@ -223,13 +223,17 @@ type PolicyRulesWithSubjects struct { // ways of matching an originator; by user, group, or service account. // +union type Subject struct { + // `kind` indicates which one of the other fields is non-empty. // Required // +unionDiscriminator Kind SubjectKind `json:"kind" protobuf:"bytes,1,opt,name=kind"` + // `user` matches based on username. // +optional User *UserSubject `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"` + // `group` matches based on user group name. // +optional Group *GroupSubject `json:"group,omitempty" protobuf:"bytes,3,opt,name=group"` + // `serviceAccount` matches ServiceAccounts. // +optional ServiceAccount *ServiceAccountSubject `json:"serviceAccount,omitempty" protobuf:"bytes,4,opt,name=serviceAccount"` } diff --git a/staging/src/k8s.io/api/flowcontrol/v1beta1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/flowcontrol/v1beta1/types_swagger_doc_generated.go index 8343a883f86..0f2f05e3a14 100644 --- a/staging/src/k8s.io/api/flowcontrol/v1beta1/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/api/flowcontrol/v1beta1/types_swagger_doc_generated.go @@ -238,8 +238,11 @@ func (ServiceAccountSubject) SwaggerDoc() map[string]string { } var map_Subject = map[string]string{ - "": "Subject matches the originator of a request, as identified by the request authentication system. There are three ways of matching an originator; by user, group, or service account.", - "kind": "Required", + "": "Subject matches the originator of a request, as identified by the request authentication system. There are three ways of matching an originator; by user, group, or service account.", + "kind": "`kind` indicates which one of the other fields is non-empty. Required", + "user": "`user` matches based on username.", + "group": "`group` matches based on user group name.", + "serviceAccount": "`serviceAccount` matches ServiceAccounts.", } func (Subject) SwaggerDoc() map[string]string {