mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
Merge pull request #76882 from SataQiu/fix-golint-controller-20190422
Fix golint failures of pkg/controller/certificates/approver, etc
This commit is contained in:
commit
b07f311322
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
@ -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{})
|
||||
}
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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{})
|
||||
}
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user