Пример #1
0
func deleteJobs(expClient client.ExtensionsInterface, ns string) error {
	items, err := expClient.Jobs(ns).List(unversioned.ListOptions{})
	if err != nil {
		return err
	}
	for i := range items.Items {
		err := expClient.Jobs(ns).Delete(items.Items[i].Name, nil)
		if err != nil && !errors.IsNotFound(err) {
			return err
		}
	}
	return nil
}
Пример #2
0
func deleteJobs(expClient client.ExtensionsInterface, ns string) error {
	items, err := expClient.Jobs(ns).List(labels.Everything(), fields.Everything())
	if err != nil {
		return err
	}
	for i := range items.Items {
		err := expClient.Jobs(ns).Delete(items.Items[i].Name, nil)
		if err != nil && !errors.IsNotFound(err) {
			return err
		}
	}
	return nil
}