Fix golint issues in api/admission and api/admissionregistration

This commit is contained in:
Gurleen Grewal 2020-12-22 11:29:47 -08:00
parent 4351e4dd47
commit 73f24d6beb
7 changed files with 32 additions and 18 deletions

View File

@ -191,10 +191,6 @@ plugin/pkg/admission/eventratelimit/apis/eventratelimit/v1alpha1
plugin/pkg/admission/limitranger plugin/pkg/admission/limitranger
plugin/pkg/auth/authorizer/node plugin/pkg/auth/authorizer/node
plugin/pkg/auth/authorizer/rbac plugin/pkg/auth/authorizer/rbac
staging/src/k8s.io/api/admission/v1
staging/src/k8s.io/api/admission/v1beta1
staging/src/k8s.io/api/admissionregistration/v1
staging/src/k8s.io/api/admissionregistration/v1beta1
staging/src/k8s.io/api/apiserverinternal/v1alpha1 staging/src/k8s.io/api/apiserverinternal/v1alpha1
staging/src/k8s.io/api/apps/v1 staging/src/k8s.io/api/apps/v1
staging/src/k8s.io/api/apps/v1beta1 staging/src/k8s.io/api/apps/v1beta1

View File

@ -33,11 +33,13 @@ func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource() return SchemeGroupVersion.WithResource(resource).GroupResource()
} }
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
var ( var (
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. // SchemeBuilder points to a list of functions added to Scheme.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder localSchemeBuilder = &SchemeBuilder
// AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme.
AddToScheme = localSchemeBuilder.AddToScheme AddToScheme = localSchemeBuilder.AddToScheme
) )

View File

@ -33,11 +33,13 @@ func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource() return SchemeGroupVersion.WithResource(resource).GroupResource()
} }
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
var ( var (
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. // SchemeBuilder points to a list of functions added to Scheme.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder localSchemeBuilder = &SchemeBuilder
// AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme.
AddToScheme = localSchemeBuilder.AddToScheme AddToScheme = localSchemeBuilder.AddToScheme
) )

View File

@ -22,6 +22,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
) )
// GroupName is the group name for this API.
const GroupName = "admissionregistration.k8s.io" const GroupName = "admissionregistration.k8s.io"
// SchemeGroupVersion is group version used to register these objects // SchemeGroupVersion is group version used to register these objects
@ -32,11 +33,13 @@ func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource() return SchemeGroupVersion.WithResource(resource).GroupResource()
} }
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
var ( var (
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. // SchemeBuilder points to a list of functions added to Scheme.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder localSchemeBuilder = &SchemeBuilder
// AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme.
AddToScheme = localSchemeBuilder.AddToScheme AddToScheme = localSchemeBuilder.AddToScheme
) )

View File

@ -63,6 +63,7 @@ type Rule struct {
Scope *ScopeType `json:"scope,omitempty" protobuf:"bytes,4,rep,name=scope"` Scope *ScopeType `json:"scope,omitempty" protobuf:"bytes,4,rep,name=scope"`
} }
// ScopeType specifies a scope for a Rule.
type ScopeType string type ScopeType string
const ( const (
@ -75,6 +76,7 @@ const (
AllScopes ScopeType = "*" AllScopes ScopeType = "*"
) )
// FailurePolicyType specifies a failure policy that defines how unrecognized errors from the admission endpoint are handled.
type FailurePolicyType string type FailurePolicyType string
const ( const (
@ -84,16 +86,17 @@ const (
Fail FailurePolicyType = "Fail" Fail FailurePolicyType = "Fail"
) )
// MatchPolicyType specifies the type of match policy // MatchPolicyType specifies the type of match policy.
type MatchPolicyType string type MatchPolicyType string
const ( const (
// Exact means requests should only be sent to the webhook if they exactly match a given rule // Exact means requests should only be sent to the webhook if they exactly match a given rule.
Exact MatchPolicyType = "Exact" Exact MatchPolicyType = "Exact"
// Equivalent means requests should be sent to the webhook if they modify a resource listed in rules via another API group or version. // Equivalent means requests should be sent to the webhook if they modify a resource listed in rules via another API group or version.
Equivalent MatchPolicyType = "Equivalent" Equivalent MatchPolicyType = "Equivalent"
) )
// SideEffectClass specifies the types of side effects a webhook may have.
type SideEffectClass string type SideEffectClass string
const ( const (
@ -472,6 +475,7 @@ type RuleWithOperations struct {
Rule `json:",inline" protobuf:"bytes,2,opt,name=rule"` Rule `json:",inline" protobuf:"bytes,2,opt,name=rule"`
} }
// OperationType specifies an operation for a request.
type OperationType string type OperationType string
// The constants should be kept in sync with those defined in k8s.io/kubernetes/pkg/admission/interface.go. // The constants should be kept in sync with those defined in k8s.io/kubernetes/pkg/admission/interface.go.

View File

@ -22,6 +22,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
) )
// GroupName is the group name for this API.
const GroupName = "admissionregistration.k8s.io" const GroupName = "admissionregistration.k8s.io"
// SchemeGroupVersion is group version used to register these objects // SchemeGroupVersion is group version used to register these objects
@ -32,11 +33,13 @@ func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource() return SchemeGroupVersion.WithResource(resource).GroupResource()
} }
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
var ( var (
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. // SchemeBuilder points to a list of functions added to Scheme.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder localSchemeBuilder = &SchemeBuilder
// AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme.
AddToScheme = localSchemeBuilder.AddToScheme AddToScheme = localSchemeBuilder.AddToScheme
) )

View File

@ -63,6 +63,7 @@ type Rule struct {
Scope *ScopeType `json:"scope,omitempty" protobuf:"bytes,4,rep,name=scope"` Scope *ScopeType `json:"scope,omitempty" protobuf:"bytes,4,rep,name=scope"`
} }
// ScopeType specifies a scope for a Rule.
type ScopeType string type ScopeType string
const ( const (
@ -75,6 +76,7 @@ const (
AllScopes ScopeType = "*" AllScopes ScopeType = "*"
) )
// FailurePolicyType specifies a failure policy that defines how unrecognized errors from the admission endpoint are handled.
type FailurePolicyType string type FailurePolicyType string
const ( const (
@ -94,6 +96,7 @@ const (
Equivalent MatchPolicyType = "Equivalent" Equivalent MatchPolicyType = "Equivalent"
) )
// SideEffectClass specifies the types of side effects a webhook may have.
type SideEffectClass string type SideEffectClass string
const ( const (
@ -496,6 +499,7 @@ type RuleWithOperations struct {
Rule `json:",inline" protobuf:"bytes,2,opt,name=rule"` Rule `json:",inline" protobuf:"bytes,2,opt,name=rule"`
} }
// OperationType specifies an operation for a request.
type OperationType string type OperationType string
// The constants should be kept in sync with those defined in k8s.io/kubernetes/pkg/admission/interface.go. // The constants should be kept in sync with those defined in k8s.io/kubernetes/pkg/admission/interface.go.