Recycle Pod Template Check
The kube-controller-manager has two command line arguments (--pv-recycler-pod-template-filepath-hostpath and --pv-recycler-pod-template-filepath-nfs) that specify a recycle pod template. The recycle pod template may not contain the volume that shall be recycled. A check is added to make sure that the recycle pod template contains at least a volume.
This commit is contained in:
@@ -563,3 +563,15 @@ func NewPersistentVolumeRecyclerPodTemplate() *v1.Pod {
|
||||
}
|
||||
return pod
|
||||
}
|
||||
|
||||
// Check validity of recycle pod template
|
||||
// List of checks:
|
||||
// - at least one volume is defined in the recycle pod template
|
||||
// If successful, returns nil
|
||||
// if unsuccessful, returns an error.
|
||||
func ValidateRecyclerPodTemplate(pod *v1.Pod) error {
|
||||
if len(pod.Spec.Volumes) < 1 {
|
||||
return fmt.Errorf("does not contain any volume(s)")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user