Merge pull request #49267 from MrHohn/kube-proxy-abort-when-healthz-fails

Automatic merge from submit-queue (batch tested with PRs 49992, 48861, 49267, 49356, 49886)

Emit event and retry when fail to start healthz server on kube-proxy

**What this PR does / why we need it**: Enhance kube-proxy's logic when fail to start healthz server.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: From #49263.

**Special notes for your reviewer**:
/assign @thockin @nicksardo @bowei 

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue
2017-08-02 05:16:01 -07:00
committed by GitHub
4 changed files with 38 additions and 23 deletions

View File

@@ -462,10 +462,17 @@ func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndEx
eventBroadcaster := record.NewBroadcaster()
recorder := eventBroadcaster.NewRecorder(scheme, v1.EventSource{Component: "kube-proxy", Host: hostname})
nodeRef := &v1.ObjectReference{
Kind: "Node",
Name: hostname,
UID: types.UID(hostname),
Namespace: "",
}
var healthzServer *healthcheck.HealthzServer
var healthzUpdater healthcheck.HealthzUpdater
if len(config.HealthzBindAddress) > 0 {
healthzServer = healthcheck.NewDefaultHealthzServer(config.HealthzBindAddress, 2*config.IPTables.SyncPeriod.Duration)
healthzServer = healthcheck.NewDefaultHealthzServer(config.HealthzBindAddress, 2*config.IPTables.SyncPeriod.Duration, recorder, nodeRef)
healthzUpdater = healthzServer
}
@@ -572,13 +579,6 @@ func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndEx
iptInterface.AddReloadFunc(proxier.Sync)
}
nodeRef := &v1.ObjectReference{
Kind: "Node",
Name: hostname,
UID: types.UID(hostname),
Namespace: "",
}
return &ProxyServer{
Client: client,
EventClient: eventClient,