Skip to content

Commit 0d90d1f

Browse files
committed
Revert "Merge pull request kubernetes#118895 from RyanAoh/kep-1860"
This reverts commit 890a6c8, reversing changes made to 4f60a8d.
1 parent 201f807 commit 0d90d1f

35 files changed

+638
-1874
lines changed

api/openapi-spec/swagger.json

-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/openapi-spec/v3/api__v1_openapi.json

-4
Original file line numberDiff line numberDiff line change
@@ -3102,10 +3102,6 @@
31023102
"description": "IP is set for load-balancer ingress points that are IP based (typically GCE or OpenStack load-balancers)",
31033103
"type": "string"
31043104
},
3105-
"ipMode": {
3106-
"description": "IPMode specifies how the load-balancer IP behaves, and may only be specified when the ip field is specified. Setting this to \"VIP\" indicates that traffic is delivered to the node with the destination set to the load-balancer's IP and port. Setting this to \"Proxy\" indicates that traffic is delivered to the node or pod with the destination set to the node's IP and node port or the pod's IP and port. Service implementations may use this information to adjust traffic routing.",
3107-
"type": "string"
3108-
},
31093105
"ports": {
31103106
"description": "Ports is a list of records of service ports If used, every port defined in the service should have an entry in it",
31113107
"items": {

pkg/apis/core/types.go

-21
Original file line numberDiff line numberDiff line change
@@ -4074,15 +4074,6 @@ type LoadBalancerIngress struct {
40744074
// +optional
40754075
Hostname string
40764076

4077-
// IPMode specifies how the load-balancer IP behaves, and may only be specified when the ip field is specified.
4078-
// Setting this to "VIP" indicates that traffic is delivered to the node with
4079-
// the destination set to the load-balancer's IP and port.
4080-
// Setting this to "Proxy" indicates that traffic is delivered to the node or pod with
4081-
// the destination set to the node's IP and node port or the pod's IP and port.
4082-
// Service implementations may use this information to adjust traffic routing.
4083-
// +optional
4084-
IPMode *LoadBalancerIPMode
4085-
40864077
// Ports is a list of records of service ports
40874078
// If used, every port defined in the service should have an entry in it
40884079
// +optional
@@ -6155,15 +6146,3 @@ type PortStatus struct {
61556146
// +kubebuilder:validation:MaxLength=316
61566147
Error *string
61576148
}
6158-
6159-
// LoadBalancerIPMode represents the mode of the LoadBalancer ingress IP
6160-
type LoadBalancerIPMode string
6161-
6162-
const (
6163-
// LoadBalancerIPModeVIP indicates that traffic is delivered to the node with
6164-
// the destination set to the load-balancer's IP and port.
6165-
LoadBalancerIPModeVIP LoadBalancerIPMode = "VIP"
6166-
// LoadBalancerIPModeProxy indicates that traffic is delivered to the node or pod with
6167-
// the destination set to the node's IP and port or the pod's IP and port.
6168-
LoadBalancerIPModeProxy LoadBalancerIPMode = "Proxy"
6169-
)

pkg/apis/core/v1/defaults.go

-13
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,6 @@ func SetDefaults_Service(obj *v1.Service) {
142142
obj.Spec.AllocateLoadBalancerNodePorts = pointer.Bool(true)
143143
}
144144
}
145-
146-
if obj.Spec.Type == v1.ServiceTypeLoadBalancer {
147-
if utilfeature.DefaultFeatureGate.Enabled(features.LoadBalancerIPMode) {
148-
ipMode := v1.LoadBalancerIPModeVIP
149-
150-
for i, ing := range obj.Status.LoadBalancer.Ingress {
151-
if ing.IP != "" && ing.IPMode == nil {
152-
obj.Status.LoadBalancer.Ingress[i].IPMode = &ipMode
153-
}
154-
}
155-
}
156-
}
157-
158145
}
159146
func SetDefaults_Pod(obj *v1.Pod) {
160147
// If limits are specified, but requests are not, default requests to limits

pkg/apis/core/v1/defaults_test.go

-68
Original file line numberDiff line numberDiff line change
@@ -1221,74 +1221,6 @@ func TestSetDefaultServiceSessionAffinityConfig(t *testing.T) {
12211221
}
12221222
}
12231223

1224-
func TestSetDefaultServiceLoadbalancerIPMode(t *testing.T) {
1225-
modeVIP := v1.LoadBalancerIPModeVIP
1226-
modeProxy := v1.LoadBalancerIPModeProxy
1227-
testCases := []struct {
1228-
name string
1229-
ipModeEnabled bool
1230-
svc *v1.Service
1231-
expectedIPMode []*v1.LoadBalancerIPMode
1232-
}{
1233-
{
1234-
name: "Set IP but not set IPMode with LoadbalancerIPMode disabled",
1235-
ipModeEnabled: false,
1236-
svc: &v1.Service{
1237-
Spec: v1.ServiceSpec{Type: v1.ServiceTypeLoadBalancer},
1238-
Status: v1.ServiceStatus{
1239-
LoadBalancer: v1.LoadBalancerStatus{
1240-
Ingress: []v1.LoadBalancerIngress{{
1241-
IP: "1.2.3.4",
1242-
}},
1243-
},
1244-
}},
1245-
expectedIPMode: []*v1.LoadBalancerIPMode{nil},
1246-
}, {
1247-
name: "Set IP but bot set IPMode with LoadbalancerIPMode enabled",
1248-
ipModeEnabled: true,
1249-
svc: &v1.Service{
1250-
Spec: v1.ServiceSpec{Type: v1.ServiceTypeLoadBalancer},
1251-
Status: v1.ServiceStatus{
1252-
LoadBalancer: v1.LoadBalancerStatus{
1253-
Ingress: []v1.LoadBalancerIngress{{
1254-
IP: "1.2.3.4",
1255-
}},
1256-
},
1257-
}},
1258-
expectedIPMode: []*v1.LoadBalancerIPMode{&modeVIP},
1259-
}, {
1260-
name: "Both IP and IPMode are set with LoadbalancerIPMode enabled",
1261-
ipModeEnabled: true,
1262-
svc: &v1.Service{
1263-
Spec: v1.ServiceSpec{Type: v1.ServiceTypeLoadBalancer},
1264-
Status: v1.ServiceStatus{
1265-
LoadBalancer: v1.LoadBalancerStatus{
1266-
Ingress: []v1.LoadBalancerIngress{{
1267-
IP: "1.2.3.4",
1268-
IPMode: &modeProxy,
1269-
}},
1270-
},
1271-
}},
1272-
expectedIPMode: []*v1.LoadBalancerIPMode{&modeProxy},
1273-
},
1274-
}
1275-
1276-
for _, tc := range testCases {
1277-
t.Run(tc.name, func(t *testing.T) {
1278-
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.LoadBalancerIPMode, tc.ipModeEnabled)()
1279-
obj := roundTrip(t, runtime.Object(tc.svc))
1280-
svc := obj.(*v1.Service)
1281-
for i, s := range svc.Status.LoadBalancer.Ingress {
1282-
got := s.IPMode
1283-
expected := tc.expectedIPMode[i]
1284-
if !reflect.DeepEqual(got, expected) {
1285-
t.Errorf("Expected IPMode %v, got %v", tc.expectedIPMode[i], s.IPMode)
1286-
}
1287-
}
1288-
})
1289-
}
1290-
}
1291-
12921224
func TestSetDefaultSecretVolumeSource(t *testing.T) {
12931225
s := v1.PodSpec{}
12941226
s.Volumes = []v1.Volume{

pkg/apis/core/v1/zz_generated.conversion.go

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/core/validation/validation.go

-15
Original file line numberDiff line numberDiff line change
@@ -7048,10 +7048,6 @@ func ValidatePodLogOptions(opts *core.PodLogOptions) field.ErrorList {
70487048
return allErrs
70497049
}
70507050

7051-
var (
7052-
supportedLoadBalancerIPMode = sets.NewString(string(core.LoadBalancerIPModeVIP), string(core.LoadBalancerIPModeProxy))
7053-
)
7054-
70557051
// ValidateLoadBalancerStatus validates required fields on a LoadBalancerStatus
70567052
func ValidateLoadBalancerStatus(status *core.LoadBalancerStatus, fldPath *field.Path) field.ErrorList {
70577053
allErrs := field.ErrorList{}
@@ -7062,17 +7058,6 @@ func ValidateLoadBalancerStatus(status *core.LoadBalancerStatus, fldPath *field.
70627058
allErrs = append(allErrs, field.Invalid(idxPath.Child("ip"), ingress.IP, "must be a valid IP address"))
70637059
}
70647060
}
7065-
7066-
if utilfeature.DefaultFeatureGate.Enabled(features.LoadBalancerIPMode) && ingress.IPMode == nil {
7067-
if len(ingress.IP) > 0 {
7068-
allErrs = append(allErrs, field.Required(idxPath.Child("ipMode"), "must be specified when `ip` is set"))
7069-
}
7070-
} else if ingress.IPMode != nil && len(ingress.IP) == 0 {
7071-
allErrs = append(allErrs, field.Forbidden(idxPath.Child("ipMode"), "may not be specified when `ip` is not set"))
7072-
} else if ingress.IPMode != nil && !supportedLoadBalancerIPMode.Has(string(*ingress.IPMode)) {
7073-
allErrs = append(allErrs, field.NotSupported(idxPath.Child("ipMode"), ingress.IPMode, supportedLoadBalancerIPMode.List()))
7074-
}
7075-
70767061
if len(ingress.Hostname) > 0 {
70777062
for _, msg := range validation.IsDNS1123Subdomain(ingress.Hostname) {
70787063
allErrs = append(allErrs, field.Invalid(idxPath.Child("hostname"), ingress.Hostname, msg))

pkg/apis/core/validation/validation_test.go

-84
Original file line numberDiff line numberDiff line change
@@ -23368,87 +23368,3 @@ func TestValidateDynamicResourceAllocation(t *testing.T) {
2336823368
}
2336923369
})
2337023370
}
23371-
23372-
func TestValidateLoadBalancerStatus(t *testing.T) {
23373-
ipModeVIP := core.LoadBalancerIPModeVIP
23374-
ipModeProxy := core.LoadBalancerIPModeProxy
23375-
ipModeDummy := core.LoadBalancerIPMode("dummy")
23376-
23377-
testCases := []struct {
23378-
name string
23379-
ipModeEnabled bool
23380-
tweakLBStatus func(s *core.LoadBalancerStatus)
23381-
numErrs int
23382-
}{
23383-
/* LoadBalancerIPMode*/
23384-
{
23385-
name: "valid vip ipMode",
23386-
ipModeEnabled: true,
23387-
tweakLBStatus: func(s *core.LoadBalancerStatus) {
23388-
s.Ingress = []core.LoadBalancerIngress{{
23389-
IP: "1.2.3.4",
23390-
IPMode: &ipModeVIP,
23391-
}}
23392-
},
23393-
numErrs: 0,
23394-
}, {
23395-
name: "valid proxy ipMode",
23396-
ipModeEnabled: true,
23397-
tweakLBStatus: func(s *core.LoadBalancerStatus) {
23398-
s.Ingress = []core.LoadBalancerIngress{{
23399-
IP: "1.2.3.4",
23400-
IPMode: &ipModeProxy,
23401-
}}
23402-
},
23403-
numErrs: 0,
23404-
}, {
23405-
name: "invalid ipMode",
23406-
ipModeEnabled: true,
23407-
tweakLBStatus: func(s *core.LoadBalancerStatus) {
23408-
s.Ingress = []core.LoadBalancerIngress{{
23409-
IP: "1.2.3.4",
23410-
IPMode: &ipModeDummy,
23411-
}}
23412-
},
23413-
numErrs: 1,
23414-
}, {
23415-
name: "missing ipMode with LoadbalancerIPMode enabled",
23416-
ipModeEnabled: true,
23417-
tweakLBStatus: func(s *core.LoadBalancerStatus) {
23418-
s.Ingress = []core.LoadBalancerIngress{{
23419-
IP: "1.2.3.4",
23420-
}}
23421-
},
23422-
numErrs: 1,
23423-
}, {
23424-
name: "missing ipMode with LoadbalancerIPMode disabled",
23425-
ipModeEnabled: false,
23426-
tweakLBStatus: func(s *core.LoadBalancerStatus) {
23427-
s.Ingress = []core.LoadBalancerIngress{{
23428-
IP: "1.2.3.4",
23429-
}}
23430-
},
23431-
numErrs: 0,
23432-
}, {
23433-
name: "missing ip with ipMode present",
23434-
ipModeEnabled: true,
23435-
tweakLBStatus: func(s *core.LoadBalancerStatus) {
23436-
s.Ingress = []core.LoadBalancerIngress{{
23437-
IPMode: &ipModeProxy,
23438-
}}
23439-
},
23440-
numErrs: 1,
23441-
},
23442-
}
23443-
for _, tc := range testCases {
23444-
t.Run(tc.name, func(t *testing.T) {
23445-
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.LoadBalancerIPMode, tc.ipModeEnabled)()
23446-
s := core.LoadBalancerStatus{}
23447-
tc.tweakLBStatus(&s)
23448-
errs := ValidateLoadBalancerStatus(&s, field.NewPath("status"))
23449-
if len(errs) != tc.numErrs {
23450-
t.Errorf("Unexpected error list for case %q(expected:%v got %v) - Errors:\n %v", tc.name, tc.numErrs, len(errs), errs.ToAggregate())
23451-
}
23452-
})
23453-
}
23454-
}

