Exemple #1
0
 public static void deleteServices(KubernetesClient client, Logger logger, Filter<Service> filter)
     throws MultiException {
   List<Throwable> errors = new ArrayList<>();
   for (Service service : client.getServices().getItems()) {
     if (filter.matches(service)) {
       try {
         logger.info("Deleting service:" + getId(service));
         client.deleteService(getId(service));
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }
   if (!errors.isEmpty()) {
     throw new MultiException("Error while deleting services", errors);
   }
 }
Exemple #2
0
  public static void deleteReplicationControllers(
      KubernetesClient client, Logger logger, Filter<ReplicationController> filter)
      throws MultiException {
    List<Throwable> errors = new ArrayList<>();
    for (ReplicationController replicationController :
        client.getReplicationControllers().getItems()) {
      if (filter.matches(replicationController)) {
        try {
          logger.info("Deleting replication controller:" + getId(replicationController));
          client.deleteReplicationController(getId(replicationController));
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }

    if (!errors.isEmpty()) {
      throw new MultiException("Error while deleting replication controllers", errors);
    }
  }