mirror of https://github.com/k3s-io/k3s
Merge pull request #15185 from yujuhong/fix_annotation
kubelet: fix mirror pod creation/deletionpull/6/head
commit
f828c9a49c
|
@ -47,9 +47,16 @@ func (mc *basicMirrorClient) CreateMirrorPod(pod *api.Pod) error {
|
|||
if mc.apiserverClient == nil {
|
||||
return nil
|
||||
}
|
||||
pod.Annotations[ConfigMirrorAnnotationKey] = MirrorType
|
||||
// Make a copy of the pod.
|
||||
copyPod := *pod
|
||||
copyPod.Annotations = make(map[string]string)
|
||||
|
||||
_, err := mc.apiserverClient.Pods(pod.Namespace).Create(pod)
|
||||
for k, v := range pod.Annotations {
|
||||
copyPod.Annotations[k] = v
|
||||
}
|
||||
copyPod.Annotations[ConfigMirrorAnnotationKey] = MirrorType
|
||||
|
||||
_, err := mc.apiserverClient.Pods(copyPod.Namespace).Create(©Pod)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue