kubernetesk8s.io/kubernetes/pkg/api/persistentvolumeclaim Index | Files

package persistentvolumeclaim

import "k8s.io/kubernetes/pkg/api/persistentvolumeclaim"

Index

Functions

func DropDisabledFields

func DropDisabledFields(pvcSpec, oldPVCSpec *core.PersistentVolumeClaimSpec)

DropDisabledFields removes disabled fields from the pvc spec. This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a pvc spec.

func DropDisabledFieldsFromStatus

func DropDisabledFieldsFromStatus(pvc, oldPVC *core.PersistentVolumeClaim)

func EnforceDataSourceBackwardsCompatibility

func EnforceDataSourceBackwardsCompatibility(pvcSpec, oldPVCSpec *core.PersistentVolumeClaimSpec)

EnforceDataSourceBackwardsCompatibility drops the data source field under certain conditions to maintain backwards compatibility with old behavior. See KEP 1495 for details. Specifically, if this is an update of a PVC with no data source, or a creation of a new PVC, and the dataSourceRef field is not filled in, then we will drop "invalid" data sources (anything other than a PVC or a VolumeSnapshot) from this request as if an empty PVC had been requested. This should be called after DropDisabledFields so that if the AnyVolumeDataSource feature gate is disabled, dataSourceRef will be forced to empty, ensuring pre-1.22 behavior. This should be called before NormalizeDataSources, so that data sources other than PVCs and VolumeSnapshots can only be set through the dataSourceRef field and not the dataSource field.

func GetWarningsForPersistentVolumeClaim

func GetWarningsForPersistentVolumeClaim(pv *core.PersistentVolumeClaim) []string

func GetWarningsForPersistentVolumeClaimSpec

func GetWarningsForPersistentVolumeClaimSpec(fieldPath *field.Path, pvSpec core.PersistentVolumeClaimSpec) []string

func NormalizeDataSources

func NormalizeDataSources(pvcSpec *core.PersistentVolumeClaimSpec)

NormalizeDataSources ensures that DataSource and DataSourceRef have the same contents as long as both are not explicitly set. This should be used by creates/gets of PVCs, but not updates

Source Files

util.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
6 packages
Last checked
3 hours ago

Tools for package owners.