use of io.fabric8.annotations.Path in project fabric8-maven-plugin by fabric8io.
the class ApplyMojo method serviceHasIngressRule.
/**
* Returns true if there is an existing ingress rule for the given service
*/
private boolean serviceHasIngressRule(List<Ingress> ingresses, Service service) {
String serviceName = KubernetesHelper.getName(service);
for (Ingress ingress : ingresses) {
IngressSpec spec = ingress.getSpec();
if (spec == null) {
break;
}
List<IngressRule> rules = spec.getRules();
if (rules == null) {
break;
}
for (IngressRule rule : rules) {
HTTPIngressRuleValue http = rule.getHttp();
if (http == null) {
break;
}
List<HTTPIngressPath> paths = http.getPaths();
if (paths == null) {
break;
}
for (HTTPIngressPath path : paths) {
IngressBackend backend = path.getBackend();
if (backend == null) {
break;
}
if (Objects.equals(serviceName, backend.getServiceName())) {
return true;
}
}
}
}
return false;
}
use of io.fabric8.annotations.Path in project fabric8-maven-plugin by fabric8io.
the class ResourceMojo method generateAppResources.
private KubernetesListBuilder generateAppResources(List<ImageConfiguration> images, EnricherManager enricherManager) throws IOException, MojoExecutionException {
Path composeFilePath = checkComposeConfig();
ComposeService composeUtil = new ComposeService(komposeBinDir, composeFilePath, log);
try {
File[] resourceFiles = KubernetesResourceUtil.listResourceFragments(resourceDir);
File[] composeResourceFiles = composeUtil.convertToKubeFragments();
File[] allResources = ArrayUtils.addAll(resourceFiles, composeResourceFiles);
KubernetesListBuilder builder;
// Add resource files found in the fabric8 directory
if (allResources != null && allResources.length > 0) {
if (resourceFiles != null && resourceFiles.length > 0) {
log.info("using resource templates from %s", resourceDir);
}
if (composeResourceFiles != null && composeResourceFiles.length > 0) {
log.info("using resource templates generated from compose file");
}
builder = readResourceFragments(allResources);
} else {
builder = new KubernetesListBuilder();
}
// Add locally configured objects
if (resources != null) {
// TODO: Allow also support resources to be specified via XML
addConfiguredResources(builder, images);
}
// Create default resources for app resources only
enricherManager.createDefaultResources(builder);
// Enrich descriptors
enricherManager.enrich(builder);
return builder;
} catch (ConstraintViolationException e) {
String message = ValidationUtil.createValidationMessage(e.getConstraintViolations());
log.error("ConstraintViolationException: %s", message);
throw new MojoExecutionException(message, e);
} catch (Fabric8ServiceException e) {
throw new MojoExecutionException(e.getMessage(), e);
} finally {
composeUtil.cleanComposeResources();
}
}
use of io.fabric8.annotations.Path in project strimzi by strimzi.
the class AbstractModel method createVolumeMount.
protected VolumeMount createVolumeMount(String name, String path) {
VolumeMount volumeMount = new VolumeMountBuilder().withName(name).withMountPath(path).build();
log.trace("Created volume mount {}", volumeMount);
return volumeMount;
}
use of io.fabric8.annotations.Path in project vertx-openshift-it by cescoffier.
the class Deployment method deployIfNeeded.
public static String deployIfNeeded(KubernetesClient client, String name, String path) {
if (oc(client).deploymentConfigs().withName(name).get() != null) {
System.out.println("Skipping the creation of dc/" + name);
return name;
}
ImageStream stream = findImageStream(client, name);
ensureThat("the image stream " + name + " exists in the namespace " + client.getNamespace(), () -> assertThat(stream).isNotNull());
File file = filter(Objects.requireNonNull(path), ImmutableMap.of("image", stream.getStatus().getDockerImageRepository()));
String name2 = deployIfNeeded(client, file);
assertThat(name).isEqualTo(name2);
return name;
}
use of io.fabric8.annotations.Path in project vertx-openshift-it by cescoffier.
the class HealthCheckIT method testReadinessIsPresent.
@Test
public void testReadinessIsPresent() throws Exception {
final List<Container> containers = getContainers();
ensureThat("the readiness probe is configured correctly", () -> {
containers.forEach(c -> {
Probe readinessProbe = c.getReadinessProbe();
assertThat(readinessProbe).as("Readiness probe should not be null.").isNotNull();
softly.assertThat(readinessProbe.getHttpGet().getPort().getIntVal()).as("port should be defined for readiness probe").isEqualTo(8088);
softly.assertThat(readinessProbe.getHttpGet().getPath()).as("path should be defined for readiness probe").isEqualTo("/start");
});
});
}
Aggregations