From c009667c6c64ae1d8ed14acb233fe96a56f3f262 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Thu, 4 May 2023 15:11:14 +0530 Subject: [PATCH] deprecate CephFS plugin from available in-tree drivers. https://groups.google.com/a/kubernetes.io/g/dev/c/g8rwL-qnQhk based on above, the consensus was to start the deprecation in v1.28. This commit start the deprecation process of CephFS plugin from in-tree drivers. Signed-off-by: Humble Chirammal --- pkg/api/persistentvolume/util.go | 4 ++++ pkg/api/persistentvolume/util_test.go | 20 ++++++++++++++++++++ pkg/api/pod/warnings.go | 3 +++ pkg/api/pod/warnings_test.go | 9 +++++++++ 4 files changed, 36 insertions(+) diff --git a/pkg/api/persistentvolume/util.go b/pkg/api/persistentvolume/util.go index a74b6320501..b74b96c5f78 100644 --- a/pkg/api/persistentvolume/util.go +++ b/pkg/api/persistentvolume/util.go @@ -79,6 +79,10 @@ func warningsForPersistentVolumeSpecAndMeta(fieldPath *field.Path, pvSpec *api.P warnings = append(warnings, nodeapi.GetWarningsForNodeSelectorTerm(term, termFldPath.Index(i))...) } } + // 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"))) + } return warnings } diff --git a/pkg/api/persistentvolume/util_test.go b/pkg/api/persistentvolume/util_test.go index 5a652ec5eb3..f423f09f85e 100644 --- a/pkg/api/persistentvolume/util_test.go +++ b/pkg/api/persistentvolume/util_test.go @@ -176,6 +176,26 @@ func TestWarnings(t *testing.T) { `spec.nodeAffinity.required.nodeSelectorTerms[0].matchExpressions[0].key: beta.kubernetes.io/os is deprecated since v1.14; use "kubernetes.io/os" instead`, }, }, + { + name: "PV CephFS deprecation warning", + template: &api.PersistentVolume{ + Spec: api.PersistentVolumeSpec{ + PersistentVolumeSource: api.PersistentVolumeSource{ + CephFS: &api.CephFSPersistentVolumeSource{ + Monitors: nil, + Path: "", + User: "", + SecretFile: "", + SecretRef: nil, + ReadOnly: false, + }, + }, + }, + }, + expected: []string{ + `spec.persistentVolumeSource.cephfs: deprecated in v1.28, non-functional in v1.31+`, + }, + }, } for _, tc := range testcases { diff --git a/pkg/api/pod/warnings.go b/pkg/api/pod/warnings.go index 31a66b116be..41e93153487 100644 --- a/pkg/api/pod/warnings.go +++ b/pkg/api/pod/warnings.go @@ -160,6 +160,9 @@ func warningsForPodSpecAndMeta(fieldPath *field.Path, podSpec *api.PodSpec, meta if v.Ephemeral != nil && v.Ephemeral.VolumeClaimTemplate != nil { warnings = append(warnings, pvcutil.GetWarningsForPersistentVolumeClaimSpec(fieldPath.Child("spec", "volumes").Index(i).Child("ephemeral").Child("volumeClaimTemplate").Child("spec"), v.Ephemeral.VolumeClaimTemplate.Spec)...) } + 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"))) + } } // duplicate hostAliases (#91670, #58477) diff --git a/pkg/api/pod/warnings_test.go b/pkg/api/pod/warnings_test.go index e849fb37bef..98a88419f04 100644 --- a/pkg/api/pod/warnings_test.go +++ b/pkg/api/pod/warnings_test.go @@ -214,7 +214,16 @@ func TestWarnings(t *testing.T) { }}, }, expected: []string{`spec.volumes[0].glusterfs: deprecated in v1.25, non-functional in v1.26+`}, + }, { + name: "CephFS", + template: &api.PodTemplateSpec{Spec: api.PodSpec{ + Volumes: []api.Volume{ + {Name: "s", VolumeSource: api.VolumeSource{CephFS: &api.CephFSVolumeSource{}}}, + }}, + }, + expected: []string{`spec.volumes[0].cephfs: deprecated in v1.28, non-functional in v1.31+`}, }, + { name: "duplicate hostAlias", template: &api.PodTemplateSpec{Spec: api.PodSpec{