Example #1
0
func deleteIngress(c *k8sclient.Client, ns string, selector labels.Selector) error {
	ing, err := c.Ingress(ns).List(api.ListOptions{LabelSelector: selector})
	if err != nil {
		return err
	}
	for _, i := range ing.Items {
		err := c.Ingress(ns).Delete(i.Name, nil)
		if err != nil {
			return errors.Wrap(err, fmt.Sprintf("failed to delete Ingress %s", i.Name))
		}
	}
	return nil
}