Skip to content

do not ignore subsets in soft sticky sessions#6822

Merged
rshriram merged 8 commits intoistio:release-1.0from
cloudfoundry-attic:http_header_consistent_hash
Jul 6, 2018
Merged

do not ignore subsets in soft sticky sessions#6822
rshriram merged 8 commits intoistio:release-1.0from
cloudfoundry-attic:http_header_consistent_hash

Conversation

@utako
Copy link
Copy Markdown
Member

@utako utako commented Jul 3, 2018

piggybacking off of #6742.

@utako utako removed the request for review from GregHanson July 3, 2018 19:20
@rshriram rshriram changed the title add consistenthash support for httpheader do not ignore subsets in soft sticky sessions Jul 3, 2018
@rshriram
Copy link
Copy Markdown
Member

rshriram commented Jul 3, 2018

merging as this is a bug fix to the soft session affinity code that went in earlier. Need to respect subsets in destination rule properly.

@googlebot
Copy link
Copy Markdown
Collaborator

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@googlebot googlebot added cla: no Set by the Google CLA bot to indicate the author of a PR has not signed the Google CLA. and removed cla: yes labels Jul 3, 2018
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flip this around to make this whole section more concise:

consistentHash := rule.GetTrafficPolicy().GetLoadBalancer().GetConsistentHash()
for _, subset := range rule.GetSubsets() {
    if subset.GetName() == subsetName {
        consistentHash = subset.GetTrafficPolicy().GetLoadBalancer().GetConsistentHash()
        break
    }
}

if consistentHash == nil {
    return nil
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test case for a DestinationRule with no TrafficPolicy object please; I suspect you'll get some nil-pointer panics due to rule.GetTrafficPolicy().GetLoadBalancer().GetConsistentHash().

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not panic thanks to the accessors

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add tests for ports only.. Names are deprecated..

utako and others added 4 commits July 5, 2018 10:49
port name is deprecated. traffic policies at the port level should only
be inspected for port number when updating a route to use a hash policy.
@zachgersh zachgersh force-pushed the http_header_consistent_hash branch from 990a20d to 950a06c Compare July 5, 2018 17:58
Co-authored-by: Zachary Gershman <zgershman@pivotal.io>
@istio-testing
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: utako
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: myidpt

Assign the PR to them by writing /assign @myidpt in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown
Member

@rshriram rshriram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

portLevelSettings := rule.GetTrafficPolicy().GetPortLevelSettings()
settingsHash := portLevelSettingsConsistentHash(destination, portLevelSettings)
if settingsHash != nil {
consistentHash = settingsHash
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to move to top before matching on subsets. Port level settings in subsets overrides the port level settings in top level.

settingsHash := portLevelSettingsConsistentHash(destination, subsetPortLevelSettings)
if settingsHash != nil {
consistentHash = settingsHash
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No if condition here. Essentially there is no inheritance. If something is missing it goes to default values. So you can assign everything to consistentHash and do a nil check in the end.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd be able to move the nil checks if this were patterned more after cluster.go. We'll see about clarifying the behavior so it's more obvious in the next commit. We were hoping to avoid modifying the hash policy in place for clarity's sake.

if settingsHash != nil {
consistentHash = settingsHash
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this should be above the subset search for loop

utako and others added 2 commits July 6, 2018 11:03
@rshriram rshriram merged commit 33998c2 into istio:release-1.0 Jul 6, 2018
@zachgersh zachgersh deleted the http_header_consistent_hash branch July 6, 2018 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: no Set by the Google CLA bot to indicate the author of a PR has not signed the Google CLA.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants