mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
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:
parent
3ed638b233
commit
a2daf66a0d
@ -211,7 +211,7 @@ func startPersistentVolumeBinderController(ctx ControllerContext) (http.Handler,
|
|||||||
|
|
||||||
func startAttachDetachController(ctx ControllerContext) (http.Handler, bool, error) {
|
func startAttachDetachController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||||
if ctx.ComponentConfig.AttachDetachController.ReconcilerSyncLoopPeriod.Duration < time.Second {
|
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")
|
csiClientConfig := ctx.ClientBuilder.ConfigOrDie("attachdetach-controller")
|
||||||
// csiClient works with CRDs that support json only
|
// csiClient works with CRDs that support json only
|
||||||
|
@ -43,7 +43,7 @@ type Conntracker interface {
|
|||||||
|
|
||||||
type realConntracker struct{}
|
type realConntracker struct{}
|
||||||
|
|
||||||
var readOnlySysFSError = errors.New("readOnlySysFS")
|
var errReadOnlySysFS = errors.New("readOnlySysFS")
|
||||||
|
|
||||||
func (rct realConntracker) SetMax(max int) error {
|
func (rct realConntracker) SetMax(max int) error {
|
||||||
if err := rct.setIntSysCtl("nf_conntrack_max", max); err != nil {
|
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
|
// issue (https://github.com/docker/docker/issues/24000). Setting
|
||||||
// conntrack will fail when sysfs is readonly. When that happens, we
|
// conntrack will fail when sysfs is readonly. When that happens, we
|
||||||
// don't set conntrack hashsize and return a special error
|
// don't set conntrack hashsize and return a special error
|
||||||
// readOnlySysFSError here. The caller should deal with
|
// errReadOnlySysFS here. The caller should deal with
|
||||||
// readOnlySysFSError differently.
|
// errReadOnlySysFS differently.
|
||||||
writable, err := isSysFSWritable()
|
writable, err := isSysFSWritable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !writable {
|
if !writable {
|
||||||
return readOnlySysFSError
|
return errReadOnlySysFS
|
||||||
}
|
}
|
||||||
// TODO: generify this and sysctl to a new sysfs.WriteInt()
|
// TODO: generify this and sysctl to a new sysfs.WriteInt()
|
||||||
klog.Infof("Setting conntrack hashsize to %d", max/4)
|
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)",
|
klog.Errorf("sysfs is not writable: %+v (mount options are %v)",
|
||||||
mountPoint, mountPoint.Opts)
|
mountPoint, mountPoint.Opts)
|
||||||
return false, readOnlySysFSError
|
return false, errReadOnlySysFS
|
||||||
}
|
}
|
||||||
|
|
||||||
return false, errors.New("No sysfs mounted")
|
return false, errors.New("No sysfs mounted")
|
||||||
|
@ -550,10 +550,10 @@ func (s *ProxyServer) Run() error {
|
|||||||
if max > 0 {
|
if max > 0 {
|
||||||
err := s.Conntracker.SetMax(max)
|
err := s.Conntracker.SetMax(max)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != readOnlySysFSError {
|
if err != errReadOnlySysFS {
|
||||||
return err
|
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.
|
// the only remediation we know is to restart the docker daemon.
|
||||||
// Here we'll send an node event with specific reason and message, the
|
// Here we'll send an node event with specific reason and message, the
|
||||||
// administrator should decide whether and how to handle this issue,
|
// administrator should decide whether and how to handle this issue,
|
||||||
|
Loading…
Reference in New Issue
Block a user