const pvc … const volumeSnapshot … const deprecatedStorageClassAnnotationsMsg … // DropDisabledFields removes disabled fields from the pvc spec. // This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a pvc spec. func DropDisabledFields(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 EnforceDataSourceBackwardsCompatibility(pvcSpec, oldPVCSpec *core.PersistentVolumeClaimSpec) { … } func DropDisabledFieldsFromStatus(pvc, oldPVC *core.PersistentVolumeClaim) { … } func dataSourceInUse(oldPVCSpec *core.PersistentVolumeClaimSpec) bool { … } func dataSourceIsPvcOrSnapshot(dataSource *core.TypedLocalObjectReference) bool { … } func dataSourceRefInUse(oldPVCSpec *core.PersistentVolumeClaimSpec) bool { … } // 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 func NormalizeDataSources(pvcSpec *core.PersistentVolumeClaimSpec) { … } func GetWarningsForPersistentVolumeClaim(pv *core.PersistentVolumeClaim) []string { … } func GetWarningsForPersistentVolumeClaimSpec(fieldPath *field.Path, pvSpec core.PersistentVolumeClaimSpec) []string { … }