Commit 54848803 authored by Xianglin Gao's avatar Xianglin Gao

fix panic when node annotation is nil

parent 6d76e35b
...@@ -36,5 +36,8 @@ func AnnotateCRISocket(client clientset.Interface, nodeName string, criSocket st ...@@ -36,5 +36,8 @@ func AnnotateCRISocket(client clientset.Interface, nodeName string, criSocket st
} }
func annotateNodeWithCRISocket(n *v1.Node, criSocket string) { 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 n.ObjectMeta.Annotations[constants.AnnotationKubeadmCRISocket] = criSocket
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment