mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
Merge pull request #78232 from SataQiu/fix-golint-20190523
Fix golint failures of pkg/controller/namespace/deletion pkg/controller/serviceaccount
This commit is contained in:
commit
501092c7d0
@ -70,7 +70,6 @@ pkg/controller/job
|
|||||||
pkg/controller/job/config/v1alpha1
|
pkg/controller/job/config/v1alpha1
|
||||||
pkg/controller/namespace
|
pkg/controller/namespace
|
||||||
pkg/controller/namespace/config/v1alpha1
|
pkg/controller/namespace/config/v1alpha1
|
||||||
pkg/controller/namespace/deletion
|
|
||||||
pkg/controller/nodeipam/config/v1alpha1
|
pkg/controller/nodeipam/config/v1alpha1
|
||||||
pkg/controller/nodelifecycle/config/v1alpha1
|
pkg/controller/nodelifecycle/config/v1alpha1
|
||||||
pkg/controller/podautoscaler
|
pkg/controller/podautoscaler
|
||||||
@ -87,7 +86,6 @@ pkg/controller/resourcequota/config/v1alpha1
|
|||||||
pkg/controller/route
|
pkg/controller/route
|
||||||
pkg/controller/service
|
pkg/controller/service
|
||||||
pkg/controller/service/config/v1alpha1
|
pkg/controller/service/config/v1alpha1
|
||||||
pkg/controller/serviceaccount
|
|
||||||
pkg/controller/serviceaccount/config/v1alpha1
|
pkg/controller/serviceaccount/config/v1alpha1
|
||||||
pkg/controller/statefulset
|
pkg/controller/statefulset
|
||||||
pkg/controller/ttl
|
pkg/controller/ttl
|
||||||
|
@ -37,11 +37,12 @@ import (
|
|||||||
v1clientset "k8s.io/client-go/kubernetes/typed/core/v1"
|
v1clientset "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Interface to delete a namespace with all resources in it.
|
// NamespacedResourcesDeleterInterface is the interface to delete a namespace with all resources in it.
|
||||||
type NamespacedResourcesDeleterInterface interface {
|
type NamespacedResourcesDeleterInterface interface {
|
||||||
Delete(nsName string) error
|
Delete(nsName string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewNamespacedResourcesDeleter returns a new NamespacedResourcesDeleter.
|
||||||
func NewNamespacedResourcesDeleter(nsClient v1clientset.NamespaceInterface,
|
func NewNamespacedResourcesDeleter(nsClient v1clientset.NamespaceInterface,
|
||||||
dynamicClient dynamic.Interface, podsGetter v1clientset.PodsGetter,
|
dynamicClient dynamic.Interface, podsGetter v1clientset.PodsGetter,
|
||||||
discoverResourcesFn func() ([]*metav1.APIResourceList, error),
|
discoverResourcesFn func() ([]*metav1.APIResourceList, error),
|
||||||
|
@ -213,7 +213,7 @@ func TestRetryOnConflictError(t *testing.T) {
|
|||||||
retryOnce := func(namespace *v1.Namespace) (*v1.Namespace, error) {
|
retryOnce := func(namespace *v1.Namespace) (*v1.Namespace, error) {
|
||||||
numTries++
|
numTries++
|
||||||
if numTries <= 1 {
|
if numTries <= 1 {
|
||||||
return namespace, errors.NewConflict(api.Resource("namespaces"), namespace.Name, fmt.Errorf("ERROR!"))
|
return namespace, errors.NewConflict(api.Resource("namespaces"), namespace.Name, fmt.Errorf("ERROR"))
|
||||||
}
|
}
|
||||||
return namespace, nil
|
return namespace, nil
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ type ServiceAccountsControllerOptions struct {
|
|||||||
NamespaceResync time.Duration
|
NamespaceResync time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DefaultServiceAccountsControllerOptions returns the default options for creating a ServiceAccountsController.
|
||||||
func DefaultServiceAccountsControllerOptions() ServiceAccountsControllerOptions {
|
func DefaultServiceAccountsControllerOptions() ServiceAccountsControllerOptions {
|
||||||
return ServiceAccountsControllerOptions{
|
return ServiceAccountsControllerOptions{
|
||||||
ServiceAccounts: []v1.ServiceAccount{
|
ServiceAccounts: []v1.ServiceAccount{
|
||||||
@ -108,6 +109,7 @@ type ServiceAccountsController struct {
|
|||||||
queue workqueue.RateLimitingInterface
|
queue workqueue.RateLimitingInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run runs the ServiceAccountsController blocks until receiving signal from stopCh.
|
||||||
func (c *ServiceAccountsController) Run(workers int, stopCh <-chan struct{}) {
|
func (c *ServiceAccountsController) Run(workers int, stopCh <-chan struct{}) {
|
||||||
defer utilruntime.HandleCrash()
|
defer utilruntime.HandleCrash()
|
||||||
defer c.queue.ShutDown()
|
defer c.queue.ShutDown()
|
||||||
|
@ -162,7 +162,7 @@ type TokensController struct {
|
|||||||
maxRetries int
|
maxRetries int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runs controller blocks until stopCh is closed
|
// Run runs controller blocks until stopCh is closed
|
||||||
func (e *TokensController) Run(workers int, stopCh <-chan struct{}) {
|
func (e *TokensController) Run(workers int, stopCh <-chan struct{}) {
|
||||||
// Shut down queues
|
// Shut down queues
|
||||||
defer utilruntime.HandleCrash()
|
defer utilruntime.HandleCrash()
|
||||||
|
Loading…
Reference in New Issue
Block a user