2014-06-06 19:40:48 -04:00
|
|
|
/*
|
2016-06-02 20:25:58 -04:00
|
|
|
Copyright 2014 The Kubernetes Authors.
|
2014-06-06 19:40:48 -04:00
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
*/
|
2014-06-23 14:32:11 -04:00
|
|
|
|
2015-08-07 20:07:15 -04:00
|
|
|
package userspace
|
2014-06-06 19:40:48 -04:00
|
|
|
|
|
|
|
|
import (
|
2018-08-15 09:51:19 -04:00
|
|
|
"k8s.io/api/core/v1"
|
2015-08-07 20:07:15 -04:00
|
|
|
"k8s.io/kubernetes/pkg/proxy"
|
2017-11-08 17:34:54 -05:00
|
|
|
"net"
|
2014-06-06 19:40:48 -04:00
|
|
|
)
|
|
|
|
|
|
2014-09-02 06:00:28 -04:00
|
|
|
// LoadBalancer is an interface for distributing incoming requests to service endpoints.
|
2014-06-06 19:40:48 -04:00
|
|
|
type LoadBalancer interface {
|
2014-08-03 15:23:15 -04:00
|
|
|
// NextEndpoint returns the endpoint to handle a request for the given
|
2015-03-20 17:24:43 -04:00
|
|
|
// service-port and source address.
|
2016-05-02 21:36:32 -04:00
|
|
|
NextEndpoint(service proxy.ServicePortName, srcAddr net.Addr, sessionAffinityReset bool) (string, error)
|
2018-08-15 09:51:19 -04:00
|
|
|
NewService(service proxy.ServicePortName, sessionAffinityType v1.ServiceAffinity, stickyMaxAgeSeconds int) error
|
2016-05-08 00:23:50 -04:00
|
|
|
DeleteService(service proxy.ServicePortName)
|
2015-08-07 20:07:15 -04:00
|
|
|
CleanupStaleStickySessions(service proxy.ServicePortName)
|
2016-08-18 13:41:51 -04:00
|
|
|
ServiceHasEndpoints(service proxy.ServicePortName) bool
|
2014-06-06 19:40:48 -04:00
|
|
|
}
|