[FIX] do not save kube node status to etcd

This commit is contained in:
barnett 2018-12-06 14:02:20 +08:00
parent 104f231d36
commit 45b0015737
3 changed files with 9 additions and 3 deletions

View File

@ -133,7 +133,9 @@ func (n *Cluster) worker() {
//UpdateNode update node info
func (n *Cluster) UpdateNode(node *client.HostNode) {
n.nodes[node.ID] = node
n.client.Put(option.Config.NodePath+"/"+node.ID, node.String())
saveNode := *node
saveNode.NodeStatus.KubeNode = nil
n.client.Put(option.Config.NodePath+"/"+node.ID, saveNode.String())
}
func (n *Cluster) getNodeFromKV(kv *mvccpb.KeyValue) *client.HostNode {

View File

@ -168,7 +168,9 @@ func (e *etcdClusterClient) RegistNode(node *HostNode) error {
func (e *etcdClusterClient) Update(h *HostNode) error {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
defer cancel()
_, err := e.conf.EtcdCli.Put(ctx, e.conf.NodePath+"/"+h.ID, h.String())
saveNode := *h
saveNode.NodeStatus.KubeNode = nil
_, err := e.conf.EtcdCli.Put(ctx, e.conf.NodePath+"/"+saveNode.ID, h.String())
return err
}

View File

@ -413,7 +413,9 @@ func (n *HostNode) String() string {
//Update update node info
func (n *HostNode) Update() (*client.PutResponse, error) {
return store.DefalutClient.Put(conf.Config.NodePath+"/"+n.ID, n.String())
savenode := *n
savenode.NodeStatus.KubeNode = nil
return store.DefalutClient.Put(conf.Config.NodePath+"/"+n.ID, savenode.String())
}
//DeleteNode delete node