Skip to content

Commit

Permalink
Fix nil panic in cloneset validating webhook (#1678)
Browse files Browse the repository at this point in the history
Signed-off-by: Spground <[email protected]>
Co-authored-by: Spground <[email protected]>
  • Loading branch information
Spground and Spground authored Jul 31, 2024
1 parent 11e5ac0 commit 61ee5bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/webhook/cloneset/validating/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (h *CloneSetCreateUpdateHandler) validateScaleStrategy(strategy, oldStrateg
allErrs = append(allErrs, field.Invalid(fldPath.Child("podsToDelete"), podName, fmt.Sprintf("find pod %s failed: %v", podName, err)))
} else if pod.DeletionTimestamp != nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("podsToDelete"), podName, fmt.Sprintf("find pod %s already terminating", podName)))
} else if owner := metav1.GetControllerOf(pod); owner.UID != metadata.UID {
} else if owner := metav1.GetControllerOf(pod); owner == nil || owner.UID != metadata.UID {
allErrs = append(allErrs, field.Invalid(fldPath.Child("podsToDelete"), podName, fmt.Sprintf("find pod %s owner is not this CloneSet", podName)))
}
}
Expand Down

0 comments on commit 61ee5bc

Please sign in to comment.