github.com/spotahome/redis-operator@v1.2.4/operator/redisfailover/util/label.go (about)

     1  package util
     2  
     3  // MergeLabels merges all the label maps received as argument into a single new label map.
     4  func MergeLabels(allLabels ...map[string]string) map[string]string {
     5  	res := map[string]string{}
     6  
     7  	for _, labels := range allLabels {
     8  		for k, v := range labels {
     9  			res[k] = v
    10  		}
    11  	}
    12  	return res
    13  }
    14  
    15  // MergeAnnotations merges all the annotations maps received as argument into a single new label map.
    16  func MergeAnnotations(allMergeAnnotations ...map[string]string) map[string]string {
    17  	res := map[string]string{}
    18  
    19  	for _, labels := range allMergeAnnotations {
    20  		for k, v := range labels {
    21  			res[k] = v
    22  		}
    23  	}
    24  	return res
    25  }