Commit 40f7b595 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #48183 from xiangpengzhao/fix-proxy-panic

Automatic merge from submit-queue Fix kube-proxy panic when running with "--cleanup-iptables=true" **What this PR does / why we need it**: Save the `--cleanup-iptables` config for new ProxyServer when it's true. Also check if Broadcaster and EventClient are nil to avoid other potential panic. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #48177 **Special notes for your reviewer**: /cc @ncdc @irake99 **Release note**: ```release-note NONE ```
parents 40f33a4b f12dc94f
...@@ -447,7 +447,7 @@ func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndEx ...@@ -447,7 +447,7 @@ func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndEx
// We omit creation of pretty much everything if we run in cleanup mode // We omit creation of pretty much everything if we run in cleanup mode
if cleanupAndExit { if cleanupAndExit {
return &ProxyServer{IptInterface: iptInterface}, nil return &ProxyServer{IptInterface: iptInterface, CleanupAndExit: cleanupAndExit}, nil
} }
client, eventClient, err := createClients(config.ClientConnection, master) client, eventClient, err := createClients(config.ClientConnection, master)
...@@ -627,7 +627,9 @@ func (s *ProxyServer) Run() error { ...@@ -627,7 +627,9 @@ func (s *ProxyServer) Run() error {
} }
} }
s.Broadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: s.EventClient.Events("")}) if s.Broadcaster != nil && s.EventClient != nil {
s.Broadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: s.EventClient.Events("")})
}
// Start up a healthz server if requested // Start up a healthz server if requested
if s.HealthzServer != nil { if s.HealthzServer != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment