Merge pull request #122339 from carlory/warnning-on-relaim-policy

warning on relaim policy when it is Recycle
This commit is contained in:
Kubernetes Prow Robot 2023-12-29 04:39:14 +01:00 committed by GitHub
commit 63eb5028ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -69,6 +69,10 @@ func warningsForPersistentVolumeSpecAndMeta(fieldPath *field.Path, pvSpec *api.P
)
}
if pvSpec.PersistentVolumeReclaimPolicy == api.PersistentVolumeReclaimRecycle {
warnings = append(warnings, fmt.Sprintf("%s: The Recycle reclaim policy is deprecated. Instead, the recommended approach is to use dynamic provisioning.", fieldPath.Child("spec", "persistentVolumeReclaimPolicy")))
}
if pvSpec.NodeAffinity != nil && pvSpec.NodeAffinity.Required != nil {
termFldPath := fieldPath.Child("spec", "nodeAffinity", "required", "nodeSelectorTerms")
// use of deprecated node labels in node affinity

View File

@ -174,6 +174,17 @@ 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: "PersistentVolumeReclaimRecycle deprecation warning",
template: &api.PersistentVolume{
Spec: api.PersistentVolumeSpec{
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimRecycle,
},
},
expected: []string{
`spec.persistentVolumeReclaimPolicy: The Recycle reclaim policy is deprecated. Instead, the recommended approach is to use dynamic provisioning.`,
},
},
{
name: "PV CephFS deprecation warning",
template: &api.PersistentVolume{