pkg/apis/core/zz_generated.deepcopy.go

-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/features/kube_features.go

-8
Original file line numberDiff line numberDiff line change
@@ -934,12 +934,6 @@ const (
934934
//
935935
// Enables In-Place Pod Vertical Scaling
936936
InPlacePodVerticalScaling featuregate.Feature = "InPlacePodVerticalScaling"
937-
938-
// owner: @Sh4d1,@RyanAoh
939-
// kep: http://kep.k8s.io/1860
940-
// alpha: v1.29
941-
// LoadBalancerIPMode enables the IPMode field in the LoadBalancerIngress status of a Service
942-
LoadBalancerIPMode featuregate.Feature = "LoadBalancerIPMode"
943937
)
944938

945939
func init() {
@@ -1191,8 +1185,6 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
11911185

11921186
PodIndexLabel: {Default: true, PreRelease: featuregate.Beta},
11931187

1194-
LoadBalancerIPMode: {Default: false, PreRelease: featuregate.Alpha},
1195-
11961188
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
11971189
// unintentionally on either side:
11981190

pkg/generated/openapi/zz_generated.openapi.go

-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/proxy/conntrack/cleanup.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func deleteStaleServiceConntrackEntries(isIPv6 bool, exec utilexec.Interface, sv
5050
for _, extIP := range svcInfo.ExternalIPStrings() {
5151
conntrackCleanupServiceIPs.Insert(extIP)
5252
}
53-
for _, lbIP := range svcInfo.LoadBalancerVIPStrings() {
53+
for _, lbIP := range svcInfo.LoadBalancerIPStrings() {
5454
conntrackCleanupServiceIPs.Insert(lbIP)
5555
}
5656
nodePort := svcInfo.NodePort()
@@ -100,7 +100,7 @@ func deleteStaleEndpointConntrackEntries(exec utilexec.Interface, svcPortMap pro
100100
klog.ErrorS(err, "Failed to delete endpoint connections for externalIP", "servicePortName", epSvcPair.ServicePortName, "externalIP", extIP)
101101
}
102102
}
103-
for _, lbIP := range svcInfo.LoadBalancerVIPStrings() {
103+
for _, lbIP := range svcInfo.LoadBalancerIPStrings() {
104104
err := ClearEntriesForNAT(exec, lbIP, endpointIP, v1.ProtocolUDP)
105105
if err != nil {
106106
klog.ErrorS(err, "Failed to delete endpoint connections for LoadBalancerIP", "servicePortName", epSvcPair.ServicePortName, "loadBalancerIP", lbIP)

pkg/proxy/iptables/proxier.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ func (proxier *Proxier) syncProxyRules() {
10241024
// create a firewall chain.
10251025
loadBalancerTrafficChain := externalTrafficChain
10261026
fwChain := svcInfo.firewallChainName
1027-
usesFWChain := hasEndpoints && len(svcInfo.LoadBalancerVIPStrings()) > 0 && len(svcInfo.LoadBalancerSourceRanges()) > 0
1027+
usesFWChain := hasEndpoints && len(svcInfo.LoadBalancerIPStrings()) > 0 && len(svcInfo.LoadBalancerSourceRanges()) > 0
10281028
if usesFWChain {
10291029
activeNATChains[fwChain] = true
10301030
loadBalancerTrafficChain = fwChain
@@ -1116,7 +1116,7 @@ func (proxier *Proxier) syncProxyRules() {
11161116
}
11171117

11181118
// Capture load-balancer ingress.
1119-
for _, lbip := range svcInfo.LoadBalancerVIPStrings() {
1119+
for _, lbip := range svcInfo.LoadBalancerIPStrings() {
11201120
if hasEndpoints {
11211121
natRules.Write(
11221122
"-A", string(kubeServicesChain),
@@ -1141,7 +1141,7 @@ func (proxier *Proxier) syncProxyRules() {
11411141
// Either no endpoints at all (REJECT) or no endpoints for
11421142
// external traffic (DROP anything that didn't get short-circuited
11431143
// by the EXT chain.)
1144-
for _, lbip := range svcInfo.LoadBalancerVIPStrings() {
1144+
for _, lbip := range svcInfo.LoadBalancerIPStrings() {
11451145
filterRules.Write(
11461146
"-A", string(kubeExternalServicesChain),
11471147
"-m", "comment", "--comment", externalTrafficFilterComment,
@@ -1319,7 +1319,7 @@ func (proxier *Proxier) syncProxyRules() {
13191319
// will loop back with the source IP set to the VIP. We
13201320
// need the following rules to allow requests from this node.
13211321
if allowFromNode {
1322-
for _, lbip := range svcInfo.LoadBalancerVIPStrings() {
1322+
for _, lbip := range svcInfo.LoadBalancerIPStrings() {
13231323
natRules.Write(
13241324
args,
13251325
"-s", lbip,

0 commit comments

Comments
 (0)