mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
kubelet: fix mirror pod creation/deletion
When annotating the mirror pod, make a new copy of the annotations map from the static pod, so that the change wouldn't be in the static pod.
This commit is contained in:
parent
7ba48583fa
commit
53e65b0826
@ -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
Block a user