Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for DeepHashObject (0.27 sec)

  1. pkg/util/hash/hash_test.go

    		hasher1 := adler32.New()
    		hasher2 := adler32.New()
    		hasher3 := adler32.New()
    		// Act
    		DeepHashObject(hasher1, myUni1)
    		hash1 := hasher1.Sum32()
    		DeepHashObject(hasher1, myUni1)
    		hash1a := hasher1.Sum32()
    		DeepHashObject(hasher2, myUni2)
    		hash2 := hasher2.Sum32()
    		DeepHashObject(hasher3, myUni3)
    		hash3 := hasher3.Sum32()
    
    		// Assert
    		if hash1 != hash1a {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Mar 27 01:24:22 UTC 2023
    - 4.4K bytes
    - Viewed (0)
  2. pkg/util/hash/hash.go

    */
    
    package hash
    
    import (
    	"fmt"
    	"hash"
    
    	"k8s.io/apimachinery/pkg/util/dump"
    )
    
    // DeepHashObject writes specified object to hash using the spew library
    // which follows pointers and prints actual values of the nested objects
    // ensuring the hash does not change when a pointer changes.
    func DeepHashObject(hasher hash.Hash, objectToWrite interface{}) {
    	hasher.Reset()
    	fmt.Fprintf(hasher, "%v", dump.ForHash(objectToWrite))
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Mar 27 01:24:22 UTC 2023
    - 998 bytes
    - Viewed (0)
  3. cmd/kubeadm/app/util/staticpod/utils.go

    	})
    	return usersAndGroups, err
    }
    
    // DeepHashObject writes specified object to hash using the spew library
    // which follows pointers and prints actual values of the nested objects
    // ensuring the hash does not change when a pointer changes.
    // Copied from k8s.io/kubernetes/pkg/util/hash/hash.go#DeepHashObject
    func DeepHashObject(hasher hash.Hash, objectToWrite interface{}) {
    	hasher.Reset()
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Jan 14 13:07:56 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  4. pkg/api/v1/endpoints/util.go

    type addrReady struct {
    	addr  *v1.EndpointAddress
    	ready bool
    }
    
    func hashAddresses(addrs addressSet) string {
    	// Flatten the list of addresses into a string so it can be used as a
    	// map key.  Unfortunately, DeepHashObject is implemented in terms of
    	// spew, and spew does not handle non-primitive map keys well.  So
    	// first we collapse it into a slice, sort the slice, then hash that.
    	slice := make([]addrReady, 0, len(addrs))
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Sep 07 07:01:25 UTC 2018
    - 8K bytes
    - Viewed (0)
  5. pkg/kubelet/checkpointmanager/checksum/checksum.go

    func New(data interface{}) Checksum {
    	return Checksum(getChecksum(data))
    }
    
    // Get returns calculated checksum of checkpoint data
    func getChecksum(data interface{}) uint64 {
    	hash := fnv.New32a()
    	hashutil.DeepHashObject(hash, data)
    	return uint64(hash.Sum32())
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Apr 25 01:56:43 UTC 2019
    - 1.3K bytes
    - Viewed (0)
  6. pkg/kubelet/config/common.go

    }
    
    func applyDefaults(pod *api.Pod, source string, isFile bool, nodeName types.NodeName) error {
    	if len(pod.UID) == 0 {
    		hasher := md5.New()
    		hash.DeepHashObject(hasher, pod)
    		// DeepHashObject resets the hash, so we should write the pod source
    		// information AFTER it.
    		if isFile {
    			fmt.Fprintf(hasher, "host:%s", nodeName)
    			fmt.Fprintf(hasher, "file:%s", source)
    		} else {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 03 18:40:48 UTC 2023
    - 5.8K bytes
    - Viewed (0)
  7. pkg/controller/deployment/util/hash_test.go

    	for i := 0; i < b.N; i++ {
    		getPodTemplateSpecOldHash(spec)
    	}
    }
    
    func getPodTemplateSpecOldHash(template v1.PodTemplateSpec) uint32 {
    	podTemplateSpecHasher := adler32.New()
    	hashutil.DeepHashObject(podTemplateSpecHasher, template)
    	return podTemplateSpecHasher.Sum32()
    }
    
    func BenchmarkFnv(b *testing.B) {
    	spec := v1.PodTemplateSpec{}
    	json.Unmarshal([]byte(podSpec), &spec)
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jan 28 19:00:40 UTC 2019
    - 4K bytes
    - Viewed (0)
  8. pkg/controller/history/controller_history.go

    func HashControllerRevision(revision *apps.ControllerRevision, probe *int32) string {
    	hf := fnv.New32()
    	if len(revision.Data.Raw) > 0 {
    		hf.Write(revision.Data.Raw)
    	}
    	if revision.Data.Object != nil {
    		hashutil.DeepHashObject(hf, revision.Data.Object)
    	}
    	if probe != nil {
    		hf.Write([]byte(strconv.FormatInt(int64(*probe), 10)))
    	}
    	return rand.SafeEncodeString(fmt.Sprint(hf.Sum32()))
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 05 13:33:52 UTC 2021
    - 18.2K bytes
    - Viewed (0)
  9. pkg/kubelet/container/helpers.go

    // Note: remember to update hashValues in container_hash_test.go as well.
    func HashContainer(container *v1.Container) uint64 {
    	hash := fnv.New32a()
    	containerJSON, _ := json.Marshal(pickFieldsToHash(container))
    	hashutil.DeepHashObject(hash, containerJSON)
    	return uint64(hash.Sum32())
    }
    
    // pickFieldsToHash pick fields that will affect the running status of the container for hash,
    // currently this field range only contains `image` and `name`.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jun 04 06:25:43 UTC 2024
    - 14.3K bytes
    - Viewed (0)
  10. pkg/controller/controller_utils.go

    // avoid bad words.
    func ComputeHash(template *v1.PodTemplateSpec, collisionCount *int32) string {
    	podTemplateSpecHasher := fnv.New32a()
    	hashutil.DeepHashObject(podTemplateSpecHasher, *template)
    
    	// Add collisionCount in the hash if it exists.
    	if collisionCount != nil {
    		collisionCountBytes := make([]byte, 8)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jan 12 15:34:44 UTC 2024
    - 47.6K bytes
    - Viewed (0)
Back to top