Search in sources :

Example 1 with BatchV1Api

use of io.kubernetes.client.openapi.apis.BatchV1Api in project cdap by caskdata.

the class KubeTwillRunnerService method start.

@Override
public void start() {
    try {
        apiClient = Config.defaultClient();
        coreV1Api = new CoreV1Api(apiClient);
        batchV1Api = new BatchV1Api(apiClient);
        monitorScheduler = Executors.newSingleThreadScheduledExecutor(Threads.createDaemonThreadFactory("kube-monitor-executor"));
        resourceWatchers.values().forEach(watcher -> {
            watcher.addListener(new AppResourceChangeListener<>());
            watcher.start();
        });
        // start job cleaner service
        jobCleanerService = Executors.newSingleThreadScheduledExecutor(Threads.createDaemonThreadFactory("kube-job-cleaner"));
        jobCleanerService.scheduleAtFixedRate(new KubeJobCleaner(batchV1Api, kubeNamespace, selector, jobCleanBatchSize), 10, jobCleanupIntervalMins, TimeUnit.MINUTES);
    } catch (IOException e) {
        throw new IllegalStateException("Unable to get Kubernetes API Client", e);
    }
}
Also used : IOException(java.io.IOException) BatchV1Api(io.kubernetes.client.openapi.apis.BatchV1Api) CoreV1Api(io.kubernetes.client.openapi.apis.CoreV1Api)

Aggregations

BatchV1Api (io.kubernetes.client.openapi.apis.BatchV1Api)1 CoreV1Api (io.kubernetes.client.openapi.apis.CoreV1Api)1 IOException (java.io.IOException)1