Add pod prune for api v2.

Add the ability to prune pods for api v2,
Includes the addition of force flag, for client side prompt.
Update test suite to support this use case.

Signed-off-by: Sujil02 <sushah@redhat.com>
This commit is contained in:
Sujil02
2020-04-02 22:56:59 -04:00
parent aa97cb5f42
commit 37f3b191d5
13 changed files with 144 additions and 40 deletions

View File

@ -176,8 +176,7 @@ func (r *Runtime) GetRunningPods() ([]*Pod, error) {
}
// PrunePods removes unused pods and their containers from local storage.
// If force is given, then running pods are also included in the pruning.
func (r *Runtime) PrunePods() (map[string]error, error) {
func (r *Runtime) PrunePods(ctx context.Context) (map[string]error, error) {
response := make(map[string]error)
states := []string{define.PodStateStopped, define.PodStateExited}
filterFunc := func(p *Pod) bool {