mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
New function for creating missing pvcs
This commit is contained in:
parent
8924b58e2c
commit
2f0eb543c7
@ -315,6 +315,22 @@ func (spc *StatefulPodControl) recordClaimEvent(verb string, set *apps.StatefulS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// createMissingPersistentVolumeClaims creates all of the required PersistentVolumeClaims for pod, and updates its retention policy
|
||||||
|
func (spc *StatefulPodControl) createMissingPersistentVolumeClaims(set *apps.StatefulSet, pod *v1.Pod) error {
|
||||||
|
if err := spc.createPersistentVolumeClaims(set, pod); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(features.StatefulSetAutoDeletePVC) {
|
||||||
|
// Set PVC policy as much as is possible at this point.
|
||||||
|
if err := spc.UpdatePodClaimForRetentionPolicy(set, pod); err != nil {
|
||||||
|
spc.recordPodEvent("update", set, pod, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// createPersistentVolumeClaims creates all of the required PersistentVolumeClaims for pod, which must be a member of
|
// createPersistentVolumeClaims creates all of the required PersistentVolumeClaims for pod, which must be a member of
|
||||||
// set. If all of the claims for Pod are successfully created, the returned error is nil. If creation fails, this method
|
// set. If all of the claims for Pod are successfully created, the returned error is nil. If creation fails, this method
|
||||||
// may be called again until no error is returned, indicating the PersistentVolumeClaims for pod are consistent with
|
// may be called again until no error is returned, indicating the PersistentVolumeClaims for pod are consistent with
|
||||||
|
@ -453,16 +453,9 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet(
|
|||||||
set.Namespace,
|
set.Namespace,
|
||||||
set.Name,
|
set.Name,
|
||||||
replicas[i].Name)
|
replicas[i].Name)
|
||||||
if err := ssc.podControl.createPersistentVolumeClaims(set, replicas[i]); err != nil {
|
if err := ssc.podControl.createMissingPersistentVolumeClaims(set, replicas[i]); err != nil {
|
||||||
return &status, err
|
return &status, err
|
||||||
}
|
}
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.StatefulSetAutoDeletePVC) {
|
|
||||||
// Set PVC policy as much as is possible at this point.
|
|
||||||
if err := ssc.podControl.UpdatePodClaimForRetentionPolicy(set, replicas[i]); err != nil {
|
|
||||||
ssc.podControl.recordPodEvent("update", set, replicas[i], err)
|
|
||||||
return &status, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// If we find a Pod that is currently terminating, we must wait until graceful deletion
|
// If we find a Pod that is currently terminating, we must wait until graceful deletion
|
||||||
// completes before we continue to make progress.
|
// completes before we continue to make progress.
|
||||||
|
Loading…
Reference in New Issue
Block a user