(ctx devspacecontext.Context, pod *corev1.PodTemplateSpec, devPod *latest.DevPod)
| 107 | } |
| 108 | |
| 109 | func matchesSelector(ctx devspacecontext.Context, pod *corev1.PodTemplateSpec, devPod *latest.DevPod) (bool, error) { |
| 110 | if len(devPod.LabelSelector) > 0 { |
| 111 | labelSelector, err := metav1.LabelSelectorAsSelector(&metav1.LabelSelector{ |
| 112 | MatchLabels: devPod.LabelSelector, |
| 113 | }) |
| 114 | if err != nil { |
| 115 | return false, err |
| 116 | } |
| 117 | |
| 118 | return labelSelector.Matches(labels.Set(pod.Labels)), nil |
| 119 | } else if devPod.ImageSelector != "" { |
| 120 | containers, err := matchesImageSelector(ctx, pod, devPod) |
| 121 | if err != nil { |
| 122 | return false, err |
| 123 | } |
| 124 | |
| 125 | return len(containers) > 0, nil |
| 126 | } |
| 127 | |
| 128 | return false, nil |
| 129 | } |
| 130 | |
| 131 | func matchesImageSelector(ctx devspacecontext.Context, pod *corev1.PodTemplateSpec, devPod *latest.DevPod) ([]string, error) { |
| 132 | var matchingContainers []string |
no test coverage detected