1 import kubernetes.client 2 import kubernetes.config 3 from flask import current_app 4 import time 5 6 7 class K8sDispatcher(): 8 def __init__(self): 9 kubernetes.config.load_kube_config(current_app.config["KUBE_CONFIG"]) 10 current_app.logger.info( 11 "=== config file is: {}".format( 12 current_app.config["KUBE_CONFIG"])) 13 self.batch_v1 = kubernetes.client.BatchV1Api() 14 self.core_v1 = kubernetes.client.CoreV1Api() 15 self.NAMESPACE = "calibration" 16 self.volumes = {} 17 self.image = None