Consider core dns in the preflight DNS check
@@ -54,10 +54,18 @@ const (
kubeSystemNamespace = "kube-system"
kubeDNSLabelKey = "k8s-app"
kubeDNSLabelValue = "kube-dns"
+ coreDNSLabelValue = "coredns"
)
func preflightDNSCheck(client kubernetes.Interface, cfg *PreflightConfig) error {
- selector := metav1.AddLabelToSelector(&metav1.LabelSelector{}, kubeDNSLabelKey, kubeDNSLabelValue)
+ var dnsLabels = []string{
+ kubeDNSLabelValue,
+ coreDNSLabelValue,
+ }
+
+ var nPods = 0
+ for _, labelValue := range dnsLabels {
+ selector := metav1.AddLabelToSelector(&metav1.LabelSelector{}, kubeDNSLabelKey, labelValue)
obj, err := client.CoreV1().Pods(kubeSystemNamespace).List(
metav1.ListOptions{LabelSelector: metav1.FormatLabelSelector(selector)},
@@ -66,8 +74,11 @@ func preflightDNSCheck(client kubernetes.Interface, cfg *PreflightConfig) error
return errors.Wrap(err, "could not retrieve list of pods")
}
- if len(obj.Items) == 0 {
- return errors.New("no kube-dns tests found")
+ nPods += len(obj.Items)
+ }
+
+ if nPods == 0 {
+ return errors.New("no dns pod tests found")
}
return nil
