Skip to content

Commit

Permalink
Merge pull request kubernetes#35681 from vincentheet/issue-35677
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

Change stickyMaxAge from seconds to minutes, fixes issue kubernetes#35677

**What this PR does / why we need it**: Increases the service sessionAfinity time from 180 seconds to 180 minutes for proxy mode iptables which was a bug introduced in a refactor.

**Which issue this PR fixes**: fixes kubernetes#35677

**Special notes for your reviewer**: 

**Release note**:

``` release-note
Fixed wrong service sessionAffinity stickiness time from 180 sec to 180 minutes in proxy mode iptables.
```

Since there is no test for the sessionAffinity feature at the moment I wanted to create one but I don't know how.
  • Loading branch information
Kubernetes Submit Queue authored Nov 22, 2016
2 parents a9b5821 + 528bc97 commit ddf5888
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/proxy/iptables/proxier.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ type serviceInfo struct {
nodePort int
loadBalancerStatus api.LoadBalancerStatus
sessionAffinityType api.ServiceAffinity
stickyMaxAgeSeconds int
stickyMaxAgeMinutes int
externalIPs []string
loadBalancerSourceRanges []string
onlyNodeLocalEndpoints bool
Expand All @@ -155,7 +155,7 @@ type endpointsInfo struct {
func newServiceInfo(service proxy.ServicePortName) *serviceInfo {
return &serviceInfo{
sessionAffinityType: api.ServiceAffinityNone, // default
stickyMaxAgeSeconds: 180, // TODO: paramaterize this in the API.
stickyMaxAgeMinutes: 180, // TODO: paramaterize this in the API.
}
}

Expand Down Expand Up @@ -1165,7 +1165,7 @@ func (proxier *Proxier) syncProxyRules() {
"-A", string(svcChain),
"-m", "comment", "--comment", svcName.String(),
"-m", "recent", "--name", string(endpointChain),
"--rcheck", "--seconds", fmt.Sprintf("%d", svcInfo.stickyMaxAgeSeconds), "--reap",
"--rcheck", "--seconds", fmt.Sprintf("%d", svcInfo.stickyMaxAgeMinutes*60), "--reap",
"-j", string(endpointChain))
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/iptables/proxier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func TestExecConntrackTool(t *testing.T) {
func newFakeServiceInfo(service proxy.ServicePortName, ip net.IP, protocol api.Protocol, onlyNodeLocalEndpoints bool) *serviceInfo {
return &serviceInfo{
sessionAffinityType: api.ServiceAffinityNone, // default
stickyMaxAgeSeconds: 180, // TODO: paramaterize this in the API.
stickyMaxAgeMinutes: 180, // TODO: paramaterize this in the API.
clusterIP: ip,
protocol: protocol,
onlyNodeLocalEndpoints: onlyNodeLocalEndpoints,
Expand Down

0 comments on commit ddf5888

Please sign in to comment.