Files
orchard/pkg/resource/v1/labels.go
T
edi-oai a838bb0299 Worker: introduce automatic "org.cirruslabs.orchard.worker-name" label (#481)
* Worker: introduce automatic "org.cirruslabs.orchard.worker-name" label

* TestLabelsCopy: use constants to fix linter error
2026-09-03 00:24:20 +01:00

36 lines
515 B
Go

package v1
import "maps"
const (
LabelWorkerName = "org.cirruslabs.orchard.worker-name"
)
type Labels map[string]string
func (labels Labels) Contains(other Labels) bool {
for label, value := range other {
if labels[label] != value {
return false
}
}
return true
}
func (labels Labels) Copy() Labels {
if labels == nil {
return make(Labels)
}
return maps.Clone(labels)
}
func (labels Labels) Merged(other Labels) Labels {
result := labels.Copy()
maps.Copy(result, other)
return result
}