mirror of https://github.com/k3s-io/k3s
Merge pull request #67648 from xlgao-zju/fix-annotate-panic
Automatic merge from submit-queue (batch tested with PRs 65788, 67648, 67660). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. [kubeadm] fix panic when node annotation is nil **What this PR does / why we need it**: kubeadm will panic, when the node annotation is nil. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: /assign @neolit123 **Release note**: ```release-note kubeadm: Fix panic when node annotation is nil ```pull/8/head
commit
9b8f3f3cb8
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue