relates to #35082, moby/libnetwork#2491
Previously, values for expire_quiescent_template, conn_reuse_mode,
and expire_nodest_conn were set only system-wide. Also apply them
for new lb_* and ingress_sbox sandboxes, so they are appropriately
propagated
Signed-off-by: Ryan Barry <rbarry@mirantis.com>
| ... | ... |
@@ -1082,6 +1082,14 @@ func (c *controller) NewSandbox(containerID string, options ...SandboxOption) (S |
| 1082 | 1082 |
|
| 1083 | 1083 |
if sb.osSbox != nil {
|
| 1084 | 1084 |
// Apply operating specific knobs on the load balancer sandbox |
| 1085 |
+ err := sb.osSbox.InvokeFunc(func() {
|
|
| 1086 |
+ sb.osSbox.ApplyOSTweaks(sb.oslTypes) |
|
| 1087 |
+ }) |
|
| 1088 |
+ |
|
| 1089 |
+ if err != nil {
|
|
| 1090 |
+ logrus.Errorf("Failed to apply performance tuning sysctls to the sandbox: %v", err)
|
|
| 1091 |
+ } |
|
| 1092 |
+ // Keep this just so performance is not changed |
|
| 1085 | 1093 |
sb.osSbox.ApplyOSTweaks(sb.oslTypes) |
| 1086 | 1094 |
} |
| 1087 | 1095 |
|
| ... | ... |
@@ -31,24 +31,13 @@ func init() {
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 | 33 |
var ( |
| 34 |
- once sync.Once |
|
| 35 |
- garbagePathMap = make(map[string]bool) |
|
| 36 |
- gpmLock sync.Mutex |
|
| 37 |
- gpmWg sync.WaitGroup |
|
| 38 |
- gpmCleanupPeriod = 60 * time.Second |
|
| 39 |
- gpmChan = make(chan chan struct{})
|
|
| 40 |
- prefix = defaultPrefix |
|
| 41 |
- loadBalancerConfig = map[string]*kernel.OSValue{
|
|
| 42 |
- // disables any special handling on port reuse of existing IPVS connection table entries |
|
| 43 |
- // more info: https://github.com/torvalds/linux/blob/master/Documentation/networking/ipvs-sysctl.txt#L25:1 |
|
| 44 |
- "net.ipv4.vs.conn_reuse_mode": {Value: "0", CheckFn: nil},
|
|
| 45 |
- // expires connection from the IPVS connection table when the backend is not available |
|
| 46 |
- // more info: https://github.com/torvalds/linux/blob/master/Documentation/networking/ipvs-sysctl.txt#L126:1 |
|
| 47 |
- "net.ipv4.vs.expire_nodest_conn": {Value: "1", CheckFn: nil},
|
|
| 48 |
- // expires persistent connections to destination servers with weights set to 0 |
|
| 49 |
- // more info: https://github.com/torvalds/linux/blob/master/Documentation/networking/ipvs-sysctl.txt#L144:1 |
|
| 50 |
- "net.ipv4.vs.expire_quiescent_template": {Value: "1", CheckFn: nil},
|
|
| 51 |
- } |
|
| 34 |
+ once sync.Once |
|
| 35 |
+ garbagePathMap = make(map[string]bool) |
|
| 36 |
+ gpmLock sync.Mutex |
|
| 37 |
+ gpmWg sync.WaitGroup |
|
| 38 |
+ gpmCleanupPeriod = 60 * time.Second |
|
| 39 |
+ gpmChan = make(chan chan struct{})
|
|
| 40 |
+ prefix = defaultPrefix |
|
| 52 | 41 |
) |
| 53 | 42 |
|
| 54 | 43 |
// The networkNamespace type is the linux implementation of the Sandbox |
| ... | ... |
@@ -689,8 +678,18 @@ func setIPv6(path, iface string, enable bool) error {
|
| 689 | 689 |
func (n *networkNamespace) ApplyOSTweaks(types []SandboxType) {
|
| 690 | 690 |
for _, t := range types {
|
| 691 | 691 |
switch t {
|
| 692 |
- case SandboxTypeLoadBalancer: |
|
| 693 |
- kernel.ApplyOSTweaks(loadBalancerConfig) |
|
| 692 |
+ case SandboxTypeLoadBalancer, SandboxTypeIngress: |
|
| 693 |
+ kernel.ApplyOSTweaks(map[string]*kernel.OSValue{
|
|
| 694 |
+ // disables any special handling on port reuse of existing IPVS connection table entries |
|
| 695 |
+ // more info: https://github.com/torvalds/linux/blame/v5.15/Documentation/networking/ipvs-sysctl.rst#L32 |
|
| 696 |
+ "net.ipv4.vs.conn_reuse_mode": {Value: "0", CheckFn: nil},
|
|
| 697 |
+ // expires connection from the IPVS connection table when the backend is not available |
|
| 698 |
+ // more info: https://github.com/torvalds/linux/blame/v5.15/Documentation/networking/ipvs-sysctl.rst#L133 |
|
| 699 |
+ "net.ipv4.vs.expire_nodest_conn": {Value: "1", CheckFn: nil},
|
|
| 700 |
+ // expires persistent connections to destination servers with weights set to 0 |
|
| 701 |
+ // more info: https://github.com/torvalds/linux/blame/v5.15/Documentation/networking/ipvs-sysctl.rst#L151 |
|
| 702 |
+ "net.ipv4.vs.expire_quiescent_template": {Value: "1", CheckFn: nil},
|
|
| 703 |
+ }) |
|
| 694 | 704 |
} |
| 695 | 705 |
} |
| 696 | 706 |
} |