class CronJobExample {
  private static final Logger logger = LoggerFactory.getLogger(CronJobExample.class);

  public static void main(String[] args) {<FILL_FUNCTION_BODY>}

  private static void log(String action, Object obj) {
    logger.info("{}: {}", action, obj);
  }

  private static void log(String action) {
    logger.info(action);
  }
}

    String master = "https://localhost:8443/";
    if (args.length == 1) {
      master = args[0];
    }

    log("Using master with url ", master);
    Config config = new ConfigBuilder().withMasterUrl(master).build();
    try (final KubernetesClient client = new KubernetesClientBuilder().withConfig(config).build()) {
      final String namespace = client.getNamespace();

      CronJob cronJob1 = new CronJobBuilder()
          .withApiVersion("batch/v1beta1")
          .withNewMetadata()
          .withName("hello")
          .withLabels(Collections.singletonMap("foo", "bar"))
          .endMetadata()
          .withNewSpec()
          .withSchedule("*/1 * * * *")
          .withNewJobTemplate()
          .withNewSpec()
          .withNewTemplate()
          .withNewSpec()
          .addNewContainer()
          .withName("hello")
          .withImage("busybox")
          .withArgs("/bin/sh", "-c", "date; echo Hello from Kubernetes")
          .endContainer()
          .withRestartPolicy("OnFailure")
          .endSpec()
          .endTemplate()
          .endSpec()
          .endJobTemplate()
          .endSpec()
          .build();

      log("Creating cron job from object");
      cronJob1 = client.batch().v1().cronjobs().inNamespace(namespace).resource(cronJob1).create();
      log("Successfully created cronjob with name ", cronJob1.getMetadata().getName());

      log("Watching over pod which would be created during cronjob execution...");
      final CountDownLatch watchLatch = new CountDownLatch(1);
      try (Watch ignored = client.pods().inNamespace(namespace).withLabel("job-name").watch(new Watcher<Pod>() {
        @Override
        public void eventReceived(Action action, Pod aPod) {
          log(aPod.getMetadata().getName(), aPod.getStatus().getPhase());
          if (aPod.getStatus().getPhase().equals("Succeeded")) {
            log("Logs -> ", client.pods().inNamespace(namespace).withName(aPod.getMetadata().getName()).getLog());
            watchLatch.countDown();
          }
        }

        @Override
        public void onClose(WatcherException e) {
          // Ignore
        }
      })) {
        watchLatch.await(2, TimeUnit.MINUTES);
      } catch (InterruptedException interruptedException) {
        Thread.currentThread().interrupt();
        log("Could not watch pod", interruptedException);
      } catch (KubernetesClientException kubernetesClientException) {
        log("Could not watch pod", kubernetesClientException);
      }
    } catch (KubernetesClientException exception) {
      log("An error occured while processing cronjobs:", exception.getMessage());
    }
  
<no_super_class>