mirror of https://github.com/k3s-io/k3s
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 ```pull/6/head
commit
40f7b595b3
|
@ -447,7 +447,7 @@ func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndEx
|
|||
|
||||
// We omit creation of pretty much everything if we run in cleanup mode
|
||||
if cleanupAndExit {
|
||||
return &ProxyServer{IptInterface: iptInterface}, nil
|
||||
return &ProxyServer{IptInterface: iptInterface, CleanupAndExit: cleanupAndExit}, nil
|
||||
}
|
||||
|
||||
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
|
||||
if s.HealthzServer != nil {
|
||||
|
|
Loading…
Reference in New Issue