Merge pull request #120172 from DrAuYueng/fix-log-in-deployment-controller

Fix pod deletion log in deployment controller
This commit is contained in:
Kubernetes Prow Robot 2023-09-01 11:28:31 -07:00 committed by GitHub
commit 1cadbd5887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -367,8 +367,12 @@ func (dc *DeploymentController) deletePod(logger klog.Logger, obj interface{}) {
return
}
}
d := dc.getDeploymentForPod(logger, pod)
if d == nil {
return
}
logger.V(4).Info("Pod deleted", "pod", klog.KObj(pod))
if d := dc.getDeploymentForPod(logger, pod); d != nil && d.Spec.Strategy.Type == apps.RecreateDeploymentStrategyType {
if d.Spec.Strategy.Type == apps.RecreateDeploymentStrategyType {
// Sync if this Deployment now has no more Pods.
rsList, err := util.ListReplicaSets(d, util.RsListFromClient(dc.client.AppsV1()))
if err != nil {