docs: public static void main(String[] args) {
      boolean resourceNamespaced = true;
      String namespace = null;
      if (args.length > 0) {
        if ("--cluster".equals(args[0])) {
          resourceNamespaced = false;
        } else {
          namespace = args[0];
        }
      }
      try (final KubernetesClient client = new DefaultKubernetesClient()) {
        if (resourceNamespaced) {
          if (namespace == null) {
            namespace = client.getNamespace();
          }
          if (namespace == null) {
            System.err.println("No namespace specified and no default defined!");
            return;
          }
  
          System.out.println("Using namespace: " + namespace);
        } else {
          System.out.println("Creating cluster scoped resource");
        }
  
        if (logRootPaths) {
          RootPaths rootPaths = client.rootPaths();
          if (rootPaths != null) {
            List<String> paths = rootPaths.getPaths();
            if (paths != null) {
              System.out.println("Supported API Paths:");
              for (String path : paths) {
                System.out.println("    " + path);
              }
              System.out.println();
            }
          }
        }
  
        CustomResourceDefinitionList crds = client.customResourceDefinitions().list();
        List<CustomResourceDefinition> crdsItems = crds.getItems();
        System.out.println("Found " + crdsItems.size() + " CRD(s)");
        CustomResourceDefinition dummyCRD = null;
        for (CustomResourceDefinition crd : crdsItems) {
          ObjectMeta metadata = crd.getMetadata();
          if (metadata != null) {
            String name = metadata.getName();
            System.out.println("    " + name + " => " + metadata.getSelfLink());
            if (DUMMY_CRD_NAME.equals(name)) {
              dummyCRD = crd;
            }
          }
        }
        if (dummyCRD != null) {
          System.out.println("Found CRD: " + dummyCRD.getMetadata().getSelfLink());
        } else {
          dummyCRD = new CustomResourceDefinitionBuilder().
              withApiVersion("apiextensions.k8s.io/v1beta1").
              withNewMetadata().withName(DUMMY_CRD_NAME).endMetadata().
              withNewSpec().withGroup(DUMMY_CRD_GROUP).withVersion("v1").withScope(resourceScope(resourceNamespaced)).
                withNewNames().withKind("Dummy").withShortNames("dummy").withPlural("dummies").endNames().endSpec().
              build();
  
          client.customResourceDefinitions().create(dummyCRD);
          System.out.println("Created CRD " + dummyCRD.getMetadata().getName());
        }
  
        KubernetesDeserializer.registerCustomKind(DUMMY_CRD_GROUP + "/v1", "Dummy", Dummy.class);
  
        // lets create a client for the CRD
        NonNamespaceOperation<Dummy, DummyList, DoneableDummy, Resource<Dummy, DoneableDummy>> dummyClient = client.customResources(dummyCRD, Dummy.class, DummyList.class, DoneableDummy.class);
        if (resourceNamespaced) {
          dummyClient = ((MixedOperation<Dummy, DummyList, DoneableDummy, Resource<Dummy, DoneableDummy>>) dummyClient).inNamespace(namespace);
        }
        CustomResourceList<Dummy> dummyList = dummyClient.list();
        List<Dummy> items = dummyList.getItems();
        System.out.println("  found " + items.size() + " dummies");
        for (Dummy item : items) {
          System.out.println("    " + item);
        }
  
        Dummy dummy = new Dummy();
        ObjectMeta metadata = new ObjectMeta();
        metadata.setName("foo");
        dummy.setMetadata(metadata);
        DummySpec dummySpec = new DummySpec();
        Date now = new Date();
        dummySpec.setBar("beer: " + now);
        dummySpec.setFoo("cheese: " + now);
        dummy.setSpec(dummySpec);
  
        Dummy created = dummyClient.createOrReplace(dummy);
  
        System.out.println("Upserted " + dummy);
  
        created.getSpec().setBar("otherBar");
  
        dummyClient.createOrReplace(created);
  
        System.out.println("Watching for changes to Dummies");
        dummyClient.withResourceVersion(created.getMetadata().getResourceVersion()).watch(new Watcher<Dummy>() {
          @Override
          public void eventReceived(Action action, Dummy resource) {
            System.out.println("==> " + action + " for " + resource);
            if (resource.getSpec() == null) {
              logger.error("No Spec for resource " + resource);
            }
          }
  
          @Override
          public void onClose(KubernetesClientException cause) {
          }
        });
  
        System.in.read();
        
      } catch (KubernetesClientException e) {
        logger.error(e.getMessage(), e);
      } catch (Exception e) {
        logger.error(e.getMessage(), e);
      }
    }