mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #29732 from ping035627/ping035627-patch-0728
Automatic merge from submit-queue Optimise the getConntrackMax function The PR optimise the getConntrackMax function, make it more concise.
This commit is contained in:
		@@ -335,12 +335,13 @@ func (s *ProxyServer) Run() error {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func getConntrackMax(config *options.ProxyServerConfig) (int, error) {
 | 
					func getConntrackMax(config *options.ProxyServerConfig) (int, error) {
 | 
				
			||||||
	if config.ConntrackMax > 0 && config.ConntrackMaxPerCore > 0 {
 | 
						if config.ConntrackMax > 0 {
 | 
				
			||||||
 | 
							if config.ConntrackMaxPerCore > 0 {
 | 
				
			||||||
			return -1, fmt.Errorf("invalid config: ConntrackMax and ConntrackMaxPerCore are mutually exclusive")
 | 
								return -1, fmt.Errorf("invalid config: ConntrackMax and ConntrackMaxPerCore are mutually exclusive")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if config.ConntrackMax > 0 {
 | 
					 | 
				
			||||||
		return int(config.ConntrackMax), nil
 | 
							return int(config.ConntrackMax), nil
 | 
				
			||||||
	} else if config.ConntrackMaxPerCore > 0 {
 | 
						}
 | 
				
			||||||
 | 
						if config.ConntrackMaxPerCore > 0 {
 | 
				
			||||||
		return (int(config.ConntrackMaxPerCore) * runtime.NumCPU()), nil
 | 
							return (int(config.ConntrackMaxPerCore) * runtime.NumCPU()), nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0, nil
 | 
						return 0, nil
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user