mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
kuberuntime: include container hash in backoff keys
We should reset the backoff if the content of the container has been updated.
This commit is contained in:
@@ -18,6 +18,7 @@ package kuberuntime
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
@@ -160,3 +161,11 @@ func milliCPUToQuota(milliCPU int64) (quota int64, period int64) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// getStableKey generates a key (string) to uniquely identify a
|
||||
// (pod, container) tuple. The key should include the content of the
|
||||
// container, so that any change to the container generates a new key.
|
||||
func getStableKey(pod *api.Pod, container *api.Container) string {
|
||||
hash := strconv.FormatUint(kubecontainer.HashContainer(container), 16)
|
||||
return fmt.Sprintf("%s_%s_%s_%s_%s", pod.Name, pod.Namespace, string(pod.UID), container.Name, hash)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user