Fix kube-proxy panic when running with "--cleanup-iptables=true"

This commit is contained in:
xiangpengzhao 2017-06-28 16:43:00 +08:00
parent 165c94aa7b
commit f12dc94fa9
No known key found for this signature in database
GPG Key ID: A9FD03A856417C5B

View File

@ -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 {
} }
} }
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 {