Merge pull request #122339 from carlory/warnning-on-relaim-policy
warning on relaim policy when it is Recycle
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user