mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
PR feedback
This commit is contained in:
parent
e6a90aa48a
commit
3cf636b22e
@ -22,7 +22,7 @@ import (
|
||||
"strings"
|
||||
|
||||
apps "k8s.io/api/apps/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
errorutils "k8s.io/apimachinery/pkg/util/errors"
|
||||
@ -114,7 +114,7 @@ func (om *realStatefulPodControlObjectManager) UpdateClaim(claim *v1.PersistentV
|
||||
|
||||
func (spc *StatefulPodControl) CreateStatefulPod(ctx context.Context, set *apps.StatefulSet, pod *v1.Pod) error {
|
||||
// Create the Pod's PVCs prior to creating the Pod
|
||||
if err := spc.CreatePersistentVolumeClaims(set, pod); err != nil {
|
||||
if err := spc.createPersistentVolumeClaims(set, pod); err != nil {
|
||||
spc.recordPodEvent("create", set, pod, err)
|
||||
return err
|
||||
}
|
||||
@ -150,7 +150,7 @@ func (spc *StatefulPodControl) UpdateStatefulPod(set *apps.StatefulSet, pod *v1.
|
||||
if !storageMatches(set, pod) {
|
||||
updateStorage(set, pod)
|
||||
consistent = false
|
||||
if err := spc.CreatePersistentVolumeClaims(set, pod); err != nil {
|
||||
if err := spc.createPersistentVolumeClaims(set, pod); err != nil {
|
||||
spc.recordPodEvent("update", set, pod, err)
|
||||
return err
|
||||
}
|
||||
@ -315,11 +315,11 @@ func (spc *StatefulPodControl) recordClaimEvent(verb string, set *apps.StatefulS
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
// may be called again until no error is returned, indicating the PersistentVolumeClaims for pod are consistent with
|
||||
// set's Spec.
|
||||
func (spc *StatefulPodControl) CreatePersistentVolumeClaims(set *apps.StatefulSet, pod *v1.Pod) error {
|
||||
func (spc *StatefulPodControl) createPersistentVolumeClaims(set *apps.StatefulSet, pod *v1.Pod) error {
|
||||
var errs []error
|
||||
for _, claim := range getPersistentVolumeClaims(set, pod) {
|
||||
pvc, err := spc.objectMgr.GetClaim(claim.Namespace, claim.Name)
|
||||
|
@ -453,9 +453,16 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet(
|
||||
set.Namespace,
|
||||
set.Name,
|
||||
replicas[i].Name)
|
||||
if err := ssc.podControl.CreatePersistentVolumeClaims(set, replicas[i]); err != nil {
|
||||
if err := ssc.podControl.createPersistentVolumeClaims(set, replicas[i]); err != nil {
|
||||
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
|
||||
// completes before we continue to make progress.
|
||||
|
@ -2441,7 +2441,7 @@ func (om *fakeObjectManager) DeletePod(pod *v1.Pod) error {
|
||||
return nil // Not found, no error in deleting.
|
||||
}
|
||||
|
||||
func (om *fakeObjectManager) CreatePersistentVolumeClaims(set *apps.StatefulSet, pod *v1.Pod) error {
|
||||
func (om *fakeObjectManager) createPersistentVolumeClaims(set *apps.StatefulSet, pod *v1.Pod) error {
|
||||
for _, claim := range getPersistentVolumeClaims(set, pod) {
|
||||
om.claimsIndexer.Update(&claim)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user