Use better error var name in kube-proxy code (#72849)

* Use better error var name  in  kube-proxy code

Signed-off-by: hchiramm <hchiramm@redhat.com>

* Unexport ErrReadOnlySysFS error variable

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Devassy Chirammal 2019-01-14 21:30:11 +05:30 committed by Kubernetes Prow Robot
parent 3ed638b233
commit a2daf66a0d
3 changed files with 8 additions and 8 deletions

View File

@ -211,7 +211,7 @@ func startPersistentVolumeBinderController(ctx ControllerContext) (http.Handler,
func startAttachDetachController(ctx ControllerContext) (http.Handler, bool, error) {
if ctx.ComponentConfig.AttachDetachController.ReconcilerSyncLoopPeriod.Duration < time.Second {
return nil, true, fmt.Errorf("Duration time must be greater than one second as set via command line option reconcile-sync-loop-period.")
return nil, true, fmt.Errorf("Duration time must be greater than one second as set via command line option reconcile-sync-loop-period")
}
csiClientConfig := ctx.ClientBuilder.ConfigOrDie("attachdetach-controller")
// csiClient works with CRDs that support json only

View File

@ -43,7 +43,7 @@ type Conntracker interface {
type realConntracker struct{}
var readOnlySysFSError = errors.New("readOnlySysFS")
var errReadOnlySysFS = errors.New("readOnlySysFS")
func (rct realConntracker) SetMax(max int) error {
if err := rct.setIntSysCtl("nf_conntrack_max", max); err != nil {
@ -70,14 +70,14 @@ func (rct realConntracker) SetMax(max int) error {
// issue (https://github.com/docker/docker/issues/24000). Setting
// conntrack will fail when sysfs is readonly. When that happens, we
// don't set conntrack hashsize and return a special error
// readOnlySysFSError here. The caller should deal with
// readOnlySysFSError differently.
// errReadOnlySysFS here. The caller should deal with
// errReadOnlySysFS differently.
writable, err := isSysFSWritable()
if err != nil {
return err
}
if !writable {
return readOnlySysFSError
return errReadOnlySysFS
}
// TODO: generify this and sysctl to a new sysfs.WriteInt()
klog.Infof("Setting conntrack hashsize to %d", max/4)
@ -126,7 +126,7 @@ func isSysFSWritable() (bool, error) {
}
klog.Errorf("sysfs is not writable: %+v (mount options are %v)",
mountPoint, mountPoint.Opts)
return false, readOnlySysFSError
return false, errReadOnlySysFS
}
return false, errors.New("No sysfs mounted")

View File

@ -550,10 +550,10 @@ func (s *ProxyServer) Run() error {
if max > 0 {
err := s.Conntracker.SetMax(max)
if err != nil {
if err != readOnlySysFSError {
if err != errReadOnlySysFS {
return err
}
// readOnlySysFSError is caused by a known docker issue (https://github.com/docker/docker/issues/24000),
// errReadOnlySysFS is caused by a known docker issue (https://github.com/docker/docker/issues/24000),
// the only remediation we know is to restart the docker daemon.
// Here we'll send an node event with specific reason and message, the
// administrator should decide whether and how to handle this issue,