SearchLabels searches through a list of key=value pairs for a given key, returning its value, and the binary flag telling whether the key exist.
(labels []string, key string)
| 38 | // SearchLabels searches through a list of key=value pairs for a given key, |
| 39 | // returning its value, and the binary flag telling whether the key exist. |
| 40 | func SearchLabels(labels []string, key string) (string, bool) { |
| 41 | key += "=" |
| 42 | for _, s := range labels { |
| 43 | if val, ok := strings.CutPrefix(s, key); ok { |
| 44 | return val, true |
| 45 | } |
| 46 | } |
| 47 | return "", false |
| 48 | } |
| 49 | |
| 50 | // Annotations returns the bundle path and user defined annotations from the |
| 51 | // libcontainer state. We need to remove the bundle because that is a label |
no outgoing calls
searching dependent graphs…