GoogleCloudPlatform/kubernetes — pull request #3031 by foleymic (2014-12-18 16:03:09+00:00)
Title: Sticky Session Implementation

Session Affinity implementation - see Issue #2867.
pkg/proxy
- Added two new methods to loadbalancer interface. 1. NewService (service name, sessionAffinityType). 2. CleanupStaleStickySessions(service name, max sticky session age in minutes).
- roundrobin.go - added implementation for the above two methods. Also added a couple new structs to hold the hash map to maintain affinity between clients and endpoints.
- proxier.go - call LB.NewService with session affinity type when there are changes to the services (default affinity type is none). Also call the LB.CleanupStaleStickySessions as part of the SyncLoop

pkg/cloudprovider & pkg/registry/service/rest.go
- If the service definition has CreateExternalLoadBalancer we need to tell the cloud provider to create the LB with session affinity if required. These changes will automatically set cloud provided load balancer for sticky session if the service requires it - Note, this only works on GCE right now.