Skip to content

Commit

Permalink
fix panic cased by sts auto delete pvc (#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>
  • Loading branch information
veophi and mingzhou.swx authored Jun 17, 2022
1 parent 54043e5 commit ddd87f0
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 ddd87f0

Please sign in to comment.