Change:
validateEndpointsPortsOrFail(cs, ns, serviceName, portsByPodName{}) }) <ins> ginkgo.It("should be updated after adding or deleting ports ", func() { serviceName := "edit-port-test" ns := f.Namespace.Name jig := e2eservice.NewTestJig(cs, ns, serviceName) svc1port := "svc1" ginkgo.By("creating service " + serviceName + " in namespace " + ns) svc, err := jig.CreateTCPService(func(service *v1.Service) { service.Spec.Ports = []v1.ServicePort{ { Name:       "portname1", Port:       80, TargetPort: intstr.FromString(svc1port), }, } }) framework.ExpectNoError(err) validateEndpointsPortsOrFail(cs, ns, serviceName, portsByPodName{}) podname1 := "pod1" port1 := 100 containerPorts1 := []v1.ContainerPort{ { Name:          svc1port, ContainerPort: int32(port1), }, } createPodOrFail(f, ns, podname1, jig.Labels, containerPorts1, "netexec", "--http-port", strconv.Itoa(port1)) validateEndpointsPortsOrFail(cs, ns, serviceName, portsByPodName{podname1: {port1}}) ginkgo.By("Checking if the Service " + serviceName + " forwards traffic to " + podname1) execPod := e2epod.CreateExecPodOrFail(cs, ns, "execpod", nil) err = jig.CheckServiceReachability(svc, execPod) framework.ExpectNoError(err) ginkgo.By("Adding a new port to service " + serviceName) svc2port := "svc2" svc, err = jig.UpdateService(func(s *v1.Service) { s.Spec.Ports = []v1.ServicePort{ { Name:       "portname1", Port:       80, TargetPort: intstr.FromString(svc1port), }, { Name:       "portname2", Port:       81, TargetPort: intstr.FromString(svc2port), }, } }) framework.ExpectNoError(err) ginkgo.By("Adding a new endpoint to the new port ") podname2 := "pod2" port2 := 101 containerPorts2 := []v1.ContainerPort{ { Name:          svc2port, ContainerPort: int32(port2), }, } createPodOrFail(f, ns, podname2, jig.Labels, containerPorts2, "netexec", "--http-port", strconv.Itoa(port2)) validateEndpointsPortsOrFail(cs, ns, serviceName, portsByPodName{podname1: {port1}, podname2: {port2}}) ginkgo.By("Checking if the Service forwards traffic to " + podname1 + " and " + podname2) err = jig.CheckServiceReachability(svc, execPod) framework.ExpectNoError(err) ginkgo.By("Deleting a port from service " + serviceName) svc, err = jig.UpdateService(func(s *v1.Service) { s.Spec.Ports = []v1.ServicePort{ { Name:       "portname1", Port:       80, TargetPort: intstr.FromString(svc1port), }, } }) framework.ExpectNoError(err) ginkgo.By("Checking if the Service forwards traffic to " + podname1 + " and not forwards to " + podname2) validateEndpointsPortsOrFail(cs, ns, serviceName, portsByPodName{podname1: {port1}}) err = jig.CheckServiceReachability(svc, execPod) framework.ExpectNoError(err) }) </ins> ginkgo.It("should preserve source pod IP for traffic thru service cluster IP [LinuxOnly]", func() { // this test is creating a pod with HostNetwork=true, which is not supported on Windows. e2eskipper.SkipIfNodeOSDistroIs("windows")

Discussion:
We recently found that, when tweaking service objects manually, the following bug can exist (in alternative kube proxy implementations KPNG ) , but it's not caught in the sig-network e2es... make a service Confirm that the service works Edit the service by adding a new port to it Confirm both ports work Delete the port Confirm these still work We need to what port mutation tests we currently do what is supported tests for the missing deltas Breaks. However, we pass it seems, most or all of the sig-network e2es. I think we have a missing e2e test. Im pretty sure we support port mutation, right? If not plz close this. e2e tests for sig-network would have coverage for service proxying robustness after port addition/deletion Reproducer is above, we only noticed this lack of test coverage b/c of a broken service proxy :) No response main any <details</details<details</details<details</details<details</details
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/sig network
am happy to pair with someone wanting to get starte on this, or might be taking this on, and she can help delegate out work (there might be several tests to write, not sure yet)
Thanks I'll work on this! Please assign this to me.
hiya xinqi -that test can be maybe used as a scaffold - but its different it adds / deleted endpoints , we want to edit the service by "adding" a new port type to it.. i.e. what we really want is to actually change the service object, i.e. to rewrite the service type (it might start out as ClusterIp, then we change it to nodeport, and so on). Im not sure what the matrix of valid mutations are but, we can look together if you want sometime today.
Thanks Jay, I see your point. I'll start a draft pr today and then we can pair and discuss about it based on my pr.