use of io.kubernetes.client.util.KubeConfig in project submarine by apache.
the class ExperimentRestApiIT method startUp.
@BeforeClass
public static void startUp() throws IOException {
Assert.assertTrue(checkIfServerIsRunning());
// The kube config is created when the cluster builds
String confPath = System.getProperty("user.home") + "/.kube/config";
KubeConfig config = KubeConfig.loadKubeConfig(new FileReader(confPath));
ApiClient client = ClientBuilder.kubeconfig(config).build();
Configuration.setDefaultApiClient(client);
k8sApi = new CustomObjectsApi();
kfOperatorMap = new HashMap<>();
kfOperatorMap.put("tensorflow", new KfOperator("v1", "tfjobs"));
kfOperatorMap.put("pytorch", new KfOperator("v1", "pytorchjobs"));
}
use of io.kubernetes.client.util.KubeConfig in project submarine by apache.
the class NotebookRestApiIT method startUp.
@BeforeClass
public static void startUp() throws IOException {
Assert.assertTrue(checkIfServerIsRunning());
// The kube config is created when the cluster builds
String confPath = System.getProperty("user.home") + "/.kube/config";
KubeConfig config = KubeConfig.loadKubeConfig(new FileReader(confPath));
ApiClient client = ClientBuilder.kubeconfig(config).build();
Configuration.setDefaultApiClient(client);
k8sApi = new CustomObjectsApi();
}
use of io.kubernetes.client.util.KubeConfig in project submarine by apache.
the class K8sSubmitter method initialize.
@Override
public void initialize(SubmarineConfiguration conf) {
try {
String path = System.getenv(KUBECONFIG_ENV);
KubeConfig config = KubeConfig.loadKubeConfig(new FileReader(path));
client = ClientBuilder.kubeconfig(config).build();
} catch (Exception e) {
LOG.info("Maybe in cluster mode, try to initialize the client again.");
try {
client = ClientBuilder.cluster().build();
} catch (IOException e1) {
LOG.error("Initialize K8s submitter failed. " + e.getMessage(), e1);
throw new SubmarineRuntimeException(500, "Initialize K8s submitter failed.");
}
} finally {
OkHttpClient httpClient = client.getHttpClient();
client.setHttpClient(httpClient);
Configuration.setDefaultApiClient(client);
}
if (coreApi == null) {
coreApi = new CoreV1Api(client);
}
if (appsV1Api == null) {
appsV1Api = new AppsV1Api();
}
podClient = new GenericKubernetesApi<>(V1Pod.class, V1PodList.class, "", "v1", "pods", client);
eventClient = new GenericKubernetesApi<>(CoreV1Event.class, CoreV1EventList.class, "", "v1", "events", client);
persistentVolumeClaimClient = new GenericKubernetesApi<>(V1PersistentVolumeClaim.class, V1PersistentVolumeClaimList.class, "", "v1", "persistentvolumeclaims", client);
configMapClient = new GenericKubernetesApi<>(V1ConfigMap.class, V1ConfigMapList.class, "", "v1", "configmaps", client);
tfJobClient = new GenericKubernetesApi<>(TFJob.class, TFJobList.class, TFJob.CRD_TF_GROUP_V1, TFJob.CRD_TF_VERSION_V1, TFJob.CRD_TF_PLURAL_V1, client);
pyTorchJobClient = new GenericKubernetesApi<>(PyTorchJob.class, PyTorchJobList.class, PyTorchJob.CRD_PYTORCH_GROUP_V1, PyTorchJob.CRD_PYTORCH_VERSION_V1, PyTorchJob.CRD_PYTORCH_PLURAL_V1, client);
notebookCRClient = new GenericKubernetesApi<>(NotebookCR.class, NotebookCRList.class, NotebookCR.CRD_NOTEBOOK_GROUP_V1, NotebookCR.CRD_NOTEBOOK_VERSION_V1, NotebookCR.CRD_NOTEBOOK_PLURAL_V1, client);
ingressRouteClient = new GenericKubernetesApi<>(IngressRoute.class, IngressRouteList.class, IngressRoute.CRD_INGRESSROUTE_GROUP_V1, IngressRoute.CRD_INGRESSROUTE_VERSION_V1, IngressRoute.CRD_INGRESSROUTE_PLURAL_V1, client);
seldonDeploymentClient = new GenericKubernetesApi<>(SeldonDeployment.class, SeldonDeploymentList.class, SeldonConstants.GROUP, SeldonConstants.VERSION, SeldonConstants.PLURAL, client);
istioVirtualServiceClient = new GenericKubernetesApi<>(IstioVirtualService.class, IstioVirtualServiceList.class, IstioConstants.GROUP, IstioConstants.VERSION, IstioConstants.PLURAL, client);
}
use of io.kubernetes.client.util.KubeConfig in project submarine by apache.
the class ExperimentRestApiTest method startUp.
@BeforeClass
public static void startUp() throws IOException {
Assert.assertTrue(checkIfServerIsRunning());
// The kube config is created when the cluster builds
String confPath = System.getProperty("user.home") + "/.kube/config";
KubeConfig config = KubeConfig.loadKubeConfig(new FileReader(confPath));
ApiClient client = ClientBuilder.kubeconfig(config).build();
Configuration.setDefaultApiClient(client);
k8sApi = new CustomObjectsApi();
kfOperatorMap = new HashMap<>();
kfOperatorMap.put("tensorflow", new KfOperator("v1", "tfjobs"));
kfOperatorMap.put("pytorch", new KfOperator("v1", "pytorchjobs"));
}
use of io.kubernetes.client.util.KubeConfig in project submarine by apache.
the class NotebookRestApiTest method startUp.
@BeforeClass
public static void startUp() throws IOException {
Assert.assertTrue(checkIfServerIsRunning());
// The kube config is created when the cluster builds
String confPath = System.getProperty("user.home") + "/.kube/config";
KubeConfig config = KubeConfig.loadKubeConfig(new FileReader(confPath));
ApiClient client = ClientBuilder.kubeconfig(config).build();
Configuration.setDefaultApiClient(client);
k8sApi = new CustomObjectsApi();
}
Aggregations