mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Add VolumeType api to PV and PVC
This commit is contained in:
@@ -17,7 +17,9 @@ limitations under the License.
|
||||
package persistentvolume
|
||||
|
||||
import (
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
)
|
||||
|
||||
func getClaimRefNamespace(pv *api.PersistentVolume) string {
|
||||
@@ -96,3 +98,11 @@ func VisitPVSecretNames(pv *api.PersistentVolume, visitor Visitor) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// DropDisabledAlphaFields removes disabled fields from the pv spec.
|
||||
// This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a pv spec.
|
||||
func DropDisabledAlphaFields(pvSpec *api.PersistentVolumeSpec) {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.BlockVolume) {
|
||||
pvSpec.VolumeMode = nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user