Remove some useless error checks
Don't return errors in the event of programmer errors, and don't double-check things that were already validated.
This commit is contained in:
		@@ -79,10 +79,6 @@ func newProxyServer(
 | 
				
			|||||||
	config *proxyconfigapi.KubeProxyConfiguration,
 | 
						config *proxyconfigapi.KubeProxyConfiguration,
 | 
				
			||||||
	master string) (*ProxyServer, error) {
 | 
						master string) (*ProxyServer, error) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if config == nil {
 | 
					 | 
				
			||||||
		return nil, errors.New("config is required")
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if c, err := configz.New(proxyconfigapi.GroupName); err == nil {
 | 
						if c, err := configz.New(proxyconfigapi.GroupName); err == nil {
 | 
				
			||||||
		c.Set(config)
 | 
							c.Set(config)
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
@@ -188,10 +184,6 @@ func newProxyServer(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if proxyMode == proxyconfigapi.ProxyModeIPTables {
 | 
						if proxyMode == proxyconfigapi.ProxyModeIPTables {
 | 
				
			||||||
		klog.InfoS("Using iptables Proxier")
 | 
							klog.InfoS("Using iptables Proxier")
 | 
				
			||||||
		if config.IPTables.MasqueradeBit == nil {
 | 
					 | 
				
			||||||
			// MasqueradeBit must be specified or defaulted.
 | 
					 | 
				
			||||||
			return nil, fmt.Errorf("unable to read IPTables MasqueradeBit from config")
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if dualStack {
 | 
							if dualStack {
 | 
				
			||||||
			klog.InfoS("kube-proxy running in dual-stack mode", "ipFamily", iptInterface.Protocol())
 | 
								klog.InfoS("kube-proxy running in dual-stack mode", "ipFamily", iptInterface.Protocol())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,10 +51,6 @@ func NewProxyServer(o *Options) (*ProxyServer, error) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func newProxyServer(config *proxyconfigapi.KubeProxyConfiguration, master string) (*ProxyServer, error) {
 | 
					func newProxyServer(config *proxyconfigapi.KubeProxyConfiguration, master string) (*ProxyServer, error) {
 | 
				
			||||||
	if config == nil {
 | 
					 | 
				
			||||||
		return nil, errors.New("config is required")
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if c, err := configz.New(proxyconfigapi.GroupName); err == nil {
 | 
						if c, err := configz.New(proxyconfigapi.GroupName); err == nil {
 | 
				
			||||||
		c.Set(config)
 | 
							c.Set(config)
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user