Skip to content

Commit

Permalink
fix panic cased by sts auto delete pvc (openkruise#999)
Browse files Browse the repository at this point in the history
Signed-off-by: mingzhou.swx <mingzhou.swx@alibaba-inc.com>

Co-authored-by: mingzhou.swx <mingzhou.swx@alibaba-inc.com>
Signed-off-by: Liu Zhenwei <zwliu@thoughtworks.com>
  • Loading branch information
2 people authored and diannaowa committed Sep 14, 2022
1 parent 5cd8597 commit 59bd99e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/statefulset/stateful_set_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func getPersistentVolumeClaimRetentionPolicy(set *appsv1beta1.StatefulSet) appsv
// claimOwnerMatchesSetAndPod returns false if the ownerRefs of the claim are not set consistently with the
// PVC deletion policy for the StatefulSet.
func claimOwnerMatchesSetAndPod(claim *v1.PersistentVolumeClaim, set *appsv1beta1.StatefulSet, pod *v1.Pod) bool {
policy := set.Spec.PersistentVolumeClaimRetentionPolicy
policy := getPersistentVolumeClaimRetentionPolicy(set)
const retain = appsv1beta1.RetainPersistentVolumeClaimRetentionPolicyType
const delete = appsv1beta1.DeletePersistentVolumeClaimRetentionPolicyType
switch {
Expand Down Expand Up @@ -202,7 +202,7 @@ func updateClaimOwnerRefForSetAndPod(claim *v1.PersistentVolumeClaim, set *appsv
updateMeta(&podMeta, "Pod")
setMeta := set.TypeMeta
updateMeta(&setMeta, "StatefulSet")
policy := set.Spec.PersistentVolumeClaimRetentionPolicy
policy := getPersistentVolumeClaimRetentionPolicy(set)
const retain = appsv1beta1.RetainPersistentVolumeClaimRetentionPolicyType
const delete = appsv1beta1.DeletePersistentVolumeClaimRetentionPolicyType
switch {
Expand Down

0 comments on commit 59bd99e

Please sign in to comment.