HasLabels verifies that the labels of a pod contain a specified labels map
(pod corev1.Pod, labels map[string]string)
| 164 | // HasLabels verifies that the labels of a pod contain a specified |
| 165 | // labels map |
| 166 | func HasLabels(pod corev1.Pod, labels map[string]string) bool { |
| 167 | podLabels := pod.Labels |
| 168 | for k, v := range labels { |
| 169 | val, ok := podLabels[k] |
| 170 | if !ok || (v != val) { |
| 171 | return false |
| 172 | } |
| 173 | } |
| 174 | return true |
| 175 | } |
| 176 | |
| 177 | // HasAnnotations verifies that the annotations of a pod contain a specified |
| 178 | // annotations map |