Merge pull request #76882 from SataQiu/fix-golint-controller-20190422

Fix golint failures of pkg/controller/certificates/approver, etc
This commit is contained in:
Kubernetes Prow Robot 2019-05-02 03:16:18 -07:00 committed by GitHub
commit b07f311322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 12 additions and 16 deletions

View File

@ -59,7 +59,6 @@ pkg/cloudprovider/providers/photon
pkg/controller
pkg/controller/apis/config/v1alpha1
pkg/controller/certificates
pkg/controller/certificates/approver
pkg/controller/certificates/signer
pkg/controller/certificates/signer/config/v1alpha1
pkg/controller/cloud
@ -272,13 +271,11 @@ pkg/registry/networking/rest
pkg/registry/node/rest
pkg/registry/policy/poddisruptionbudget/storage
pkg/registry/policy/rest
pkg/registry/rbac/clusterrole
pkg/registry/rbac/clusterrole/policybased
pkg/registry/rbac/clusterrolebinding
pkg/registry/rbac/clusterrolebinding/policybased
pkg/registry/rbac/reconciliation
pkg/registry/rbac/rest
pkg/registry/rbac/role
pkg/registry/rbac/role/policybased
pkg/registry/rbac/rolebinding
pkg/registry/rbac/rolebinding/policybased
@ -339,7 +336,6 @@ pkg/volume/scaleio
pkg/volume/storageos
pkg/volume/testing
pkg/volume/util/fs
pkg/volume/util/recyclerclient
pkg/volume/util/volumepathhandler
pkg/volume/vsphere_volume
plugin/pkg/admission/antiaffinity

View File

@ -42,6 +42,7 @@ type sarApprover struct {
recognizers []csrRecognizer
}
// NewCSRApprovingController creates a new CSRApprovingController.
func NewCSRApprovingController(client clientset.Interface, csrInformer certificatesinformers.CertificateSigningRequestInformer) *certificates.CertificateController {
approver := &sarApprover{
client: client,

View File

@ -14,6 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package certificates provides Registry interface and its RESTStorage
// Package clusterrole provides Registry interface and its RESTStorage
// implementation for storing ClusterRole objects.
package clusterrole // import "k8s.io/kubernetes/pkg/registry/rbac/clusterrole"

View File

@ -61,6 +61,7 @@ type AuthorizerAdapter struct {
Registry Registry
}
// GetClusterRole returns the corresponding ClusterRole by name
func (a AuthorizerAdapter) GetClusterRole(name string) (*rbacv1.ClusterRole, error) {
return a.Registry.GetClusterRole(genericapirequest.NewContext(), name, &metav1.GetOptions{})
}

View File

@ -34,7 +34,7 @@ type strategy struct {
names.NameGenerator
}
// strategy is the default logic that applies when creating and updating
// Strategy is the default logic that applies when creating and updating
// ClusterRole objects.
var Strategy = strategy{legacyscheme.Scheme, names.SimpleNameGenerator}

View File

@ -14,6 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package certificates provides Registry interface and its RESTStorage
// Package role provides Registry interface and its RESTStorage
// implementation for storing Role objects.
package role // import "k8s.io/kubernetes/pkg/registry/rbac/role"

View File

@ -61,6 +61,7 @@ type AuthorizerAdapter struct {
Registry Registry
}
// GetRole returns the corresponding Role by name in specified namespace
func (a AuthorizerAdapter) GetRole(namespace, name string) (*rbacv1.Role, error) {
return a.Registry.GetRole(genericapirequest.WithNamespace(genericapirequest.NewContext(), namespace), name, &metav1.GetOptions{})
}

View File

@ -34,7 +34,7 @@ type strategy struct {
names.NameGenerator
}
// strategy is the default logic that applies when creating and updating
// Strategy is the default logic that applies when creating and updating
// Role objects.
var Strategy = strategy{legacyscheme.Scheme, names.SimpleNameGenerator}

View File

@ -29,6 +29,7 @@ import (
"k8s.io/klog"
)
// RecycleEventRecorder is a func that defines how to record RecycleEvent.
type RecycleEventRecorder func(eventtype, message string)
// RecycleVolumeByWatchingPodUntilCompletion is intended for use with volume
@ -127,9 +128,8 @@ func waitForPod(pod *v1.Pod, recyclerClient recyclerClient, podCh <-chan watch.E
if pod.Status.Phase == v1.PodFailed {
if pod.Status.Message != "" {
return fmt.Errorf(pod.Status.Message)
} else {
return fmt.Errorf("pod failed, pod.Status.Message unknown.")
}
return fmt.Errorf("pod failed, pod.Status.Message unknown")
}
case watch.Deleted:
@ -238,9 +238,8 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
case eventEvent, ok := <-eventWatch.ResultChan():
if !ok {
return
} else {
eventCh <- eventEvent
}
eventCh <- eventEvent
}
}
}()
@ -256,9 +255,8 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
case podEvent, ok := <-podWatch.ResultChan():
if !ok {
return
} else {
eventCh <- podEvent
}
eventCh <- podEvent
}
}
}()

View File

@ -210,9 +210,8 @@ func (c *mockRecyclerClient) CreatePod(pod *v1.Pod) (*v1.Pod, error) {
func (c *mockRecyclerClient) GetPod(name, namespace string) (*v1.Pod, error) {
if c.pod != nil {
return c.pod, nil
} else {
return nil, fmt.Errorf("pod does not exist")
}
return nil, fmt.Errorf("pod does not exist")
}
func (c *mockRecyclerClient) DeletePod(name, namespace string) error {