mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
Rename AffinityType to ServiceAffinity
This commit is contained in:
parent
1e1092ddbc
commit
a548d542db
@ -182,8 +182,8 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
|
|||||||
protocols := []api.Protocol{api.ProtocolTCP, api.ProtocolUDP}
|
protocols := []api.Protocol{api.ProtocolTCP, api.ProtocolUDP}
|
||||||
*p = protocols[c.Rand.Intn(len(protocols))]
|
*p = protocols[c.Rand.Intn(len(protocols))]
|
||||||
},
|
},
|
||||||
func(p *api.AffinityType, c fuzz.Continue) {
|
func(p *api.ServiceAffinity, c fuzz.Continue) {
|
||||||
types := []api.AffinityType{api.AffinityTypeClientIP, api.AffinityTypeNone}
|
types := []api.ServiceAffinity{api.ServiceAffinityClientIP, api.ServiceAffinityNone}
|
||||||
*p = types[c.Rand.Intn(len(types))]
|
*p = types[c.Rand.Intn(len(types))]
|
||||||
},
|
},
|
||||||
func(ct *api.Container, c fuzz.Continue) {
|
func(ct *api.Container, c fuzz.Continue) {
|
||||||
|
@ -969,14 +969,14 @@ type ServiceList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Session Affinity Type string
|
// Session Affinity Type string
|
||||||
type AffinityType string
|
type ServiceAffinity string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// AffinityTypeClientIP is the Client IP based.
|
// ServiceAffinityClientIP is the Client IP based.
|
||||||
AffinityTypeClientIP AffinityType = "ClientIP"
|
ServiceAffinityClientIP ServiceAffinity = "ClientIP"
|
||||||
|
|
||||||
// AffinityTypeNone - no session affinity.
|
// ServiceAffinityNone - no session affinity.
|
||||||
AffinityTypeNone AffinityType = "None"
|
ServiceAffinityNone ServiceAffinity = "None"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceStatus represents the current status of a service
|
// ServiceStatus represents the current status of a service
|
||||||
@ -1009,7 +1009,7 @@ type ServiceSpec struct {
|
|||||||
PublicIPs []string `json:"publicIPs,omitempty"`
|
PublicIPs []string `json:"publicIPs,omitempty"`
|
||||||
|
|
||||||
// Required: Supports "ClientIP" and "None". Used to maintain session affinity.
|
// Required: Supports "ClientIP" and "None". Used to maintain session affinity.
|
||||||
SessionAffinity AffinityType `json:"sessionAffinity,omitempty"`
|
SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServicePort struct {
|
type ServicePort struct {
|
||||||
|
@ -4057,7 +4057,7 @@ func convert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *newer.Servi
|
|||||||
} else {
|
} else {
|
||||||
out.PublicIPs = nil
|
out.PublicIPs = nil
|
||||||
}
|
}
|
||||||
out.SessionAffinity = newer.AffinityType(in.SessionAffinity)
|
out.SessionAffinity = newer.ServiceAffinity(in.SessionAffinity)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4093,7 +4093,7 @@ func convert_api_ServiceSpec_To_v1_ServiceSpec(in *newer.ServiceSpec, out *Servi
|
|||||||
} else {
|
} else {
|
||||||
out.PublicIPs = nil
|
out.PublicIPs = nil
|
||||||
}
|
}
|
||||||
out.SessionAffinity = AffinityType(in.SessionAffinity)
|
out.SessionAffinity = ServiceAffinity(in.SessionAffinity)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ func addDefaultingFuncs() {
|
|||||||
},
|
},
|
||||||
func(obj *ServiceSpec) {
|
func(obj *ServiceSpec) {
|
||||||
if obj.SessionAffinity == "" {
|
if obj.SessionAffinity == "" {
|
||||||
obj.SessionAffinity = AffinityTypeNone
|
obj.SessionAffinity = ServiceAffinityNone
|
||||||
}
|
}
|
||||||
for i := range obj.Ports {
|
for i := range obj.Ports {
|
||||||
sp := &obj.Ports[i]
|
sp := &obj.Ports[i]
|
||||||
|
@ -159,8 +159,8 @@ func TestSetDefaultService(t *testing.T) {
|
|||||||
svc := ¤t.Service{}
|
svc := ¤t.Service{}
|
||||||
obj2 := roundTrip(t, runtime.Object(svc))
|
obj2 := roundTrip(t, runtime.Object(svc))
|
||||||
svc2 := obj2.(*current.Service)
|
svc2 := obj2.(*current.Service)
|
||||||
if svc2.Spec.SessionAffinity != current.AffinityTypeNone {
|
if svc2.Spec.SessionAffinity != current.ServiceAffinityNone {
|
||||||
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.AffinityTypeNone, svc2.Spec.SessionAffinity)
|
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.ServiceAffinityNone, svc2.Spec.SessionAffinity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -951,14 +951,14 @@ type ReplicationControllerList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Session Affinity Type string
|
// Session Affinity Type string
|
||||||
type AffinityType string
|
type ServiceAffinity string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// AffinityTypeClientIP is the Client IP based.
|
// ServiceAffinityClientIP is the Client IP based.
|
||||||
AffinityTypeClientIP AffinityType = "ClientIP"
|
ServiceAffinityClientIP ServiceAffinity = "ClientIP"
|
||||||
|
|
||||||
// AffinityTypeNone - no session affinity.
|
// ServiceAffinityNone - no session affinity.
|
||||||
AffinityTypeNone AffinityType = "None"
|
ServiceAffinityNone ServiceAffinity = "None"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceStatus represents the current status of a service
|
// ServiceStatus represents the current status of a service
|
||||||
@ -987,7 +987,7 @@ type ServiceSpec struct {
|
|||||||
PublicIPs []string `json:"publicIPs,omitempty" description:"externally visible IPs (e.g. load balancers) that should be proxied to this service"`
|
PublicIPs []string `json:"publicIPs,omitempty" description:"externally visible IPs (e.g. load balancers) that should be proxied to this service"`
|
||||||
|
|
||||||
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
||||||
SessionAffinity AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
|
SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServicePort struct {
|
type ServicePort struct {
|
||||||
|
@ -74,7 +74,7 @@ func addDefaultingFuncs() {
|
|||||||
obj.Protocol = ProtocolTCP
|
obj.Protocol = ProtocolTCP
|
||||||
}
|
}
|
||||||
if obj.SessionAffinity == "" {
|
if obj.SessionAffinity == "" {
|
||||||
obj.SessionAffinity = AffinityTypeNone
|
obj.SessionAffinity = ServiceAffinityNone
|
||||||
}
|
}
|
||||||
for i := range obj.Ports {
|
for i := range obj.Ports {
|
||||||
sp := &obj.Ports[i]
|
sp := &obj.Ports[i]
|
||||||
|
@ -149,8 +149,8 @@ func TestSetDefaultService(t *testing.T) {
|
|||||||
if svc2.Protocol != current.ProtocolTCP {
|
if svc2.Protocol != current.ProtocolTCP {
|
||||||
t.Errorf("Expected default protocol :%s, got: %s", current.ProtocolTCP, svc2.Protocol)
|
t.Errorf("Expected default protocol :%s, got: %s", current.ProtocolTCP, svc2.Protocol)
|
||||||
}
|
}
|
||||||
if svc2.SessionAffinity != current.AffinityTypeNone {
|
if svc2.SessionAffinity != current.ServiceAffinityNone {
|
||||||
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.AffinityTypeNone, svc2.SessionAffinity)
|
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.ServiceAffinityNone, svc2.SessionAffinity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,14 +793,14 @@ type PodTemplate struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Session Affinity Type string
|
// Session Affinity Type string
|
||||||
type AffinityType string
|
type ServiceAffinity string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// AffinityTypeClientIP is the Client IP based.
|
// ServiceAffinityClientIP is the Client IP based.
|
||||||
AffinityTypeClientIP AffinityType = "ClientIP"
|
ServiceAffinityClientIP ServiceAffinity = "ClientIP"
|
||||||
|
|
||||||
// AffinityTypeNone - no session affinity.
|
// ServiceAffinityNone - no session affinity.
|
||||||
AffinityTypeNone AffinityType = "None"
|
ServiceAffinityNone ServiceAffinity = "None"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -856,7 +856,7 @@ type Service struct {
|
|||||||
ProxyPort int `json:"proxyPort,omitempty" description:"if non-zero, a pre-allocated host port used for this service by the proxy on each node; assigned by the master and ignored on input"`
|
ProxyPort int `json:"proxyPort,omitempty" description:"if non-zero, a pre-allocated host port used for this service by the proxy on each node; assigned by the master and ignored on input"`
|
||||||
|
|
||||||
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
||||||
SessionAffinity AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
|
SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
|
||||||
|
|
||||||
// Optional: Ports to expose on the service. If this field is
|
// Optional: Ports to expose on the service. If this field is
|
||||||
// specified, the legacy fields (Port, PortName, Protocol, and
|
// specified, the legacy fields (Port, PortName, Protocol, and
|
||||||
|
@ -75,7 +75,7 @@ func addDefaultingFuncs() {
|
|||||||
obj.Protocol = ProtocolTCP
|
obj.Protocol = ProtocolTCP
|
||||||
}
|
}
|
||||||
if obj.SessionAffinity == "" {
|
if obj.SessionAffinity == "" {
|
||||||
obj.SessionAffinity = AffinityTypeNone
|
obj.SessionAffinity = ServiceAffinityNone
|
||||||
}
|
}
|
||||||
for i := range obj.Ports {
|
for i := range obj.Ports {
|
||||||
sp := &obj.Ports[i]
|
sp := &obj.Ports[i]
|
||||||
|
@ -149,8 +149,8 @@ func TestSetDefaultService(t *testing.T) {
|
|||||||
if svc2.Protocol != current.ProtocolTCP {
|
if svc2.Protocol != current.ProtocolTCP {
|
||||||
t.Errorf("Expected default protocol :%s, got: %s", current.ProtocolTCP, svc2.Protocol)
|
t.Errorf("Expected default protocol :%s, got: %s", current.ProtocolTCP, svc2.Protocol)
|
||||||
}
|
}
|
||||||
if svc2.SessionAffinity != current.AffinityTypeNone {
|
if svc2.SessionAffinity != current.ServiceAffinityNone {
|
||||||
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.AffinityTypeNone, svc2.SessionAffinity)
|
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.ServiceAffinityNone, svc2.SessionAffinity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -799,14 +799,14 @@ type PodTemplate struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Session Affinity Type string
|
// Session Affinity Type string
|
||||||
type AffinityType string
|
type ServiceAffinity string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// AffinityTypeClientIP is the Client IP based.
|
// ServiceAffinityClientIP is the Client IP based.
|
||||||
AffinityTypeClientIP AffinityType = "ClientIP"
|
ServiceAffinityClientIP ServiceAffinity = "ClientIP"
|
||||||
|
|
||||||
// AffinityTypeNone - no session affinity.
|
// ServiceAffinityNone - no session affinity.
|
||||||
AffinityTypeNone AffinityType = "None"
|
ServiceAffinityNone ServiceAffinity = "None"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -864,7 +864,7 @@ type Service struct {
|
|||||||
ProxyPort int `json:"proxyPort,omitempty" description:"if non-zero, a pre-allocated host port used for this service by the proxy on each node; assigned by the master and ignored on input"`
|
ProxyPort int `json:"proxyPort,omitempty" description:"if non-zero, a pre-allocated host port used for this service by the proxy on each node; assigned by the master and ignored on input"`
|
||||||
|
|
||||||
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
||||||
SessionAffinity AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
|
SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
|
||||||
|
|
||||||
// Optional: Ports to expose on the service. If this field is
|
// Optional: Ports to expose on the service. If this field is
|
||||||
// specified, the legacy fields (Port, PortName, Protocol, and
|
// specified, the legacy fields (Port, PortName, Protocol, and
|
||||||
|
@ -3871,7 +3871,7 @@ func convert_v1beta3_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *newer.
|
|||||||
} else {
|
} else {
|
||||||
out.PublicIPs = nil
|
out.PublicIPs = nil
|
||||||
}
|
}
|
||||||
out.SessionAffinity = newer.AffinityType(in.SessionAffinity)
|
out.SessionAffinity = newer.ServiceAffinity(in.SessionAffinity)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3907,7 +3907,7 @@ func convert_api_ServiceSpec_To_v1beta3_ServiceSpec(in *newer.ServiceSpec, out *
|
|||||||
} else {
|
} else {
|
||||||
out.PublicIPs = nil
|
out.PublicIPs = nil
|
||||||
}
|
}
|
||||||
out.SessionAffinity = AffinityType(in.SessionAffinity)
|
out.SessionAffinity = ServiceAffinity(in.SessionAffinity)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ func addDefaultingFuncs() {
|
|||||||
},
|
},
|
||||||
func(obj *ServiceSpec) {
|
func(obj *ServiceSpec) {
|
||||||
if obj.SessionAffinity == "" {
|
if obj.SessionAffinity == "" {
|
||||||
obj.SessionAffinity = AffinityTypeNone
|
obj.SessionAffinity = ServiceAffinityNone
|
||||||
}
|
}
|
||||||
for i := range obj.Ports {
|
for i := range obj.Ports {
|
||||||
sp := &obj.Ports[i]
|
sp := &obj.Ports[i]
|
||||||
|
@ -159,8 +159,8 @@ func TestSetDefaultService(t *testing.T) {
|
|||||||
svc := ¤t.Service{}
|
svc := ¤t.Service{}
|
||||||
obj2 := roundTrip(t, runtime.Object(svc))
|
obj2 := roundTrip(t, runtime.Object(svc))
|
||||||
svc2 := obj2.(*current.Service)
|
svc2 := obj2.(*current.Service)
|
||||||
if svc2.Spec.SessionAffinity != current.AffinityTypeNone {
|
if svc2.Spec.SessionAffinity != current.ServiceAffinityNone {
|
||||||
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.AffinityTypeNone, svc2.Spec.SessionAffinity)
|
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.ServiceAffinityNone, svc2.Spec.SessionAffinity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -955,14 +955,14 @@ type ReplicationControllerList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Session Affinity Type string
|
// Session Affinity Type string
|
||||||
type AffinityType string
|
type ServiceAffinity string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// AffinityTypeClientIP is the Client IP based.
|
// ServiceAffinityClientIP is the Client IP based.
|
||||||
AffinityTypeClientIP AffinityType = "ClientIP"
|
ServiceAffinityClientIP ServiceAffinity = "ClientIP"
|
||||||
|
|
||||||
// AffinityTypeNone - no session affinity.
|
// ServiceAffinityNone - no session affinity.
|
||||||
AffinityTypeNone AffinityType = "None"
|
ServiceAffinityNone ServiceAffinity = "None"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceStatus represents the current status of a service
|
// ServiceStatus represents the current status of a service
|
||||||
@ -991,7 +991,7 @@ type ServiceSpec struct {
|
|||||||
PublicIPs []string `json:"publicIPs,omitempty" description:"externally visible IPs (e.g. load balancers) that should be proxied to this service"`
|
PublicIPs []string `json:"publicIPs,omitempty" description:"externally visible IPs (e.g. load balancers) that should be proxied to this service"`
|
||||||
|
|
||||||
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
||||||
SessionAffinity AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
|
SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServicePort struct {
|
type ServicePort struct {
|
||||||
|
@ -985,7 +985,7 @@ func ValidatePodTemplateUpdate(newPod, oldPod *api.PodTemplate) errs.ValidationE
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportedSessionAffinityType = util.NewStringSet(string(api.AffinityTypeClientIP), string(api.AffinityTypeNone))
|
var supportedSessionAffinityType = util.NewStringSet(string(api.ServiceAffinityClientIP), string(api.ServiceAffinityNone))
|
||||||
|
|
||||||
// ValidateService tests if required fields in the service are set.
|
// ValidateService tests if required fields in the service are set.
|
||||||
func ValidateService(service *api.Service) errs.ValidationErrorList {
|
func ValidateService(service *api.Service) errs.ValidationErrorList {
|
||||||
|
@ -63,7 +63,7 @@ type TCPLoadBalancer interface {
|
|||||||
// if so, what its IP address or hostname is.
|
// if so, what its IP address or hostname is.
|
||||||
GetTCPLoadBalancer(name, region string) (endpoint string, exists bool, err error)
|
GetTCPLoadBalancer(name, region string) (endpoint string, exists bool, err error)
|
||||||
// CreateTCPLoadBalancer creates a new tcp load balancer. Returns the IP address or hostname of the balancer
|
// CreateTCPLoadBalancer creates a new tcp load balancer. Returns the IP address or hostname of the balancer
|
||||||
CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.AffinityType) (string, error)
|
CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.ServiceAffinity) (string, error)
|
||||||
// UpdateTCPLoadBalancer updates hosts under the specified load balancer.
|
// UpdateTCPLoadBalancer updates hosts under the specified load balancer.
|
||||||
UpdateTCPLoadBalancer(name, region string, hosts []string) error
|
UpdateTCPLoadBalancer(name, region string, hosts []string) error
|
||||||
// DeleteTCPLoadBalancer deletes a specified load balancer.
|
// DeleteTCPLoadBalancer deletes a specified load balancer.
|
||||||
|
@ -101,7 +101,7 @@ func (f *FakeCloud) GetTCPLoadBalancer(name, region string) (endpoint string, ex
|
|||||||
|
|
||||||
// CreateTCPLoadBalancer is a test-spy implementation of TCPLoadBalancer.CreateTCPLoadBalancer.
|
// CreateTCPLoadBalancer is a test-spy implementation of TCPLoadBalancer.CreateTCPLoadBalancer.
|
||||||
// It adds an entry "create" into the internal method call record.
|
// It adds an entry "create" into the internal method call record.
|
||||||
func (f *FakeCloud) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.AffinityType) (string, error) {
|
func (f *FakeCloud) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.ServiceAffinity) (string, error) {
|
||||||
f.addCall("create")
|
f.addCall("create")
|
||||||
f.Balancers = append(f.Balancers, FakeBalancer{name, region, externalIP, ports, hosts})
|
f.Balancers = append(f.Balancers, FakeBalancer{name, region, externalIP, ports, hosts})
|
||||||
return f.ExternalIP.String(), f.Err
|
return f.ExternalIP.String(), f.Err
|
||||||
|
@ -294,11 +294,11 @@ func isHTTPErrorCode(err error, code int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// translate from what K8s supports to what the cloud provider supports for session affinity.
|
// translate from what K8s supports to what the cloud provider supports for session affinity.
|
||||||
func translateAffinityType(affinityType api.AffinityType) GCEAffinityType {
|
func translateAffinityType(affinityType api.ServiceAffinity) GCEAffinityType {
|
||||||
switch affinityType {
|
switch affinityType {
|
||||||
case api.AffinityTypeClientIP:
|
case api.ServiceAffinityClientIP:
|
||||||
return GCEAffinityTypeClientIP
|
return GCEAffinityTypeClientIP
|
||||||
case api.AffinityTypeNone:
|
case api.ServiceAffinityNone:
|
||||||
return GCEAffinityTypeNone
|
return GCEAffinityTypeNone
|
||||||
default:
|
default:
|
||||||
glog.Errorf("unexpected affinity type: %v", affinityType)
|
glog.Errorf("unexpected affinity type: %v", affinityType)
|
||||||
@ -309,7 +309,7 @@ func translateAffinityType(affinityType api.AffinityType) GCEAffinityType {
|
|||||||
// CreateTCPLoadBalancer is an implementation of TCPLoadBalancer.CreateTCPLoadBalancer.
|
// CreateTCPLoadBalancer is an implementation of TCPLoadBalancer.CreateTCPLoadBalancer.
|
||||||
// TODO(a-robinson): Don't just ignore specified IP addresses. Check if they're
|
// TODO(a-robinson): Don't just ignore specified IP addresses. Check if they're
|
||||||
// owned by the project and available to be used, and use them if they are.
|
// owned by the project and available to be used, and use them if they are.
|
||||||
func (gce *GCECloud) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.AffinityType) (string, error) {
|
func (gce *GCECloud) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.ServiceAffinity) (string, error) {
|
||||||
err := gce.makeTargetPool(name, region, hosts, translateAffinityType(affinityType))
|
err := gce.makeTargetPool(name, region, hosts, translateAffinityType(affinityType))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !isHTTPErrorCode(err, http.StatusConflict) {
|
if !isHTTPErrorCode(err, http.StatusConflict) {
|
||||||
|
@ -480,7 +480,7 @@ func (lb *LoadBalancer) GetTCPLoadBalancer(name, region string) (endpoint string
|
|||||||
// a list of regions (from config) and query/create loadbalancers in
|
// a list of regions (from config) and query/create loadbalancers in
|
||||||
// each region.
|
// each region.
|
||||||
|
|
||||||
func (lb *LoadBalancer) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinity api.AffinityType) (string, error) {
|
func (lb *LoadBalancer) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinity api.ServiceAffinity) (string, error) {
|
||||||
glog.V(4).Infof("CreateTCPLoadBalancer(%v, %v, %v, %v, %v, %v)", name, region, externalIP, ports, hosts, affinity)
|
glog.V(4).Infof("CreateTCPLoadBalancer(%v, %v, %v, %v, %v, %v)", name, region, externalIP, ports, hosts, affinity)
|
||||||
|
|
||||||
if len(ports) > 1 {
|
if len(ports) > 1 {
|
||||||
@ -489,9 +489,9 @@ func (lb *LoadBalancer) CreateTCPLoadBalancer(name, region string, externalIP ne
|
|||||||
|
|
||||||
var persistence *vips.SessionPersistence
|
var persistence *vips.SessionPersistence
|
||||||
switch affinity {
|
switch affinity {
|
||||||
case api.AffinityTypeNone:
|
case api.ServiceAffinityNone:
|
||||||
persistence = nil
|
persistence = nil
|
||||||
case api.AffinityTypeClientIP:
|
case api.ServiceAffinityClientIP:
|
||||||
persistence = &vips.SessionPersistence{Type: "SOURCE_IP"}
|
persistence = &vips.SessionPersistence{Type: "SOURCE_IP"}
|
||||||
default:
|
default:
|
||||||
return "", fmt.Errorf("unsupported load balancer affinity: %v", affinity)
|
return "", fmt.Errorf("unsupported load balancer affinity: %v", affinity)
|
||||||
|
@ -181,7 +181,7 @@ func (c *Controller) CreateMasterServiceIfNeeded(serviceName string, serviceIP n
|
|||||||
// maintained by this code, not by the pod selector
|
// maintained by this code, not by the pod selector
|
||||||
Selector: nil,
|
Selector: nil,
|
||||||
PortalIP: serviceIP.String(),
|
PortalIP: serviceIP.String(),
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
_, err := c.ServiceRegistry.CreateService(ctx, svc)
|
_, err := c.ServiceRegistry.CreateService(ctx, svc)
|
||||||
|
@ -29,7 +29,7 @@ type LoadBalancer interface {
|
|||||||
// NextEndpoint returns the endpoint to handle a request for the given
|
// NextEndpoint returns the endpoint to handle a request for the given
|
||||||
// service-port and source address.
|
// service-port and source address.
|
||||||
NextEndpoint(service ServicePortName, srcAddr net.Addr) (string, error)
|
NextEndpoint(service ServicePortName, srcAddr net.Addr) (string, error)
|
||||||
NewService(service ServicePortName, sessionAffinityType api.AffinityType, stickyMaxAgeMinutes int) error
|
NewService(service ServicePortName, sessionAffinityType api.ServiceAffinity, stickyMaxAgeMinutes int) error
|
||||||
CleanupStaleStickySessions(service ServicePortName)
|
CleanupStaleStickySessions(service ServicePortName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ type serviceInfo struct {
|
|||||||
socket proxySocket
|
socket proxySocket
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
publicIPs []string // TODO: make this net.IP
|
publicIPs []string // TODO: make this net.IP
|
||||||
sessionAffinityType api.AffinityType
|
sessionAffinityType api.ServiceAffinity
|
||||||
stickyMaxAgeMinutes int
|
stickyMaxAgeMinutes int
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ func (proxier *Proxier) addServiceOnPort(service ServicePortName, protocol api.P
|
|||||||
protocol: protocol,
|
protocol: protocol,
|
||||||
socket: sock,
|
socket: sock,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
sessionAffinityType: api.AffinityTypeNone, // default
|
sessionAffinityType: api.ServiceAffinityNone, // default
|
||||||
stickyMaxAgeMinutes: 180, // TODO: paramaterize this in the API.
|
stickyMaxAgeMinutes: 180, // TODO: paramaterize this in the API.
|
||||||
}
|
}
|
||||||
proxier.setServiceInfo(service, si)
|
proxier.setServiceInfo(service, si)
|
||||||
|
@ -45,7 +45,7 @@ type affinityState struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type affinityPolicy struct {
|
type affinityPolicy struct {
|
||||||
affinityType api.AffinityType
|
affinityType api.ServiceAffinity
|
||||||
affinityMap map[string]*affinityState // map client IP -> affinity info
|
affinityMap map[string]*affinityState // map client IP -> affinity info
|
||||||
ttlMinutes int
|
ttlMinutes int
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ type balancerState struct {
|
|||||||
affinity affinityPolicy
|
affinity affinityPolicy
|
||||||
}
|
}
|
||||||
|
|
||||||
func newAffinityPolicy(affinityType api.AffinityType, ttlMinutes int) *affinityPolicy {
|
func newAffinityPolicy(affinityType api.ServiceAffinity, ttlMinutes int) *affinityPolicy {
|
||||||
return &affinityPolicy{
|
return &affinityPolicy{
|
||||||
affinityType: affinityType,
|
affinityType: affinityType,
|
||||||
affinityMap: make(map[string]*affinityState),
|
affinityMap: make(map[string]*affinityState),
|
||||||
@ -80,7 +80,7 @@ func NewLoadBalancerRR() *LoadBalancerRR {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (lb *LoadBalancerRR) NewService(svcPort ServicePortName, affinityType api.AffinityType, ttlMinutes int) error {
|
func (lb *LoadBalancerRR) NewService(svcPort ServicePortName, affinityType api.ServiceAffinity, ttlMinutes int) error {
|
||||||
lb.lock.Lock()
|
lb.lock.Lock()
|
||||||
defer lb.lock.Unlock()
|
defer lb.lock.Unlock()
|
||||||
lb.newServiceInternal(svcPort, affinityType, ttlMinutes)
|
lb.newServiceInternal(svcPort, affinityType, ttlMinutes)
|
||||||
@ -88,7 +88,7 @@ func (lb *LoadBalancerRR) NewService(svcPort ServicePortName, affinityType api.A
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This assumes that lb.lock is already held.
|
// This assumes that lb.lock is already held.
|
||||||
func (lb *LoadBalancerRR) newServiceInternal(svcPort ServicePortName, affinityType api.AffinityType, ttlMinutes int) *balancerState {
|
func (lb *LoadBalancerRR) newServiceInternal(svcPort ServicePortName, affinityType api.ServiceAffinity, ttlMinutes int) *balancerState {
|
||||||
if ttlMinutes == 0 {
|
if ttlMinutes == 0 {
|
||||||
ttlMinutes = 180 //default to 3 hours if not specified. Should 0 be unlimeted instead????
|
ttlMinutes = 180 //default to 3 hours if not specified. Should 0 be unlimeted instead????
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ func (lb *LoadBalancerRR) newServiceInternal(svcPort ServicePortName, affinityTy
|
|||||||
// return true if this service is using some form of session affinity.
|
// return true if this service is using some form of session affinity.
|
||||||
func isSessionAffinity(affinity *affinityPolicy) bool {
|
func isSessionAffinity(affinity *affinityPolicy) bool {
|
||||||
// Should never be empty string, but checking for it to be safe.
|
// Should never be empty string, but checking for it to be safe.
|
||||||
if affinity.affinityType == "" || affinity.affinityType == api.AffinityTypeNone {
|
if affinity.affinityType == "" || affinity.affinityType == api.ServiceAffinityNone {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@ -262,7 +262,7 @@ func (lb *LoadBalancerRR) OnUpdate(allEndpoints []api.Endpoints) {
|
|||||||
// OnUpdate can be called without NewService being called externally.
|
// OnUpdate can be called without NewService being called externally.
|
||||||
// To be safe we will call it here. A new service will only be created
|
// To be safe we will call it here. A new service will only be created
|
||||||
// if one does not already exist.
|
// if one does not already exist.
|
||||||
state = lb.newServiceInternal(svcPort, api.AffinityTypeNone, 0)
|
state = lb.newServiceInternal(svcPort, api.ServiceAffinityNone, 0)
|
||||||
state.endpoints = slice.ShuffleStrings(newEndpoints)
|
state.endpoints = slice.ShuffleStrings(newEndpoints)
|
||||||
|
|
||||||
// Reset the round-robin index.
|
// Reset the round-robin index.
|
||||||
|
@ -351,7 +351,7 @@ func TestStickyLoadBalanceWorksWithSingleEndpoint(t *testing.T) {
|
|||||||
if err == nil || len(endpoint) != 0 {
|
if err == nil || len(endpoint) != 0 {
|
||||||
t.Errorf("Didn't fail with non-existent service")
|
t.Errorf("Didn't fail with non-existent service")
|
||||||
}
|
}
|
||||||
loadBalancer.NewService(service, api.AffinityTypeClientIP, 0)
|
loadBalancer.NewService(service, api.ServiceAffinityClientIP, 0)
|
||||||
endpoints := make([]api.Endpoints, 1)
|
endpoints := make([]api.Endpoints, 1)
|
||||||
endpoints[0] = api.Endpoints{
|
endpoints[0] = api.Endpoints{
|
||||||
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
|
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
|
||||||
@ -375,7 +375,7 @@ func TestStickyLoadBalanaceWorksWithMultipleEndpoints(t *testing.T) {
|
|||||||
t.Errorf("Didn't fail with non-existent service")
|
t.Errorf("Didn't fail with non-existent service")
|
||||||
}
|
}
|
||||||
|
|
||||||
loadBalancer.NewService(service, api.AffinityTypeClientIP, 0)
|
loadBalancer.NewService(service, api.ServiceAffinityClientIP, 0)
|
||||||
endpoints := make([]api.Endpoints, 1)
|
endpoints := make([]api.Endpoints, 1)
|
||||||
endpoints[0] = api.Endpoints{
|
endpoints[0] = api.Endpoints{
|
||||||
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
|
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
|
||||||
@ -409,7 +409,7 @@ func TestStickyLoadBalanaceWorksWithMultipleEndpointsStickyNone(t *testing.T) {
|
|||||||
t.Errorf("Didn't fail with non-existent service")
|
t.Errorf("Didn't fail with non-existent service")
|
||||||
}
|
}
|
||||||
|
|
||||||
loadBalancer.NewService(service, api.AffinityTypeNone, 0)
|
loadBalancer.NewService(service, api.ServiceAffinityNone, 0)
|
||||||
endpoints := make([]api.Endpoints, 1)
|
endpoints := make([]api.Endpoints, 1)
|
||||||
endpoints[0] = api.Endpoints{
|
endpoints[0] = api.Endpoints{
|
||||||
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
|
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
|
||||||
@ -447,7 +447,7 @@ func TestStickyLoadBalanaceWorksWithMultipleEndpointsRemoveOne(t *testing.T) {
|
|||||||
t.Errorf("Didn't fail with non-existent service")
|
t.Errorf("Didn't fail with non-existent service")
|
||||||
}
|
}
|
||||||
|
|
||||||
loadBalancer.NewService(service, api.AffinityTypeClientIP, 0)
|
loadBalancer.NewService(service, api.ServiceAffinityClientIP, 0)
|
||||||
endpoints := make([]api.Endpoints, 1)
|
endpoints := make([]api.Endpoints, 1)
|
||||||
endpoints[0] = api.Endpoints{
|
endpoints[0] = api.Endpoints{
|
||||||
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
|
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
|
||||||
@ -521,7 +521,7 @@ func TestStickyLoadBalanceWorksWithMultipleEndpointsAndUpdates(t *testing.T) {
|
|||||||
t.Errorf("Didn't fail with non-existent service")
|
t.Errorf("Didn't fail with non-existent service")
|
||||||
}
|
}
|
||||||
|
|
||||||
loadBalancer.NewService(service, api.AffinityTypeClientIP, 0)
|
loadBalancer.NewService(service, api.ServiceAffinityClientIP, 0)
|
||||||
endpoints := make([]api.Endpoints, 1)
|
endpoints := make([]api.Endpoints, 1)
|
||||||
endpoints[0] = api.Endpoints{
|
endpoints[0] = api.Endpoints{
|
||||||
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
|
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
|
||||||
@ -581,7 +581,7 @@ func TestStickyLoadBalanceWorksWithServiceRemoval(t *testing.T) {
|
|||||||
if err == nil || len(endpoint) != 0 {
|
if err == nil || len(endpoint) != 0 {
|
||||||
t.Errorf("Didn't fail with non-existent service")
|
t.Errorf("Didn't fail with non-existent service")
|
||||||
}
|
}
|
||||||
loadBalancer.NewService(fooService, api.AffinityTypeClientIP, 0)
|
loadBalancer.NewService(fooService, api.ServiceAffinityClientIP, 0)
|
||||||
endpoints := make([]api.Endpoints, 2)
|
endpoints := make([]api.Endpoints, 2)
|
||||||
endpoints[0] = api.Endpoints{
|
endpoints[0] = api.Endpoints{
|
||||||
ObjectMeta: api.ObjectMeta{Name: fooService.Name, Namespace: fooService.Namespace},
|
ObjectMeta: api.ObjectMeta{Name: fooService.Name, Namespace: fooService.Namespace},
|
||||||
@ -593,7 +593,7 @@ func TestStickyLoadBalanceWorksWithServiceRemoval(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
barService := ServicePortName{types.NamespacedName{"testnamespace", "bar"}, ""}
|
barService := ServicePortName{types.NamespacedName{"testnamespace", "bar"}, ""}
|
||||||
loadBalancer.NewService(barService, api.AffinityTypeClientIP, 0)
|
loadBalancer.NewService(barService, api.ServiceAffinityClientIP, 0)
|
||||||
endpoints[1] = api.Endpoints{
|
endpoints[1] = api.Endpoints{
|
||||||
ObjectMeta: api.ObjectMeta{Name: barService.Name, Namespace: barService.Namespace},
|
ObjectMeta: api.ObjectMeta{Name: barService.Name, Namespace: barService.Namespace},
|
||||||
Subsets: []api.EndpointSubset{
|
Subsets: []api.EndpointSubset{
|
||||||
|
@ -67,7 +67,7 @@ func TestServiceRegistryCreate(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -108,7 +108,7 @@ func TestServiceStorageValidatesCreate(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: ""},
|
ObjectMeta: api.ObjectMeta{Name: ""},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -119,7 +119,7 @@ func TestServiceStorageValidatesCreate(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
}},
|
}},
|
||||||
@ -161,7 +161,7 @@ func TestServiceRegistryUpdate(t *testing.T) {
|
|||||||
ResourceVersion: svc.ResourceVersion},
|
ResourceVersion: svc.ResourceVersion},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz2"},
|
Selector: map[string]string{"bar": "baz2"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -204,7 +204,7 @@ func TestServiceStorageValidatesUpdate(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: ""},
|
ObjectMeta: api.ObjectMeta{Name: ""},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -215,7 +215,7 @@ func TestServiceStorageValidatesUpdate(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"ThisSelectorFailsValidation": "ok"},
|
Selector: map[string]string{"ThisSelectorFailsValidation": "ok"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -242,7 +242,7 @@ func TestServiceRegistryExternalService(t *testing.T) {
|
|||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
CreateExternalLoadBalancer: true,
|
CreateExternalLoadBalancer: true,
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -269,7 +269,7 @@ func TestServiceRegistryDelete(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -291,7 +291,7 @@ func TestServiceRegistryDeleteExternal(t *testing.T) {
|
|||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
CreateExternalLoadBalancer: true,
|
CreateExternalLoadBalancer: true,
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -315,7 +315,7 @@ func TestServiceRegistryUpdateExternalService(t *testing.T) {
|
|||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
CreateExternalLoadBalancer: false,
|
CreateExternalLoadBalancer: false,
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -351,7 +351,7 @@ func TestServiceRegistryUpdateMultiPortExternalService(t *testing.T) {
|
|||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
CreateExternalLoadBalancer: true,
|
CreateExternalLoadBalancer: true,
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Name: "p",
|
Name: "p",
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
@ -490,7 +490,7 @@ func TestServiceRegistryIPAllocation(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -511,7 +511,7 @@ func TestServiceRegistryIPAllocation(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: "bar"},
|
ObjectMeta: api.ObjectMeta{Name: "bar"},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -540,7 +540,7 @@ func TestServiceRegistryIPAllocation(t *testing.T) {
|
|||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
PortalIP: testIP,
|
PortalIP: testIP,
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -565,7 +565,7 @@ func TestServiceRegistryIPReallocation(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -588,7 +588,7 @@ func TestServiceRegistryIPReallocation(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: "bar"},
|
ObjectMeta: api.ObjectMeta{Name: "bar"},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -613,7 +613,7 @@ func TestServiceRegistryIPUpdate(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
|
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
@ -657,7 +657,7 @@ func TestServiceRegistryIPExternalLoadBalancer(t *testing.T) {
|
|||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"bar": "baz"},
|
Selector: map[string]string{"bar": "baz"},
|
||||||
CreateExternalLoadBalancer: true,
|
CreateExternalLoadBalancer: true,
|
||||||
SessionAffinity: api.AffinityTypeNone,
|
SessionAffinity: api.ServiceAffinityNone,
|
||||||
Ports: []api.ServicePort{{
|
Ports: []api.ServicePort{{
|
||||||
Port: 6502,
|
Port: 6502,
|
||||||
Protocol: api.ProtocolTCP,
|
Protocol: api.ProtocolTCP,
|
||||||
|
Loading…
Reference in New Issue
Block a user