Skip to content

Commit

Permalink
Merge pull request #118552 from humblec/rbd-deprecation
Browse files Browse the repository at this point in the history
deprecate RBD plugin from available in-tree drivers
  • Loading branch information
k8s-ci-robot committed Jun 20, 2023
2 parents bbc7ca9 + f54c15d commit 9d90b76
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 13 deletions.
14 changes: 8 additions & 6 deletions pkg/api/persistentvolume/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,22 @@ 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", "persistentVolumeSource").Child("glusterfs")))
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.25, non-functional in v1.26+", fieldPath.Child("spec", "glusterfs")))
}
if pvSpec.RBD != nil {
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.28, non-functional in v1.31+", fieldPath.Child("spec", "rbd")))
}

return warnings
}
33 changes: 26 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,9 +209,30 @@ 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+`,
},
},
{
name: "PV RBD deprecation warning",
template: &api.PersistentVolume{
Spec: api.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{
RBD: &api.RBDPersistentVolumeSource{
CephMonitors: nil,
RBDImage: "",
FSType: "",
RBDPool: "",
RadosUser: "",
Keyring: "",
SecretRef: nil,
ReadOnly: false,
},
},
},
},
expected: []string{
`spec.rbd: deprecated in v1.28, non-functional in v1.31+`},
},
{
name: "PV ScaleIO deprecation warning",
template: &api.PersistentVolume{
Expand All @@ -233,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 @@ -253,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 @@ -272,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
3 changes: 3 additions & 0 deletions pkg/api/pod/warnings.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ func warningsForPodSpecAndMeta(fieldPath *field.Path, podSpec *api.PodSpec, meta
if v.CephFS != nil {
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.28, non-functional in v1.31+", fieldPath.Child("spec", "volumes").Index(i).Child("cephfs")))
}
if v.RBD != nil {
warnings = append(warnings, fmt.Sprintf("%s: deprecated in v1.28, non-functional in v1.31+", fieldPath.Child("spec", "volumes").Index(i).Child("rbd")))
}
}

// duplicate hostAliases (#91670, #58477)
Expand Down
9 changes: 9 additions & 0 deletions pkg/api/pod/warnings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ func TestWarnings(t *testing.T) {
expected: []string{`spec.volumes[0].cephfs: deprecated in v1.28, non-functional in v1.31+`},
},

{
name: "rbd",
template: &api.PodTemplateSpec{Spec: api.PodSpec{
Volumes: []api.Volume{
{Name: "s", VolumeSource: api.VolumeSource{RBD: &api.RBDVolumeSource{}}},
}},
},
expected: []string{`spec.volumes[0].rbd: deprecated in v1.28, non-functional in v1.31+`},
},
{
name: "duplicate hostAlias",
template: &api.PodTemplateSpec{Spec: api.PodSpec{
Expand Down

0 comments on commit 9d90b76

Please sign in to comment.