diff --git a/pkg/master/controller.go b/pkg/master/controller.go index 09ba85c9c979d..ca40a6839195f 100644 --- a/pkg/master/controller.go +++ b/pkg/master/controller.go @@ -210,7 +210,7 @@ func (c *Controller) CreateOrUpdateMasterServiceIfNeeded(serviceName string, ser // maintained by this code, not by the pod selector Selector: nil, ClusterIP: serviceIP.String(), - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: serviceType, }, } diff --git a/pkg/master/controller_test.go b/pkg/master/controller_test.go index 6c5743267d988..e79c4af69b006 100644 --- a/pkg/master/controller_test.go +++ b/pkg/master/controller_test.go @@ -512,7 +512,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -560,7 +560,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -572,7 +572,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -593,7 +593,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -606,7 +606,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -626,7 +626,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -638,7 +638,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -658,7 +658,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -670,7 +670,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -690,7 +690,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -702,7 +702,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -722,7 +722,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -734,7 +734,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -754,7 +754,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeNodePort, }, }, @@ -766,7 +766,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -786,7 +786,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, }, @@ -838,7 +838,7 @@ func TestCreateOrUpdateMasterService(t *testing.T) { }, Selector: nil, ClusterIP: "1.2.3.4", - SessionAffinity: api.ServiceAffinityNone, + SessionAffinity: api.ServiceAffinityClientIP, Type: api.ServiceTypeClusterIP, }, },