mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-21 09:57:52 +00:00
add comments to validation testcases, and use const in util.go
This commit is contained in:
@@ -22,6 +22,11 @@ import (
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
)
|
||||
|
||||
const (
|
||||
pvc string = "PersistentVolumeClaim"
|
||||
volumeSnapshot string = "VolumeSnapshot"
|
||||
)
|
||||
|
||||
// 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) {
|
||||
@@ -55,13 +60,13 @@ func dataSourceInUse(oldPVCSpec *core.PersistentVolumeClaimSpec) bool {
|
||||
|
||||
func dataSourceIsEnabled(pvcSpec *core.PersistentVolumeClaimSpec) bool {
|
||||
if pvcSpec.DataSource != nil {
|
||||
if pvcSpec.DataSource.Kind == "PersistentVolumeClaim" &&
|
||||
if pvcSpec.DataSource.Kind == pvc &&
|
||||
*pvcSpec.DataSource.APIGroup == "" &&
|
||||
utilfeature.DefaultFeatureGate.Enabled(features.VolumePVCDataSource) {
|
||||
return true
|
||||
|
||||
}
|
||||
if pvcSpec.DataSource.Kind == "VolumeSnapshot" &&
|
||||
if pvcSpec.DataSource.Kind == volumeSnapshot &&
|
||||
*pvcSpec.DataSource.APIGroup == "snapshot.storage.k8s.io" &&
|
||||
utilfeature.DefaultFeatureGate.Enabled(features.VolumeSnapshotDataSource) {
|
||||
return true
|
||||
|
Reference in New Issue
Block a user