Skip to content

Commit

Permalink
Merge pull request #118563 from humblec/add-deprecated-plugins
Browse files Browse the repository at this point in the history
Return deprecation warning for storageOS,PhotonPD,ScaleIO..etc
  • Loading branch information
k8s-ci-robot committed Jun 8, 2023
2 parents af99df6 + fdc49f5 commit 4706516
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/api/persistentvolume/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ func warningsForPersistentVolumeSpecAndMeta(fieldPath *field.Path, pvSpec *api.P
if pvSpec.CephFS != nil {
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.28, non-functional in v1.31+", fieldPath.Child("spec", "persistentVolumeSource").Child("cephfs")))
}
if pvSpec.PhotonPersistentDisk != nil {
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.11, non-functional in v1.16+", fieldPath.Child("spec", "persistentVolumeSource").Child("photonPersistentDisk")))
}
if pvSpec.ScaleIO != nil {
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.16, non-functional in v1.22+", fieldPath.Child("spec", "persistentVolumeSource").Child("scaleIO")))
}
if pvSpec.StorageOS != nil {
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.22, non-functional in v1.25+", fieldPath.Child("spec", "persistentVolumeSource").Child("storageOS")))
}
if pvSpec.Glusterfs != nil {
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.25, non-functional in v1.26+", fieldPath.Child("spec", "persistentVolumeSource").Child("glusterfs")))
}

return warnings
}
79 changes: 79 additions & 0 deletions pkg/api/persistentvolume/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,85 @@ func TestWarnings(t *testing.T) {
`spec.persistentVolumeSource.cephfs: deprecated in v1.28, non-functional in v1.31+`,
},
},
{
name: "PV PhotonPersistentDisk deprecation warning",
template: &api.PersistentVolume{
Spec: api.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{
PhotonPersistentDisk: &api.PhotonPersistentDiskVolumeSource{
PdID: "",
FSType: "",
},
},
},
},
expected: []string{
`spec.persistentVolumeSource.photonPersistentDisk: deprecated in v1.11, non-functional in v1.16+`,
},
},
{
name: "PV ScaleIO deprecation warning",
template: &api.PersistentVolume{
Spec: api.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{
ScaleIO: &api.ScaleIOPersistentVolumeSource{
Gateway: "",
System: "",
SecretRef: nil,
SSLEnabled: false,
ProtectionDomain: "",
StoragePool: "",
StorageMode: "",
VolumeName: "",
FSType: "",
ReadOnly: false,
},
},
},
},
expected: []string{
`spec.persistentVolumeSource.scaleIO: deprecated in v1.16, non-functional in v1.22+`,
},
},

{
name: "PV StorageOS deprecation warning",
template: &api.PersistentVolume{
Spec: api.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{
StorageOS: &api.StorageOSPersistentVolumeSource{
VolumeName: "",
VolumeNamespace: "",
FSType: "",
ReadOnly: false,
SecretRef: nil,
},
},
},
},
expected: []string{
`spec.persistentVolumeSource.storageOS: deprecated in v1.22, non-functional in v1.25+`,
},
},

{
name: "PV GlusterFS deprecation warning",
template: &api.PersistentVolume{
Spec: api.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{
Glusterfs: &api.GlusterfsPersistentVolumeSource{
EndpointsName: "",
Path: "",
ReadOnly: false,
EndpointsNamespace: nil,
},
},
},
},
expected: []string{
`spec.persistentVolumeSource.glusterfs: deprecated in v1.25, non-functional in v1.26+`,
},
},
}

for _, tc := range testcases {
Expand Down

0 comments on commit 4706516

Please sign in to comment.