proxy/ipvs: return non-nil error when there is no matched IPVS service in syncEndpoint

Signed-off-by: chengzhycn <chengzhycn@gmail.com>
This commit is contained in:
chengzhycn 2021-01-05 18:07:21 +08:00
parent ab8dda3c88
commit c6c74f2a5d

View File

@ -18,6 +18,7 @@ package ipvs
import (
"bytes"
"errors"
"fmt"
"io"
"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 {
appliedVirtualServer, err := proxier.ipvs.GetVirtualServer(vs)
if err != nil || appliedVirtualServer == nil {
if err != nil {
klog.Errorf("Failed to get IPVS service, error: %v", err)
return err
}
if appliedVirtualServer == nil {
return errors.New("IPVS virtual service does not exist")
}
// curEndpoints represents IPVS destinations listed from current system.
curEndpoints := sets.NewString()