本文整理汇总了Java中io.fabric8.kubernetes.client.KubernetesClientException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java KubernetesClientException.getMessage方法的具体用法?Java KubernetesClientException.getMessage怎么用?Java KubernetesClientException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.fabric8.kubernetes.client.KubernetesClientException
的用法示例。
在下文中一共展示了KubernetesClientException.getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doDelete
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
private CompletableFuture<Void> doDelete(String name) throws InfrastructureException {
try {
final PodResource<Pod, DoneablePod> podResource =
clientFactory.create().pods().inNamespace(namespace).withName(name);
final CompletableFuture<Void> deleteFuture = new CompletableFuture<>();
final Watch watch = podResource.watch(new DeleteWatcher(deleteFuture));
podResource.delete();
return deleteFuture.whenComplete(
(v, e) -> {
if (e != null) {
LOG.warn("Failed to remove pod {} cause {}", name, e.getMessage());
}
watch.close();
});
} catch (KubernetesClientException ex) {
throw new InfrastructureException(ex.getMessage(), ex);
}
}
示例2: create
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Creates specified service.
*
* @param service service to create
* @return created service
* @throws InfrastructureException when any exception occurs
*/
public Service create(Service service) throws InfrastructureException {
putLabel(service, CHE_WORKSPACE_ID_LABEL, workspaceId);
putSelector(service, CHE_WORKSPACE_ID_LABEL, workspaceId);
try {
return clientFactory.create().services().inNamespace(namespace).create(service);
} catch (KubernetesClientException e) {
throw new InfrastructureException(e.getMessage(), e);
}
}
示例3: get
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Returns all existing services.
*
* @throws InfrastructureException when any exception occurs
*/
public List<Service> get() throws InfrastructureException {
try {
return clientFactory
.create()
.services()
.inNamespace(namespace)
.withLabel(CHE_WORKSPACE_ID_LABEL, workspaceId)
.list()
.getItems();
} catch (KubernetesClientException e) {
throw new InfrastructureException(e.getMessage(), e);
}
}
示例4: delete
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Deletes all existing services.
*
* @throws InfrastructureException when any exception occurs
*/
public void delete() throws InfrastructureException {
try {
clientFactory
.create()
.services()
.inNamespace(namespace)
.withLabel(CHE_WORKSPACE_ID_LABEL, workspaceId)
.delete();
} catch (KubernetesClientException e) {
throw new InfrastructureException(e.getMessage(), e);
}
}
示例5: create
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Creates specified route.
*
* @param route route to create
* @return created route
* @throws InfrastructureException when any exception occurs
*/
public Route create(Route route) throws InfrastructureException {
putLabel(route, CHE_WORKSPACE_ID_LABEL, workspaceId);
try {
return clientFactory.create().routes().inNamespace(namespace).create(route);
} catch (KubernetesClientException e) {
throw new InfrastructureException(e.getMessage(), e);
}
}
示例6: get
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Returns all existing routes.
*
* @throws InfrastructureException when any exception occurs
*/
public List<Route> get() throws InfrastructureException {
try {
return clientFactory
.create()
.routes()
.inNamespace(namespace)
.withLabel(CHE_WORKSPACE_ID_LABEL, workspaceId)
.list()
.getItems();
} catch (KubernetesClientException e) {
throw new InfrastructureException(e.getMessage(), e);
}
}
示例7: delete
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Deletes all existing routes.
*
* @throws InfrastructureException when any exception occurs
*/
public void delete() throws InfrastructureException {
try {
clientFactory
.create()
.routes()
.inNamespace(namespace)
.withLabel(CHE_WORKSPACE_ID_LABEL, workspaceId)
.delete();
} catch (KubernetesClientException e) {
throw new InfrastructureException(e.getMessage(), e);
}
}
示例8: create
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
private void create(String projectName, OpenShiftClient client) throws InfrastructureException {
try {
client
.projectrequests()
.createNew()
.withNewMetadata()
.withName(projectName)
.endMetadata()
.done();
} catch (KubernetesClientException e) {
throw new InfrastructureException(e.getMessage(), e);
}
}
示例9: get
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
private Project get(String projectName, OpenShiftClient client) throws InfrastructureException {
try {
return client.projects().withName(projectName).get();
} catch (KubernetesClientException e) {
if (e.getCode() == 403) {
// project is foreign or doesn't exist
return null;
} else {
throw new InfrastructureException(e.getMessage(), e);
}
}
}
示例10: create
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Creates specified persistent volume claim.
*
* @param pvc persistent volume claim to create
* @return created persistent volume claim
* @throws InfrastructureException when any exception occurs
*/
public PersistentVolumeClaim create(PersistentVolumeClaim pvc) throws InfrastructureException {
try {
return clientFactory.create().persistentVolumeClaims().inNamespace(namespace).create(pvc);
} catch (KubernetesClientException e) {
throw new InfrastructureException(e.getMessage(), e);
}
}
示例11: get
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Returns all existing persistent volume claims.
*
* @throws InfrastructureException when any exception occurs
*/
public List<PersistentVolumeClaim> get() throws InfrastructureException {
try {
return clientFactory
.create()
.persistentVolumeClaims()
.inNamespace(namespace)
.list()
.getItems();
} catch (KubernetesClientException e) {
throw new InfrastructureException(e.getMessage(), e);
}
}
示例12: create
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Creates specified pod.
*
* @param pod pod to create
* @return created pod
* @throws InfrastructureException when any exception occurs
*/
public Pod create(Pod pod) throws InfrastructureException {
putLabel(pod, CHE_WORKSPACE_ID_LABEL, workspaceId);
try {
return clientFactory.create().pods().inNamespace(namespace).create(pod);
} catch (KubernetesClientException e) {
throw new InfrastructureException(e.getMessage(), e);
}
}
示例13: get
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Returns all existing pods.
*
* @throws InfrastructureException when any exception occurs
*/
public List<Pod> get() throws InfrastructureException {
try {
return clientFactory
.create()
.pods()
.inNamespace(namespace)
.withLabel(CHE_WORKSPACE_ID_LABEL, workspaceId)
.list()
.getItems();
} catch (KubernetesClientException e) {
throw new InfrastructureException(e.getMessage(), e);
}
}
示例14: watch
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Starts watching the pods inside OpenShift namespace and registers a specified handler for such
* events. Note that watcher can be started only once so two times invocation of this method will
* not produce new watcher and just register the event handlers.
*
* @param handler pod action events handler
* @throws InfrastructureException if any error occurs while watcher starting
*/
public void watch(PodActionHandler handler) throws InfrastructureException {
if (podWatch == null) {
final Watcher<Pod> watcher =
new Watcher<Pod>() {
@Override
public void eventReceived(Action action, Pod pod) {
podActionHandlers.forEach(h -> h.handle(action, pod));
}
@Override
public void onClose(KubernetesClientException ignored) {}
};
try {
podWatch =
clientFactory
.create()
.pods()
.inNamespace(namespace)
.withLabel(CHE_WORKSPACE_ID_LABEL, workspaceId)
.watch(watcher);
} catch (KubernetesClientException ex) {
throw new InfrastructureException(ex.getMessage());
}
}
podActionHandlers.add(handler);
}
示例15: watchContainers
import io.fabric8.kubernetes.client.KubernetesClientException; //导入方法依赖的package包/类
/**
* Registers a specified handler for handling events about changes in pods containers.
*
* @param handler pod container events handler
* @throws InfrastructureException if any error occurs while watcher starting
*/
public void watchContainers(ContainerEventHandler handler) throws InfrastructureException {
if (containerWatch == null) {
final Watcher<Event> watcher =
new Watcher<Event>() {
@Override
public void eventReceived(Action action, Event event) {
ObjectReference involvedObject = event.getInvolvedObject();
String fieldPath = involvedObject.getFieldPath();
// check that event related to
if (POD_OBJECT_KIND.equals(involvedObject.getKind()) && fieldPath != null) {
Matcher containerFieldMatcher = CONTAINER_FIELD_PATH_PATTERN.matcher(fieldPath);
if (containerFieldMatcher.matches()) {
String podName = involvedObject.getName();
String containerName = containerFieldMatcher.group(CONTAINER_NAME_GROUP);
ContainerEvent containerEvent =
new ContainerEvent(
podName,
containerName,
event.getMessage(),
event.getMetadata().getCreationTimestamp());
containerEventsHandlers.forEach(h -> h.handle(containerEvent));
}
}
}
@Override
public void onClose(KubernetesClientException ignored) {}
};
try {
containerWatch = clientFactory.create().events().inNamespace(namespace).watch(watcher);
} catch (KubernetesClientException ex) {
throw new InfrastructureException(ex.getMessage());
}
}
containerEventsHandlers.add(handler);
}