Adds filtering of hosts to DialContexts.

The provided DialContext wraps existing clients' DialContext in an attempt to
preserve any existing timeout configuration. In some cases, we may replace
infinite timeouts with golang defaults.

- scaleio: tcp connect/keepalive values changed from 0/15 to 30/30
- storageos: no change
This commit is contained in:
Matthew Cary
2020-06-09 21:30:40 +00:00
parent 74dbf274d9
commit f2e23afcf1
41 changed files with 346 additions and 65 deletions

View File

@@ -21,6 +21,7 @@ import (
"strconv"
"k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/volume"
utilexec "k8s.io/utils/exec"
siotypes "github.com/thecodeteam/goscaleio/types/v1"
@@ -30,9 +31,10 @@ type sioMgr struct {
client sioInterface
configData map[string]string
exec utilexec.Interface
host volume.VolumeHost
}
func newSioMgr(configs map[string]string, exec utilexec.Interface) (*sioMgr, error) {
func newSioMgr(configs map[string]string, host volume.VolumeHost, exec utilexec.Interface) (*sioMgr, error) {
if configs == nil {
return nil, errors.New("missing configuration data")
}
@@ -41,7 +43,7 @@ func newSioMgr(configs map[string]string, exec utilexec.Interface) (*sioMgr, err
configs[confKey.sdcRootPath] = defaultString(configs[confKey.sdcRootPath], sdcRootPath)
configs[confKey.storageMode] = defaultString(configs[confKey.storageMode], "ThinProvisioned")
mgr := &sioMgr{configData: configs, exec: exec}
mgr := &sioMgr{configData: configs, host: host, exec: exec}
return mgr, nil
}
@@ -61,7 +63,7 @@ func (m *sioMgr) getClient() (sioInterface, error) {
certsEnabled := b
klog.V(4).Info(log("creating new client for gateway %s", gateway))
client, err := newSioClient(gateway, username, password, certsEnabled, m.exec)
client, err := newSioClient(gateway, username, password, certsEnabled, m.exec, m.host.GetFilteredDialOptions())
if err != nil {
klog.Error(log("failed to create scaleio client: %v", err))
return nil, err