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/auth/authorizer/node
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/apps/v1
staging/src/k8s.io/api/apps/v1beta1

View File

@ -33,12 +33,14 @@ func Resource(resource string) schema.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 (
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
// SchemeBuilder points to a list of functions added to Scheme.
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
// AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme.
AddToScheme = localSchemeBuilder.AddToScheme
)
// Adds the list of known types to the given scheme.

View File

@ -33,12 +33,14 @@ func Resource(resource string) schema.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 (
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
// SchemeBuilder points to a list of functions added to Scheme.
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
// AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme.
AddToScheme = localSchemeBuilder.AddToScheme
)
// Adds the list of known types to the given scheme.

View File

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

View File

@ -63,6 +63,7 @@ type Rule struct {
Scope *ScopeType `json:"scope,omitempty" protobuf:"bytes,4,rep,name=scope"`
}
// ScopeType specifies a scope for a Rule.
type ScopeType string
const (
@ -75,6 +76,7 @@ const (
AllScopes ScopeType = "*"
)
// FailurePolicyType specifies a failure policy that defines how unrecognized errors from the admission endpoint are handled.
type FailurePolicyType string
const (
@ -84,16 +86,17 @@ const (
Fail FailurePolicyType = "Fail"
)
// MatchPolicyType specifies the type of match policy
// MatchPolicyType specifies the type of match policy.
type MatchPolicyType string
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"
// 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"
)
// SideEffectClass specifies the types of side effects a webhook may have.
type SideEffectClass string
const (
@ -472,6 +475,7 @@ type RuleWithOperations struct {
Rule `json:",inline" protobuf:"bytes,2,opt,name=rule"`
}
// OperationType specifies an operation for a request.
type OperationType string
// 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"
)
// GroupName is the group name for this API.
const GroupName = "admissionregistration.k8s.io"
// SchemeGroupVersion is group version used to register these objects
@ -32,12 +33,14 @@ func Resource(resource string) schema.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 (
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
// SchemeBuilder points to a list of functions added to Scheme.
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
// AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme.
AddToScheme = localSchemeBuilder.AddToScheme
)
// Adds the list of known types to scheme.

View File

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