Skip to content

Commit

Permalink
Change the fieldpath in the deprecated plugin response
Browse files Browse the repository at this point in the history
Signed-off-by: Humble Chirammal <humble.devassy@gmail.com>
Signed-off-by: carlory <baofa.fan@daocloud.io>
  • Loading branch information
humblec committed Jun 16, 2023
1 parent 471fd1a commit f54c15d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions pkg/api/persistentvolume/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ func warningsForPersistentVolumeSpecAndMeta(fieldPath *field.Path, pvSpec *api.P
}
// If we are on deprecated volume plugin
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")))
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.28, non-functional in v1.31+", fieldPath.Child("spec", "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")))
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.11, non-functional in v1.16+", fieldPath.Child("spec", "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")))
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.16, non-functional in v1.22+", fieldPath.Child("spec", "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")))
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.22, non-functional in v1.25+", fieldPath.Child("spec", "storageOS")))
}
if pvSpec.Glusterfs != nil {
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.25, non-functional in v1.26+", fieldPath.Child("spec", "glusterfs")))
Expand Down
12 changes: 5 additions & 7 deletions pkg/api/persistentvolume/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func TestWarnings(t *testing.T) {
},
},
expected: []string{
`spec.persistentVolumeSource.cephfs: deprecated in v1.28, non-functional in v1.31+`,
`spec.cephfs: deprecated in v1.28, non-functional in v1.31+`,
},
},
{
Expand All @@ -209,7 +209,7 @@ func TestWarnings(t *testing.T) {
},
},
expected: []string{
`spec.persistentVolumeSource.photonPersistentDisk: deprecated in v1.11, non-functional in v1.16+`,
`spec.photonPersistentDisk: deprecated in v1.11, non-functional in v1.16+`,
},
},
{
Expand Down Expand Up @@ -254,10 +254,9 @@ func TestWarnings(t *testing.T) {
},
},
expected: []string{
`spec.persistentVolumeSource.scaleIO: deprecated in v1.16, non-functional in v1.22+`,
`spec.scaleIO: deprecated in v1.16, non-functional in v1.22+`,
},
},

{
name: "PV StorageOS deprecation warning",
template: &api.PersistentVolume{
Expand All @@ -274,10 +273,9 @@ func TestWarnings(t *testing.T) {
},
},
expected: []string{
`spec.persistentVolumeSource.storageOS: deprecated in v1.22, non-functional in v1.25+`,
`spec.storageOS: deprecated in v1.22, non-functional in v1.25+`,
},
},

{
name: "PV GlusterFS deprecation warning",
template: &api.PersistentVolume{
Expand All @@ -293,7 +291,7 @@ func TestWarnings(t *testing.T) {
},
},
expected: []string{
`spec.persistentVolumeSource.glusterfs: deprecated in v1.25, non-functional in v1.26+`,
`spec.glusterfs: deprecated in v1.25, non-functional in v1.26+`,
},
},
}
Expand Down

0 comments on commit f54c15d

Please sign in to comment.