use of io.fabric8.maven.core.access.ClusterAccess in project fabric8-maven-plugin by fabric8io.
the class ClusterAccessTest method kubernetesPlatformModeTest.
@Test
public void kubernetesPlatformModeTest() throws Exception {
RootPaths rootpaths = new RootPaths();
rootpaths.setPaths(paths);
mockServer.expect().get().withPath("/").andReturn(200, rootpaths).always();
ClusterAccess clusterAccess = new ClusterAccess(null, client);
mode = clusterAccess.resolvePlatformMode(PlatformMode.kubernetes, logger);
assertEquals(PlatformMode.kubernetes, mode);
mode = clusterAccess.resolvePlatformMode(PlatformMode.DEFAULT, logger);
assertEquals(PlatformMode.kubernetes, mode);
mode = clusterAccess.resolvePlatformMode(null, logger);
assertEquals(PlatformMode.kubernetes, mode);
}
use of io.fabric8.maven.core.access.ClusterAccess in project fabric8-maven-plugin by fabric8io.
the class ClusterAccessTest method createClientTestOpenshift.
@Test
public void createClientTestOpenshift() throws Exception {
paths.add("/oapi");
paths.add("/oapi/v1");
RootPaths rootpaths = new RootPaths();
rootpaths.setPaths(paths);
mockServer.expect().get().withPath("/").andReturn(200, rootpaths).always();
ClusterAccess clusterAccess = new ClusterAccess(null, client);
Client outputClient = clusterAccess.createDefaultClient(logger);
assertTrue(outputClient instanceof OpenShiftClient);
}
use of io.fabric8.maven.core.access.ClusterAccess in project fabric8-maven-plugin by fabric8io.
the class DockerImageWatcher method restartContainer.
protected void restartContainer(WatchService.ImageWatcher watcher, Set<HasMetadata> resources) throws MojoExecutionException {
ImageConfiguration imageConfig = watcher.getImageConfiguration();
String imageName = imageConfig.getName();
try {
ClusterAccess clusterAccess = new ClusterAccess(getContext().getNamespace());
KubernetesClient client = clusterAccess.createDefaultClient(log);
String namespace = clusterAccess.getNamespace();
String imagePrefix = getImagePrefix(imageName);
for (HasMetadata entity : resources) {
updateImageName(client, namespace, entity, imagePrefix, imageName);
}
} catch (KubernetesClientException e) {
KubernetesResourceUtil.handleKubernetesClientException(e, this.log);
} catch (MojoExecutionException e) {
throw e;
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
Aggregations