<p dir="auto">BUG REPORT</p>
<p dir="auto"><strong>Kubernetes version</strong> : v1.3.2</p>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li>setup kubernetes cluster on 4 VMs of ubuntu 14.04, 1 master and 3 nodes</li>
<li>bring up by kube-up.sh with PROVIDER=ubuntu</li>
<li><strong>Kernel</strong> : 3.13.0-92-generic</li>
</ul>
<p dir="auto"><strong>What happened</strong>:<br>
when do kubectl get nodes returned:</p>
<p dir="auto">NAME             STATUS     AGE<br>
*.205   Ready      1h<br>
*.205   NotReady   14d<br>
*.206   Ready      14d<br>
*.207   Ready      14d</p>
<p dir="auto">so there are two nodes with the same name *.205 and one is Notready</p>
<p dir="auto"><strong>What you expected to happen</strong>:<br>
this probably happened after I restart kube-controller and api-server</p>
<p dir="auto">restart kubelet and tail kubelet.log on *.205 shows:<br>
I0819 09:54:08.146564   17698 factory.go:54] Registering systemd factory<br>
I0819 09:54:08.148318   17698 factory.go:86] Registering Raw factory<br>
I0819 09:54:08.150438   17698 manager.go:1072] Started watching for new ooms in manager<br>
I0819 09:54:08.150552   17698 oomparser.go:200] OOM parser using kernel log file: "/var/log/kern.log"<br>
I0819 09:54:08.151820   17698 manager.go:281] Starting recovery of all containers<br>
I0819 09:54:08.162525   17698 manager.go:286] Recovery completed<br>
I0819 09:54:08.256878   17698 kubelet.go:1187] *<em>Node <em>.205 was previously registered</em></em></p>
<p dir="auto">if add --register-node=false to /etc/default/kubelet and tail log shows:<br>
I0819 09:56:52.330062   18421 factory.go:54] Registering systemd factory<br>
I0819 09:56:52.331063   18421 factory.go:86] Registering Raw factory<br>
I0819 09:56:52.332105   18421 manager.go:1072] Started watching for new ooms in manager<br>
I0819 09:56:52.332225   18421 oomparser.go:200] OOM parser using kernel log file: "/var/log/kern.log"<br>
I0819 09:56:52.333547   18421 manager.go:281] Starting recovery of all containers<br>
I0819 09:56:52.348541   18421 manager.go:286] <strong>Recovery completed</strong></p>
<p dir="auto">the node *205 is working now but not stable and when I do setup of weave-scope which launch pod on each node would have two pods on two duplicate *205 node and the one who is <strong>Not Ready</strong> has the pod pending</p>
<p dir="auto"><strong>Is there any way to remove that dupliacte useless node?</strong></p>
<p dir="auto"><strong>What:</strong></p>
<p dir="auto">Propose refactor pkg/proxy/config/config.go</p>
<p dir="auto"><a href="https://github.com/kubernetes/kubernetes/blob/master/pkg/proxy/config/config.go">https://github.com/kubernetes/kubernetes/blob/master/pkg/proxy/config/config.go</a></p>
<p dir="auto"><strong>Why:</strong></p>
<p dir="auto">In  pkg/proxy/config/config.go, there are many identical codes between Service and Endpoints.</p>
<ul dir="auto">
<li>ServiceUpdate VS. EndpointsUpdate</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="type ServiceUpdate struct {
    Services []api.Service
    Op       Operation
}"><pre class="notranslate"><code class="notranslate">type ServiceUpdate struct {
    Services []api.Service
    Op       Operation
}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="type EndpointsUpdate struct {
    Endpoints []api.Endpoints
    Op        Operation
}"><pre class="notranslate"><code class="notranslate">type EndpointsUpdate struct {
    Endpoints []api.Endpoints
    Op        Operation
}
</code></pre></div>
<ul dir="auto">
<li>ServiceConfigHandler VS. EndpointsConfigHandler</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="type ServiceConfigHandler interface {
    OnServiceUpdate(services []api.Service)
}"><pre class="notranslate"><code class="notranslate">type ServiceConfigHandler interface {
    OnServiceUpdate(services []api.Service)
}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="type EndpointsConfigHandler interface {
    OnEndpointsUpdate(endpoints []api.Endpoints)
}"><pre class="notranslate"><code class="notranslate">type EndpointsConfigHandler interface {
    OnEndpointsUpdate(endpoints []api.Endpoints)
}
</code></pre></div>
<ul dir="auto">
<li>EndpointsConfig VS. ServiceConfig</li>
</ul>
<p dir="auto">and almost the same <code class="notranslate">NewServiceConfig()</code> VS. <code class="notranslate">NewEndpointsConfig()</code>, <code class="notranslate">endpointsStore.Merge()</code> VS. <code class="notranslate">serviceStore.Merge()</code> and so on.</p>
<p dir="auto">So I think we can introduce an abstract layer which can generify both Service and Endpoints here. In this way, reuse some codes.</p>
<p dir="auto"><strong>How:</strong></p>
<p dir="auto">Move Service and Endpoints to interface{}, like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="type ObjectUpdate struct {
    Objects []interface{}
    Op        Operation
}"><pre class="notranslate"><code class="notranslate">type ObjectUpdate struct {
    Objects []interface{}
    Op        Operation
}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="type ObjectConfigHandler interface  {
    OnObjectUpdate(objects []interface{})
}"><pre class="notranslate"><code class="notranslate">type ObjectConfigHandler interface  {
    OnObjectUpdate(objects []interface{})
}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="type ObjectConfig struct {
    mux     *config.Mux
    bcaster *config.Broadcaster
    store   *objectStore
}"><pre class="notranslate"><code class="notranslate">type ObjectConfig struct {
    mux     *config.Mux
    bcaster *config.Broadcaster
    store   *objectStore
}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="func (s *objectStore) Merge(source string, change interface{}) error {
...
}"><pre class="notranslate"><code class="notranslate">func (s *objectStore) Merge(source string, change interface{}) error {
...
}
</code></pre></div>
<p dir="auto">...</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/thockin/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/thockin">@thockin</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/smarterclayton/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/smarterclayton">@smarterclayton</a></p>
<p dir="auto">What do you think about it?</p>
<p dir="auto">Thanks!</p>