kubelet: Move HashContainer to kubelet/container package.

This commit is contained in:
Yifan Gu
2015-05-15 16:14:08 -07:00
parent 2c54540896
commit 6a5681e0fe
6 changed files with 24 additions and 30 deletions

View File

@@ -17,9 +17,11 @@ limitations under the License.
package container
import (
"hash/adler32"
"strings"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/golang/glog"
)
@@ -80,3 +82,11 @@ func ShouldContainerBeRestarted(container *api.Container, pod *api.Pod, podStatu
}
return true
}
// HashContainer returns the hash of the container. It is used to compare
// the running container with its desired spec.
func HashContainer(container *api.Container) uint64 {
hash := adler32.New()
util.DeepHashObject(hash, *container)
return uint64(hash.Sum32())
}