fix panic when node annotation is nil

Signed-off-by: Xianglin Gao <xianglin.gxl@alibaba-inc.com>
This commit is contained in:
Xianglin Gao 2018-08-21 10:15:49 +08:00
parent 6d76e35b39
commit 5484880351

View File

@ -36,5 +36,8 @@ func AnnotateCRISocket(client clientset.Interface, nodeName string, criSocket st
}
func annotateNodeWithCRISocket(n *v1.Node, criSocket string) {
if n.ObjectMeta.Annotations == nil {
n.ObjectMeta.Annotations = make(map[string]string)
}
n.ObjectMeta.Annotations[constants.AnnotationKubeadmCRISocket] = criSocket
}