Merge pull request #4615 from johnwchadwick/version-check-disregard-failed-pods

Only consider running pods when determining version
This commit is contained in:
jetstack-bot 2021-11-30 14:14:45 +00:00 committed by GitHub
commit ce019f059c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -53,6 +53,10 @@ func (o *versionChecker) extractVersionFromService(
}
for _, pod := range pods.Items {
if pod.Status.Phase != corev1.PodRunning {
continue
}
if label := extractVersionFromLabels(pod.Labels); label != "" {
o.versionSources["webhookPodLabelVersion"] = label
}

View File

@ -51,6 +51,9 @@ func getPodFromTemplate(template *v1.PodTemplateSpec, parentObject runtime.Objec
Name: prefix + cmutil.RandStringRunes(5),
Finalizers: desiredFinalizers,
},
Status: v1.PodStatus{
Phase: v1.PodRunning,
},
}
if controllerRef != nil {
pod.OwnerReferences = append(pod.OwnerReferences, *controllerRef)