Merge pull request #97716 from chengzhycn/syncEndpoint-error-return

proxy/ipvs: return non-nil error when there is no matched IPVS servic…
This commit is contained in:
Kubernetes Prow Robot 2021-01-07 12:44:54 -08:00 committed by GitHub
commit 5150d2f839
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ package ipvs
import ( import (
"bytes" "bytes"
"errors"
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
@ -2007,10 +2008,13 @@ func (proxier *Proxier) syncService(svcName string, vs *utilipvs.VirtualServer,
func (proxier *Proxier) syncEndpoint(svcPortName proxy.ServicePortName, onlyNodeLocalEndpoints bool, vs *utilipvs.VirtualServer) error { func (proxier *Proxier) syncEndpoint(svcPortName proxy.ServicePortName, onlyNodeLocalEndpoints bool, vs *utilipvs.VirtualServer) error {
appliedVirtualServer, err := proxier.ipvs.GetVirtualServer(vs) appliedVirtualServer, err := proxier.ipvs.GetVirtualServer(vs)
if err != nil || appliedVirtualServer == nil { if err != nil {
klog.Errorf("Failed to get IPVS service, error: %v", err) klog.Errorf("Failed to get IPVS service, error: %v", err)
return err return err
} }
if appliedVirtualServer == nil {
return errors.New("IPVS virtual service does not exist")
}
// curEndpoints represents IPVS destinations listed from current system. // curEndpoints represents IPVS destinations listed from current system.
curEndpoints := sets.NewString() curEndpoints := sets.NewString()