mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Merge pull request #104605 from pohly/ephemeral-volume-events
scheduler: more informative generic ephemeral volume events
This commit is contained in:
commit
b12379ef1c
@ -24,6 +24,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
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"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
@ -140,7 +141,12 @@ func (pl *VolumeBinding) podHasPVCs(pod *v1.Pod) (bool, error) {
|
|||||||
hasPVC = true
|
hasPVC = true
|
||||||
pvc, err := pl.PVCLister.PersistentVolumeClaims(pod.Namespace).Get(pvcName)
|
pvc, err := pl.PVCLister.PersistentVolumeClaims(pod.Namespace).Get(pvcName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// The error has already enough context ("persistentvolumeclaim "myclaim" not found")
|
// The error usually has already enough context ("persistentvolumeclaim "myclaim" not found"),
|
||||||
|
// but we can do better for generic ephemeral inline volumes where that situation
|
||||||
|
// is normal directly after creating a pod.
|
||||||
|
if ephemeral && apierrors.IsNotFound(err) {
|
||||||
|
err = fmt.Errorf("waiting for ephemeral volume controller to create the persistentvolumeclaim %q", pvcName)
|
||||||
|
}
|
||||||
return hasPVC, err
|
return hasPVC, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user