mirror of
https://github.com/wahyd4/cert-manager.git
synced 2026-08-09 05:06:38 +10:00
Only consider running pods when checking version
Some clusters may have failed pods that are not garbage collected. These pods should not be considered when determining version numbers. Signed-off-by: John Chadwick <86682572+johnwchadwick@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user