mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-28 13:45:50 +00:00
Check whether mirror pod is ciritical in managerImpl#evictPod
This commit is contained in:
@@ -110,12 +110,6 @@ func IsStaticPod(pod *v1.Pod) bool {
|
||||
return err == nil && source != kubetypes.ApiserverSource
|
||||
}
|
||||
|
||||
// IsMirrorPod returns true if the passed Pod is a Mirror Pod.
|
||||
func IsMirrorPod(pod *v1.Pod) bool {
|
||||
_, ok := pod.Annotations[kubetypes.ConfigMirrorAnnotationKey]
|
||||
return ok
|
||||
}
|
||||
|
||||
func getHashFromMirrorPod(pod *v1.Pod) (string, bool) {
|
||||
hash, ok := pod.Annotations[kubetypes.ConfigMirrorAnnotationKey]
|
||||
return hash, ok
|
||||
|
@@ -206,7 +206,7 @@ func (pm *basicManager) updatePodsInternal(pods ...*v1.Pod) {
|
||||
podFullName := kubecontainer.GetPodFullName(pod)
|
||||
// This logic relies on a static pod and its mirror to have the same name.
|
||||
// It is safe to type convert here due to the IsMirrorPod guard.
|
||||
if IsMirrorPod(pod) {
|
||||
if kubetypes.IsMirrorPod(pod) {
|
||||
mirrorPodUID := kubetypes.MirrorPodUID(pod.UID)
|
||||
pm.mirrorPodByUID[mirrorPodUID] = pod
|
||||
pm.mirrorPodByFullName[podFullName] = pod
|
||||
@@ -235,7 +235,7 @@ func (pm *basicManager) DeletePod(pod *v1.Pod) {
|
||||
}
|
||||
podFullName := kubecontainer.GetPodFullName(pod)
|
||||
// It is safe to type convert here due to the IsMirrorPod guard.
|
||||
if IsMirrorPod(pod) {
|
||||
if kubetypes.IsMirrorPod(pod) {
|
||||
mirrorPodUID := kubetypes.MirrorPodUID(pod.UID)
|
||||
delete(pm.mirrorPodByUID, mirrorPodUID)
|
||||
delete(pm.mirrorPodByFullName, podFullName)
|
||||
|
Reference in New Issue
Block a user