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:
pospispa
2016-11-07 12:02:34 +01:00
parent 89a506a9b5
commit ef43f82de8
3 changed files with 53 additions and 0 deletions

View File

@@ -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
}