mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
mark remaining md5 usage TODO and exclude from lint
This commit is contained in:
@@ -154,6 +154,9 @@ func hashAddresses(addrs addressSet) string {
|
||||
slice = append(slice, addrReady{k, ready})
|
||||
}
|
||||
sort.Sort(addrsReady(slice))
|
||||
// TODO: finish removing existing md5 usage
|
||||
// https://github.com/kubernetes/kubernetes/issues/129652
|
||||
//nolint:forbidigo
|
||||
hasher := md5.New()
|
||||
hashutil.DeepHashObject(hasher, slice)
|
||||
return hex.EncodeToString(hasher.Sum(nil)[0:])
|
||||
@@ -210,6 +213,9 @@ type subsetsByHash []v1.EndpointSubset
|
||||
func (sl subsetsByHash) Len() int { return len(sl) }
|
||||
func (sl subsetsByHash) Swap(i, j int) { sl[i], sl[j] = sl[j], sl[i] }
|
||||
func (sl subsetsByHash) Less(i, j int) bool {
|
||||
// TODO: finish removing existing md5 usage
|
||||
// https://github.com/kubernetes/kubernetes/issues/129652
|
||||
//nolint:forbidigo
|
||||
hasher := md5.New()
|
||||
h1 := hashObject(hasher, sl[i])
|
||||
h2 := hashObject(hasher, sl[j])
|
||||
@@ -229,6 +235,9 @@ type portsByHash []v1.EndpointPort
|
||||
func (sl portsByHash) Len() int { return len(sl) }
|
||||
func (sl portsByHash) Swap(i, j int) { sl[i], sl[j] = sl[j], sl[i] }
|
||||
func (sl portsByHash) Less(i, j int) bool {
|
||||
// TODO: finish removing existing md5 usage
|
||||
// https://github.com/kubernetes/kubernetes/issues/129652
|
||||
//nolint:forbidigo
|
||||
hasher := md5.New()
|
||||
h1 := hashObject(hasher, sl[i])
|
||||
h2 := hashObject(hasher, sl[j])
|
||||
|
||||
@@ -59,6 +59,9 @@ func generatePodName(name string, nodeName types.NodeName) string {
|
||||
|
||||
func applyDefaults(logger klog.Logger, pod *api.Pod, source string, isFile bool, nodeName types.NodeName) error {
|
||||
if len(pod.UID) == 0 {
|
||||
// TODO: finish removing existing md5 usage
|
||||
// https://github.com/kubernetes/kubernetes/issues/129652
|
||||
//nolint:forbidigo
|
||||
hasher := md5.New()
|
||||
hash.DeepHashObject(hasher, pod)
|
||||
// DeepHashObject resets the hash, so we should write the pod source
|
||||
|
||||
@@ -1529,6 +1529,9 @@ func Test_UncertainDeviceGlobalMounts(t *testing.T) {
|
||||
tc := tests[tcIndex]
|
||||
testName := fmt.Sprintf("%s [%s]", tc.name, mode)
|
||||
uniqueTestString := fmt.Sprintf("global-mount-%s", testName)
|
||||
// TODO: finish removing existing md5 usage
|
||||
// https://github.com/kubernetes/kubernetes/issues/129652
|
||||
//nolint:forbidigo
|
||||
uniquePodDir := fmt.Sprintf("%s-%x", kubeletPodsDir, md5.Sum([]byte(uniqueTestString)))
|
||||
t.Run(testName+"[", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -1742,6 +1745,9 @@ func Test_UncertainVolumeMountState(t *testing.T) {
|
||||
tc := tests[tcIndex]
|
||||
testName := fmt.Sprintf("%s [%s]", tc.name, mode)
|
||||
uniqueTestString := fmt.Sprintf("local-mount-%s", testName)
|
||||
// TODO: finish removing existing md5 usage
|
||||
// https://github.com/kubernetes/kubernetes/issues/129652
|
||||
//nolint:forbidigo
|
||||
uniquePodDir := fmt.Sprintf("%s-%x", kubeletPodsDir, md5.Sum([]byte(uniqueTestString)))
|
||||
t.Run(testName, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -84,6 +84,9 @@ func NewPortMapKey(endpointPorts []discovery.EndpointPort) PortMapKey {
|
||||
|
||||
// deepHashObjectToString creates a unique hash string from a go object.
|
||||
func deepHashObjectToString(objectToWrite interface{}) string {
|
||||
// TODO: finish removing existing md5 usage
|
||||
// https://github.com/kubernetes/kubernetes/issues/129652
|
||||
//nolint:forbidigo
|
||||
hasher := md5.New()
|
||||
deepHashObject(hasher, objectToWrite)
|
||||
return hex.EncodeToString(hasher.Sum(nil)[0:])
|
||||
|
||||
@@ -47,6 +47,9 @@ func HashObject(obj runtime.Object, codec runtime.Codec) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// TODO: finish removing existing md5 usage
|
||||
// https://github.com/kubernetes/kubernetes/issues/129652
|
||||
//nolint:forbidigo
|
||||
return fmt.Sprintf("%x", md5.Sum(data)), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user