github.com/interconnectedcloud/qdr-operator@v0.0.0-20210826174505-576d2b33dac7/pkg/utils/selectors/label.go (about)

     1  package selectors
     2  
     3  import (
     4  	"k8s.io/apimachinery/pkg/labels"
     5  )
     6  
     7  const (
     8  	LabelAppKey = "application"
     9  
    10  	LabelResourceKey = "interconnect_cr"
    11  )
    12  
    13  // Set labels in a map
    14  func LabelsForInterconnect(name string) map[string]string {
    15  	return map[string]string{
    16  		LabelAppKey:      name,
    17  		LabelResourceKey: name,
    18  	}
    19  }
    20  
    21  // return a selector that matches resources for a interconnect resource
    22  func ResourcesByInterconnectName(name string) labels.Selector {
    23  	set := map[string]string{
    24  		LabelAppKey:      name,
    25  		LabelResourceKey: name,
    26  	}
    27  	return labels.SelectorFromSet(set)
    28  }