func (h *Housekeeper) syncMachineTagsToNodeLabels() error {
	klog.Info("start syncing machine tags to node labels")

	nodes, err := kubernetes.GetNodes(h.k8sClient)
	if err != nil {
		return err
	}

	machineTags, err := h.getMachineTags(nodes)
	if err != nil {
		return err
	}

	updateNodeSpecBackoff := wait.Backoff{
		Steps:    20,
		Duration: 50 * time.Millisecond,
		Jitter:   1.0,
	}

	for _, n := range nodes {
		nodeName := n.Name
		tags, ok := machineTags[nodeName]
		if !ok {
			klog.Warningf("node:%s not a machine", nodeName)
			continue
		}
		labels := h.buildLabelsFromMachineTags(tags)
		err := kubernetes.UpdateNodeLabelsWithBackoff(h.k8sClient, n.Name, labels, updateNodeSpecBackoff)
		if err != nil {
			klog.Warningf("tags syncher failed to update tags on node:%s: %v", nodeName, err)
			continue
		}
	}

	h.lastTagSync = time.Now()

	return nil
}
// syncMachineTagsToNodeLabels synchronizes tags of machines in this project to labels of that node.
syncMachineTagsToNodeLabels synchronizes tags of machines in this project to labels of that node.
// syncMachineTagsToNodeLabels synchronizes tags of machines in this project to labels of that node .
func (h *Housekeeper) syncMachineTagsToNodeLabels() error {
	klog.Info("start syncing machine tags to node labels")
	nodes, err := kubernetes.GetNodes(h.k8sClient)
	if err != nil {
		return err
	}
	machineTags, err := h.getMachineTags(nodes)
	if err != nil {
		return err
	}
	updateNodeSpecBackoff := wait.Backoff{
		Steps:    20,
		Duration: 50 * time.Millisecond,
		Jitter:   1.0,
	}
	for _, n := range nodes {
		nodeName := n.Name
		tags, ok := machineTags[nodeName]
		if !ok {
			klog.Warningf("node:%s not a machine", nodeName)
			continue
		}
		labels := h.buildLabelsFromMachineTags(tags)
		err := kubernetes.UpdateNodeLabelsWithBackoff(h.k8sClient, n.Name, labels, updateNodeSpecBackoff)
		if err != nil {
			klog.Warningf("tags syncher failed to update tags on node:%s: %v", nodeName, err)
			continue
		}
	}
	h.lastTagSync = time.Now()
	return nil
}
func ( h * Housekeeper ) syncMachineTagsToNodeLabels ( ) error { klog . Info ( " " ) nodes , err := kubernetes . GetNodes ( h . k8sClient ) if err != nil { return err } machineTags , err := h . getMachineTags ( nodes ) if err != nil { return err } updateNodeSpecBackoff := wait . Backoff { Steps : 20 , Duration : 50 * time . Millisecond , Jitter : 1.0 , } for _ , n := range nodes { nodeName := n . Name tags , ok := machineTags [ nodeName ] if ! ok { klog . Warningf ( " " , nodeName ) continue } labels := h . buildLabelsFromMachineTags ( tags ) err := kubernetes . UpdateNodeLabelsWithBackoff ( h . k8sClient , n . Name , labels , updateNodeSpecBackoff ) if err != nil { klog . Warningf ( " " , nodeName , err ) continue } } h . lastTagSync = time . Now ( ) return nil }
syncMachineTagsToNodeLabels synchronizes tags of machines in this project to labels of that node.
syncMachineTagsToNodeLabels synchronizes tags of machines in this project to labels of that node .