protected static void createPod(Kubernetes kubernetes, KubernetesFactory kubernetesFactory)
      throws Exception {
    String name = "console2";
    String image = "fabric8/hawtio";

    Pod pod = new Pod();
    pod.setId(name);

    Map<String, String> labels = new HashMap<>();
    labels.put("fabric8", "true");
    labels.put("container", name);

    pod.setLabels(labels);
    PodState desiredState = new PodState();
    pod.setDesiredState(desiredState);
    ContainerManifest manifest = new ContainerManifest();
    desiredState.setManifest(manifest);

    Container manifestContainer = new Container();
    manifestContainer.setName(name);
    manifestContainer.setImage(image);

    List<Container> containers = new ArrayList<>();
    containers.add(manifestContainer);
    manifest.setContainers(containers);

    System.out.println("About to create pod on " + kubernetesFactory.getAddress() + " with " + pod);
    kubernetes.createPod(pod, "mynamespace");
    System.out.println("Created pod: " + name);
    System.out.println();
  }
 protected static void listPods(Kubernetes kube) {
   System.out.println("Looking up pods");
   PodList pods = kube.getPods(Kubernetes.NAMESPACE_ALL);
   // System.out.println("Got pods: " + pods);
   List<Pod> items = pods.getItems();
   for (Pod item : items) {
     System.out.println("Pod " + getId(item) + " created: " + item.getCreationTimestamp());
     PodState desiredState = item.getDesiredState();
     if (desiredState != null) {
       ContainerManifest manifest = desiredState.getManifest();
       if (manifest != null) {
         List<Container> containers = manifest.getContainers();
         if (containers != null) {
           for (Container container : containers) {
             System.out.println(
                 "Container "
                     + container.getImage()
                     + " "
                     + container.getCommand()
                     + " ports: "
                     + container.getPorts());
           }
         }
       }
     }
     Map<String, ContainerStatus> currentContainers = KubernetesHelper.getCurrentContainers(item);
     System.out.println("Has " + currentContainers.size() + " container(s)");
     Set<Map.Entry<String, ContainerStatus>> entries = currentContainers.entrySet();
     for (Map.Entry<String, ContainerStatus> entry : entries) {
       String id = entry.getKey();
       ContainerStatus info = entry.getValue();
       System.out.println("Current container: " + id + " info: " + info);
     }
   }
   System.out.println();
 }