From cfc34712c2031adc1c61a070b10879edd5de4119 Mon Sep 17 00:00:00 2001 From: Roy Hvaara Date: Sun, 10 Nov 2019 00:22:51 +0100 Subject: [PATCH] Fix golint issues in pkg/registry/.../storage --- hack/.golint_failures | 13 ------------- .../certificates/certificates/storage/storage.go | 6 ++++-- pkg/registry/core/endpoint/storage/storage.go | 1 + pkg/registry/core/event/storage/storage.go | 1 + pkg/registry/core/limitrange/storage/storage.go | 3 ++- pkg/registry/core/node/storage/storage.go | 6 ++++-- .../core/persistentvolume/storage/storage.go | 2 ++ .../core/persistentvolumeclaim/storage/storage.go | 2 ++ pkg/registry/core/podtemplate/storage/storage.go | 1 + pkg/registry/core/resourcequota/storage/storage.go | 2 ++ .../networking/networkpolicy/storage/storage.go | 4 ++-- .../policy/poddisruptionbudget/storage/storage.go | 5 +++-- pkg/registry/settings/podpreset/storage/storage.go | 4 ++-- .../storage/storageclass/storage/storage.go | 3 ++- 14 files changed, 28 insertions(+), 25 deletions(-) diff --git a/hack/.golint_failures b/hack/.golint_failures index ebd0acbdea9..ba164d221d9 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -158,27 +158,18 @@ pkg/registry/autoscaling/rest pkg/registry/batch/job pkg/registry/batch/rest pkg/registry/certificates/certificates -pkg/registry/certificates/certificates/storage pkg/registry/certificates/rest pkg/registry/coordination/rest pkg/registry/core/componentstatus -pkg/registry/core/endpoint/storage -pkg/registry/core/event/storage -pkg/registry/core/limitrange/storage pkg/registry/core/namespace pkg/registry/core/namespace/storage pkg/registry/core/node -pkg/registry/core/node/storage pkg/registry/core/persistentvolume -pkg/registry/core/persistentvolume/storage pkg/registry/core/persistentvolumeclaim -pkg/registry/core/persistentvolumeclaim/storage pkg/registry/core/pod pkg/registry/core/pod/rest -pkg/registry/core/podtemplate/storage pkg/registry/core/replicationcontroller pkg/registry/core/replicationcontroller/storage -pkg/registry/core/resourcequota/storage pkg/registry/core/rest pkg/registry/core/secret pkg/registry/core/secret/storage @@ -194,10 +185,8 @@ pkg/registry/events/rest pkg/registry/extensions/controller/storage pkg/registry/extensions/rest pkg/registry/flowcontrol/rest -pkg/registry/networking/networkpolicy/storage pkg/registry/networking/rest pkg/registry/node/rest -pkg/registry/policy/poddisruptionbudget/storage pkg/registry/policy/rest pkg/registry/rbac/clusterrole/policybased pkg/registry/rbac/clusterrolebinding @@ -210,11 +199,9 @@ pkg/registry/rbac/rolebinding/policybased pkg/registry/rbac/validation pkg/registry/registrytest pkg/registry/scheduling/rest -pkg/registry/settings/podpreset/storage pkg/registry/settings/rest pkg/registry/storage/rest pkg/registry/storage/storageclass -pkg/registry/storage/storageclass/storage pkg/scheduler/apis/config/v1alpha1 pkg/security/podsecuritypolicy pkg/security/podsecuritypolicy/group diff --git a/pkg/registry/certificates/certificates/storage/storage.go b/pkg/registry/certificates/certificates/storage/storage.go index e7168204439..cda697fda55 100644 --- a/pkg/registry/certificates/certificates/storage/storage.go +++ b/pkg/registry/certificates/certificates/storage/storage.go @@ -31,12 +31,12 @@ import ( csrregistry "k8s.io/kubernetes/pkg/registry/certificates/certificates" ) -// REST implements a RESTStorage for CertificateSigningRequest +// REST implements a RESTStorage for CertificateSigningRequest. type REST struct { *genericregistry.Store } -// NewREST returns a registry which will store CertificateSigningRequest in the given helper +// NewREST returns a registry which will store CertificateSigningRequest in the given helper. func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST, *ApprovalREST, error) { store := &genericregistry.Store{ NewFunc: func() runtime.Object { return &certificates.CertificateSigningRequest{} }, @@ -80,6 +80,7 @@ type StatusREST struct { store *genericregistry.Store } +// New creates a new CertificateSigningRequest object. func (r *StatusREST) New() runtime.Object { return &certificates.CertificateSigningRequest{} } @@ -103,6 +104,7 @@ type ApprovalREST struct { store *genericregistry.Store } +// New creates a new CertificateSigningRequest object. func (r *ApprovalREST) New() runtime.Object { return &certificates.CertificateSigningRequest{} } diff --git a/pkg/registry/core/endpoint/storage/storage.go b/pkg/registry/core/endpoint/storage/storage.go index ee11e09aa6a..ff082994cea 100644 --- a/pkg/registry/core/endpoint/storage/storage.go +++ b/pkg/registry/core/endpoint/storage/storage.go @@ -28,6 +28,7 @@ import ( "k8s.io/kubernetes/pkg/registry/core/endpoint" ) +// REST implements a RESTStorage for endpoints. type REST struct { *genericregistry.Store } diff --git a/pkg/registry/core/event/storage/storage.go b/pkg/registry/core/event/storage/storage.go index 66db6060893..a7669cd681a 100644 --- a/pkg/registry/core/event/storage/storage.go +++ b/pkg/registry/core/event/storage/storage.go @@ -28,6 +28,7 @@ import ( "k8s.io/kubernetes/pkg/registry/core/event" ) +// REST implements a RESTStorage for events. type REST struct { *genericregistry.Store } diff --git a/pkg/registry/core/limitrange/storage/storage.go b/pkg/registry/core/limitrange/storage/storage.go index 0315e4fa7ce..dac160ea96a 100644 --- a/pkg/registry/core/limitrange/storage/storage.go +++ b/pkg/registry/core/limitrange/storage/storage.go @@ -25,11 +25,12 @@ import ( "k8s.io/kubernetes/pkg/registry/core/limitrange" ) +// REST implements a RESTStorage for limit ranges. type REST struct { *genericregistry.Store } -// NewREST returns a RESTStorage object that will work against limitranges. +// NewREST returns a RESTStorage object that will work against limit ranges. func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) { store := &genericregistry.Store{ NewFunc: func() runtime.Object { return &api.LimitRange{} }, diff --git a/pkg/registry/core/node/storage/storage.go b/pkg/registry/core/node/storage/storage.go index 00c648ce1b3..2716190f2b0 100644 --- a/pkg/registry/core/node/storage/storage.go +++ b/pkg/registry/core/node/storage/storage.go @@ -22,7 +22,7 @@ import ( "net/http" "net/url" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apiserver/pkg/registry/generic" @@ -39,7 +39,7 @@ import ( noderest "k8s.io/kubernetes/pkg/registry/core/node/rest" ) -// NodeStorage includes storage for nodes and all sub resources +// NodeStorage includes storage for nodes and all sub resources. type NodeStorage struct { Node *REST Status *StatusREST @@ -48,6 +48,7 @@ type NodeStorage struct { KubeletConnectionInfo client.ConnectionInfoGetter } +// REST implements a RESTStorage for nodes. type REST struct { *genericregistry.Store connection client.ConnectionInfoGetter @@ -59,6 +60,7 @@ type StatusREST struct { store *genericregistry.Store } +// New creates a new Node object. func (r *StatusREST) New() runtime.Object { return &api.Node{} } diff --git a/pkg/registry/core/persistentvolume/storage/storage.go b/pkg/registry/core/persistentvolume/storage/storage.go index eeeb471c930..6b4cec9819a 100644 --- a/pkg/registry/core/persistentvolume/storage/storage.go +++ b/pkg/registry/core/persistentvolume/storage/storage.go @@ -31,6 +31,7 @@ import ( "k8s.io/kubernetes/pkg/registry/core/persistentvolume" ) +// REST implements a RESTStorage for persistent volumes. type REST struct { *genericregistry.Store } @@ -74,6 +75,7 @@ type StatusREST struct { store *genericregistry.Store } +// New creates a new PersistentVolume object. func (r *StatusREST) New() runtime.Object { return &api.PersistentVolume{} } diff --git a/pkg/registry/core/persistentvolumeclaim/storage/storage.go b/pkg/registry/core/persistentvolumeclaim/storage/storage.go index bf18473e400..560b7264371 100644 --- a/pkg/registry/core/persistentvolumeclaim/storage/storage.go +++ b/pkg/registry/core/persistentvolumeclaim/storage/storage.go @@ -31,6 +31,7 @@ import ( "k8s.io/kubernetes/pkg/registry/core/persistentvolumeclaim" ) +// REST implements a RESTStorage for persistent volume claims. type REST struct { *genericregistry.Store } @@ -74,6 +75,7 @@ type StatusREST struct { store *genericregistry.Store } +// New creates a new PersistentVolumeClaim object. func (r *StatusREST) New() runtime.Object { return &api.PersistentVolumeClaim{} } diff --git a/pkg/registry/core/podtemplate/storage/storage.go b/pkg/registry/core/podtemplate/storage/storage.go index 495e0994a5c..624290c067b 100644 --- a/pkg/registry/core/podtemplate/storage/storage.go +++ b/pkg/registry/core/podtemplate/storage/storage.go @@ -27,6 +27,7 @@ import ( "k8s.io/kubernetes/pkg/registry/core/podtemplate" ) +// REST implements a RESTStorage for pod templates. type REST struct { *genericregistry.Store } diff --git a/pkg/registry/core/resourcequota/storage/storage.go b/pkg/registry/core/resourcequota/storage/storage.go index 6af4444a4a3..231c80a586c 100644 --- a/pkg/registry/core/resourcequota/storage/storage.go +++ b/pkg/registry/core/resourcequota/storage/storage.go @@ -28,6 +28,7 @@ import ( "k8s.io/kubernetes/pkg/registry/core/resourcequota" ) +// REST implements a RESTStorage for resource quotas. type REST struct { *genericregistry.Store } @@ -68,6 +69,7 @@ type StatusREST struct { store *genericregistry.Store } +// New creates a new ResourceQuota object. func (r *StatusREST) New() runtime.Object { return &api.ResourceQuota{} } diff --git a/pkg/registry/networking/networkpolicy/storage/storage.go b/pkg/registry/networking/networkpolicy/storage/storage.go index 93e200c7a31..15ce38032d0 100644 --- a/pkg/registry/networking/networkpolicy/storage/storage.go +++ b/pkg/registry/networking/networkpolicy/storage/storage.go @@ -28,12 +28,12 @@ import ( "k8s.io/kubernetes/pkg/registry/networking/networkpolicy" ) -// rest implements a RESTStorage for NetworkPolicies against etcd +// REST implements a RESTStorage for NetworkPolicies against etcd. type REST struct { *genericregistry.Store } -// NewREST returns a RESTStorage object that will work against NetworkPolicies +// NewREST returns a RESTStorage object that will work against NetworkPolicies. func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) { store := &genericregistry.Store{ NewFunc: func() runtime.Object { return &networkingapi.NetworkPolicy{} }, diff --git a/pkg/registry/policy/poddisruptionbudget/storage/storage.go b/pkg/registry/policy/poddisruptionbudget/storage/storage.go index 8e13b902d43..687baaafd5a 100644 --- a/pkg/registry/policy/poddisruptionbudget/storage/storage.go +++ b/pkg/registry/policy/poddisruptionbudget/storage/storage.go @@ -31,7 +31,7 @@ import ( "k8s.io/kubernetes/pkg/registry/policy/poddisruptionbudget" ) -// rest implements a RESTStorage for pod disruption budgets against etcd +// REST implements a RESTStorage for pod disruption budgets against etcd. type REST struct { *genericregistry.Store } @@ -64,11 +64,12 @@ func (r *REST) ShortNames() []string { return []string{"pdb"} } -// StatusREST implements the REST endpoint for changing the status of an podDisruptionBudget +// StatusREST implements the REST endpoint for changing the status of an podDisruptionBudget. type StatusREST struct { store *genericregistry.Store } +// New creates a new PodDisruptionBudget object. func (r *StatusREST) New() runtime.Object { return &policyapi.PodDisruptionBudget{} } diff --git a/pkg/registry/settings/podpreset/storage/storage.go b/pkg/registry/settings/podpreset/storage/storage.go index 38d7b6885a7..c2a7224db43 100644 --- a/pkg/registry/settings/podpreset/storage/storage.go +++ b/pkg/registry/settings/podpreset/storage/storage.go @@ -24,12 +24,12 @@ import ( "k8s.io/kubernetes/pkg/registry/settings/podpreset" ) -// rest implements a RESTStorage for replication controllers against etcd +// REST implements a RESTStorage for pod presets against etcd. type REST struct { *genericregistry.Store } -// NewREST returns a RESTStorage object that will work against replication controllers. +// NewREST returns a RESTStorage object that will work against pod presets. func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) { store := &genericregistry.Store{ NewFunc: func() runtime.Object { return &settingsapi.PodPreset{} }, diff --git a/pkg/registry/storage/storageclass/storage/storage.go b/pkg/registry/storage/storageclass/storage/storage.go index 40ccf276cb0..fb4394e6641 100644 --- a/pkg/registry/storage/storageclass/storage/storage.go +++ b/pkg/registry/storage/storageclass/storage/storage.go @@ -28,11 +28,12 @@ import ( "k8s.io/kubernetes/pkg/registry/storage/storageclass" ) +// REST implements a RESTStorage for storage classes. type REST struct { *genericregistry.Store } -// NewREST returns a RESTStorage object that will work against persistent volumes. +// NewREST returns a RESTStorage object that will work against storage classes. func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) { store := &genericregistry.Store{ NewFunc: func() runtime.Object { return &storageapi.StorageClass{} },