diff --git a/hack/.golint_failures b/hack/.golint_failures index 4bf27a9e744..0c2c582ef37 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -15,8 +15,6 @@ pkg/apis/apps/v1beta1 pkg/apis/apps/v1beta2 pkg/apis/auditregistration/v1alpha1 pkg/apis/authentication/v1 -pkg/apis/authorization/v1 -pkg/apis/authorization/validation pkg/apis/autoscaling/v1 pkg/apis/autoscaling/v2beta1 pkg/apis/autoscaling/v2beta2 diff --git a/pkg/apis/authorization/v1/register.go b/pkg/apis/authorization/v1/register.go index 7e7531323ff..2f6865b4286 100644 --- a/pkg/apis/authorization/v1/register.go +++ b/pkg/apis/authorization/v1/register.go @@ -33,8 +33,11 @@ func Resource(resource string) schema.GroupResource { } var ( + // localSchemeBuilder extends the SchemeBuilder instance with the external types. In this package, + // defaulting and conversion init funcs are registered as well. localSchemeBuilder = &authorizationv1.SchemeBuilder - AddToScheme = localSchemeBuilder.AddToScheme + // AddToScheme is a global function that registers this API group & version to a scheme + AddToScheme = localSchemeBuilder.AddToScheme ) func init() { diff --git a/pkg/apis/authorization/validation/validation.go b/pkg/apis/authorization/validation/validation.go index 4179b8274b6..41e39362065 100644 --- a/pkg/apis/authorization/validation/validation.go +++ b/pkg/apis/authorization/validation/validation.go @@ -23,6 +23,8 @@ import ( authorizationapi "k8s.io/kubernetes/pkg/apis/authorization" ) +// ValidateSubjectAccessReviewSpec validates a SubjectAccessReviewSpec and returns an +// ErrorList with any errors. func ValidateSubjectAccessReviewSpec(spec authorizationapi.SubjectAccessReviewSpec, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if spec.ResourceAttributes != nil && spec.NonResourceAttributes != nil { @@ -38,6 +40,8 @@ func ValidateSubjectAccessReviewSpec(spec authorizationapi.SubjectAccessReviewSp return allErrs } +// ValidateSelfSubjectAccessReviewSpec validates a SelfSubjectAccessReviewSpec and returns an +// ErrorList with any errors. func ValidateSelfSubjectAccessReviewSpec(spec authorizationapi.SelfSubjectAccessReviewSpec, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if spec.ResourceAttributes != nil && spec.NonResourceAttributes != nil { @@ -50,10 +54,14 @@ func ValidateSelfSubjectAccessReviewSpec(spec authorizationapi.SelfSubjectAccess return allErrs } +// ValidateSelfSubjectRulesReview validates a SelfSubjectRulesReview and returns an +// ErrorList with any errors. func ValidateSelfSubjectRulesReview(review *authorizationapi.SelfSubjectRulesReview) field.ErrorList { return field.ErrorList{} } +// ValidateSubjectAccessReview validates a SubjectAccessReview and returns an +// ErrorList with any errors. func ValidateSubjectAccessReview(sar *authorizationapi.SubjectAccessReview) field.ErrorList { allErrs := ValidateSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec")) objectMetaShallowCopy := sar.ObjectMeta @@ -64,6 +72,8 @@ func ValidateSubjectAccessReview(sar *authorizationapi.SubjectAccessReview) fiel return allErrs } +// ValidateSelfSubjectAccessReview validates a SelfSubjectAccessReview and returns an +// ErrorList with any errors. func ValidateSelfSubjectAccessReview(sar *authorizationapi.SelfSubjectAccessReview) field.ErrorList { allErrs := ValidateSelfSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec")) objectMetaShallowCopy := sar.ObjectMeta @@ -74,6 +84,8 @@ func ValidateSelfSubjectAccessReview(sar *authorizationapi.SelfSubjectAccessRevi return allErrs } +// ValidateLocalSubjectAccessReview validates a LocalSubjectAccessReview and returns an +// ErrorList with any errors. func ValidateLocalSubjectAccessReview(sar *authorizationapi.LocalSubjectAccessReview) field.ErrorList { allErrs := ValidateSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec"))