io.fabric8.kubernetes.api.builder.TypedVisitor Java Examples
The following examples show how to use
io.fabric8.kubernetes.api.builder.TypedVisitor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PrometheusEnricher.java From jkube with Eclipse Public License 2.0 | 6 votes |
@Override public void create(PlatformMode platformMode, KubernetesListBuilder builder) { builder.accept(new TypedVisitor<ServiceBuilder>() { @Override public void visit(ServiceBuilder serviceBuilder) { String prometheusPort = findPrometheusPort(); if (StringUtils.isNotBlank(prometheusPort)) { Map<String, String> annotations = new HashMap<>(); MapUtil.putIfAbsent(annotations, ANNOTATION_PROMETHEUS_PORT, prometheusPort); MapUtil.putIfAbsent(annotations, ANNOTATION_PROMETHEUS_SCRAPE, "true"); String prometheusPath = getConfig(Config.prometheusPath); if (StringUtils.isNotBlank(prometheusPath)) { MapUtil.putIfAbsent(annotations, ANNOTATION_PROMETHEUS_PATH, prometheusPath); } log.verbose("Adding prometheus.io annotations: %s", annotations.entrySet() .stream() .map(Object::toString) .collect(Collectors.joining(", "))); serviceBuilder.editMetadata().addToAnnotations(annotations).endMetadata(); } } }); }
Example #2
Source File: ImageEnricher.java From jkube with Eclipse Public License 2.0 | 6 votes |
private void updateContainers(KubernetesListBuilder builder) { builder.accept(new TypedVisitor<PodTemplateSpecBuilder>() { @Override public void visit(PodTemplateSpecBuilder templateBuilder) { PodTemplateSpecFluent.SpecNested<PodTemplateSpecBuilder> podSpec = templateBuilder.buildSpec() == null ? templateBuilder.withNewSpec() : templateBuilder.editSpec(); List<Container> containers = podSpec.buildContainers(); if (containers == null) { containers = new ArrayList<>(); } mergeImageConfigurationWithContainerSpec(containers); podSpec.withContainers(containers).endSpec(); } }); }
Example #3
Source File: DefaultServiceEnricher.java From jkube with Eclipse Public License 2.0 | 6 votes |
private void mergeInDefaultServiceParameters(KubernetesListBuilder builder, final Service defaultService) { builder.accept(new TypedVisitor<ServiceBuilder>() { @Override public void visit(ServiceBuilder service) { // Only update single service matching the default service's name String defaultServiceName = getDefaultServiceName(defaultService); ObjectMeta serviceMetadata = ensureServiceMetadata(service, defaultService); String serviceName = ensureServiceName(serviceMetadata, service, defaultServiceName); if (defaultService != null && defaultServiceName != null && defaultServiceName.equals(serviceName)) { addMissingServiceParts(service, defaultService); } } }); }
Example #4
Source File: IngressEnricher.java From jkube with Eclipse Public License 2.0 | 6 votes |
@Override public void create(PlatformMode platformMode, final KubernetesListBuilder listBuilder) { ResourceConfig resourceConfig = getConfiguration().getResource(); Boolean shouldCreateIngress = getValueFromConfig(CREATE_EXTERNAL_URLS, false); if (shouldCreateIngress.equals(Boolean.FALSE)) { return; } if (platformMode == PlatformMode.kubernetes) { listBuilder.accept(new TypedVisitor<ServiceBuilder>() { @Override public void visit(ServiceBuilder serviceBuilder) { Ingress ingress = addIngress(listBuilder, serviceBuilder, getRouteDomain(resourceConfig), log); if (ingress != null) { listBuilder.addToItems(ingress); } } }); } }
Example #5
Source File: ConfigMapEnricher.java From jkube with Eclipse Public License 2.0 | 6 votes |
private void addAnnotations(KubernetesListBuilder builder) { builder.accept(new TypedVisitor<ConfigMapBuilder>() { @Override public void visit(ConfigMapBuilder element) { final Map<String, String> annotations = element.buildMetadata().getAnnotations(); if (annotations != null) { try { addConfigMapFromAnnotations(annotations, element); } catch (IOException e) { throw new IllegalArgumentException(e); } } } }); }
Example #6
Source File: RouteEnricher.java From jkube with Eclipse Public License 2.0 | 6 votes |
@Override public void create(PlatformMode platformMode, final KubernetesListBuilder listBuilder) { ResourceConfig resourceConfig = getConfiguration().getResource(); if (resourceConfig != null && resourceConfig.getRouteDomain() != null) { routeDomainPostfix = resourceConfig.getRouteDomain(); } if(platformMode == PlatformMode.openshift && generateRoute.equals(Boolean.TRUE)) { final List<Route> routes = new ArrayList<>(); listBuilder.accept(new TypedVisitor<ServiceBuilder>() { @Override public void visit(ServiceBuilder serviceBuilder) { addRoute(listBuilder, serviceBuilder, routes); } }); if (!routes.isEmpty()) { Route[] routeArray = new Route[routes.size()]; routes.toArray(routeArray); listBuilder.addToItems(routeArray); } } }
Example #7
Source File: ServiceCatalogExampleTest.java From dekorate with Apache License 2.0 | 6 votes |
@Test public void shouldContainServiceInstanceAndBinding() { KubernetesList list = Serialization.unmarshalAsList(ServiceCatalogExampleTest.class.getClassLoader().getResourceAsStream("META-INF/dekorate/kubernetes.yml")); assertNotNull(list); assertTrue(findFirst(list, ServiceInstance.class).isPresent()); assertTrue(findFirst(list, ServiceBinding.class).isPresent()); Optional<Deployment> deployment = findFirst(list, Deployment.class); assertTrue(deployment.isPresent()); AtomicBoolean hasBindingEnv = new AtomicBoolean(false); new DeploymentBuilder(deployment.get()).accept(new TypedVisitor<EnvFromSourceFluent>() { @Override public void visit(EnvFromSourceFluent env) { if (env.hasSecretRef()) { hasBindingEnv.set(true); } } }); assertTrue(hasBindingEnv.get()); }
Example #8
Source File: ProjectLabelEnricher.java From jkube with Eclipse Public License 2.0 | 6 votes |
@Override public void enrich(PlatformMode platformMode, KubernetesListBuilder builder) { // Add to all objects in the builder builder.accept(new TypedVisitor<ObjectMetaBuilder>() { @Override public void visit(ObjectMetaBuilder element) { if (element.getLabels() != null) { Map<String, String> labels = element.getLabels(); MapUtil.mergeIfAbsent(labels, createLabels()); } else { Map<String, String> newLabels = new HashMap<>(); MapUtil.mergeIfAbsent(newLabels, createLabels()); element.withLabels(newLabels); } } }); }
Example #9
Source File: FileDataSecretEnricher.java From jkube with Eclipse Public License 2.0 | 6 votes |
private void addAnnotations(KubernetesListBuilder builder) { builder.accept(new TypedVisitor<SecretBuilder>() { @Override public void visit(SecretBuilder element) { final Map<String, String> annotations = element.buildMetadata().getAnnotations(); try { if (annotations != null && !annotations.isEmpty()) { final Map<String, String> secretAnnotations = createSecretFromAnnotations(annotations); element.addToData(secretAnnotations); } } catch (IOException e) { throw new IllegalArgumentException(e); } } }); }
Example #10
Source File: AddTaskToPipelineDecorator.java From dekorate with Apache License 2.0 | 6 votes |
public AddTaskToPipelineDecorator(String pipelineName, String name, String ref, Map<String, String> workspaces, Map<String, String> params, Map<String, String> inputs, Map<String, String> outputs) { this(pipelineName, new PipelineTaskBuilder() .withName(name) .withNewTaskRef().withName(ref).endTaskRef() .withWorkspaces(workspaces.entrySet().stream().map(e -> workspace(e.getKey(), e.getValue())).collect(Collectors.toList())) .withParams(params.entrySet().stream().map(e -> param(e.getKey(), e.getValue())).collect(Collectors.toList())) .accept(new TypedVisitor<PipelineTaskFluent<?>>() { @Override public void visit(PipelineTaskFluent<?> t) { if (!inputs.isEmpty() || !outputs.isEmpty()) { PipelineTaskResourcesBuilder b = new PipelineTaskResourcesBuilder(); if (!inputs.isEmpty()) { b.withInputs(inputs.entrySet().stream().map(e -> input(e.getKey(), e.getValue())).collect(Collectors.toList())); } if (!outputs.isEmpty()) { b.withOutputs(outputs.entrySet().stream().map(e -> output(e.getKey(), e.getValue())).collect(Collectors.toList())); } } } }).build()); }
Example #11
Source File: PortNameEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
@Override public void create(PlatformMode platformMode, KubernetesListBuilder builder) { builder.accept(new TypedVisitor<ContainerPortBuilder>() { @Override public void visit(ContainerPortBuilder portBuilder) { Integer port = portBuilder.getContainerPort(); // If port is given but no name, then try to detect the name if (port != null && StringUtils.isBlank(portBuilder.getName())) { addPortName(portBuilder, port); } } }); }
Example #12
Source File: IngressEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
/** * Returns true if we already have a route created for the given name */ private static boolean hasIngress(final KubernetesListBuilder listBuilder, final String name) { final AtomicBoolean answer = new AtomicBoolean(false); listBuilder.accept(new TypedVisitor<IngressBuilder>() { @Override public void visit(IngressBuilder builder) { ObjectMeta metadata = builder.buildMetadata(); if (metadata != null && name.equals(metadata.getName())) { answer.set(true); } } }); return answer.get(); }
Example #13
Source File: EndpointPathDecorator.java From dekorate with Apache License 2.0 | 5 votes |
@Override public void andThenVisit(ServiceMonitorBuilder serviceMonitor, ObjectMeta resourceMeta) { serviceMonitor.accept(new TypedVisitor<EndpointBuilder>() { @Override public void visit(EndpointBuilder endpoint) { if (port.equals(endpoint.getPort())) { endpoint.withPath(path); } } }); }
Example #14
Source File: TriggersAnnotationEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
protected String createAnnotation(Visitable<?> builder) { final List<ImageChangeTrigger> triggerList = new ArrayList<>(); builder.accept(new TypedVisitor<ContainerBuilder>() { @Override public void visit(ContainerBuilder cb) { Container container = cb.build(); String containerName = container.getName(); String containerImage = container.getImage(); ImageName image = new ImageName(containerImage); if (isContainerAllowed(containerName) && image.getRegistry() == null && image.getUser() == null) { // Imagestreams used as trigger are in the same namespace String tag = image.getTag() != null ? image.getTag() : "latest"; ImageChangeTrigger trigger = new ImageChangeTriggerBuilder() .withNewFrom() .withKind("ImageStreamTag") .withName(image.getSimpleName() + ":" + tag) .endFrom() .build(); trigger.setAdditionalProperty("fieldPath", "spec.template.spec.containers[?(@.name==\"" + containerName + "\")].image"); triggerList.add(trigger); } } }); try { return ResourceUtil.toJson(triggerList); } catch (JsonProcessingException e) { getLog().error("Error while creating ImageStreamTag triggers for Kubernetes resources: %s", e); return "[]"; } }
Example #15
Source File: SecretEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
@Override public void create(PlatformMode platformMode, KubernetesListBuilder builder) { // update builder // use a selector to choose all secret builder in kubernetes list builders. // try to find the target annotations // use the annotation value to generate data // add generated data to this builder builder.accept(new TypedVisitor<SecretBuilder>() { @Override public void visit(SecretBuilder secretBuilder) { Map<String, String> annotation = secretBuilder.buildMetadata().getAnnotations(); if (annotation != null) { if (!annotation.containsKey(getAnnotationKey())) { return; } String dockerId = annotation.get(getAnnotationKey()); Map<String, String> data = generateData(dockerId); if (data == null) { return; } // remove the annotation key annotation.remove(getAnnotationKey()); secretBuilder.addToData(data); } } }); addSecretsFromXmlConfiguration(builder); }
Example #16
Source File: LoadAsTemplateTest.java From kubernetes-client with Apache License 2.0 | 5 votes |
private void assertListIsProcessed(KubernetesList list) { assertNotNull(list); assertNotNull(list.getItems()); assertEquals(1, list.getItems().size()); final AtomicBoolean userIsRoot = new AtomicBoolean(false); final AtomicBoolean passwordIsNotNull = new AtomicBoolean(false); final AtomicBoolean requiredIsSet = new AtomicBoolean(false); final AtomicBoolean optionalIsEmpty = new AtomicBoolean(false); new KubernetesListBuilder(list).accept(new TypedVisitor<EnvVarBuilder>() { @Override public void visit(EnvVarBuilder element) { if (element.getName().equals("USERNAME")) { userIsRoot.set(element.getValue().equals("root")); } else if (element.getName().equals("PASSWORD")) { passwordIsNotNull.set(Utils.isNotNullOrEmpty(element.getValue())); } else if (element.getName().equals("REQUIRED")) { requiredIsSet.set(Utils.isNotNullOrEmpty(element.getValue())); } else if (element.getName().equals("OPTIONAL")) { optionalIsEmpty.set(element.getValue().isEmpty()); } } }).build(); assertTrue(userIsRoot.get()); assertTrue(passwordIsNotNull.get()); assertTrue(requiredIsSet.get()); assertTrue(optionalIsEmpty.get()); }
Example #17
Source File: RoleBindingOperationsImpl.java From kubernetes-client with Apache License 2.0 | 5 votes |
private void enrichSubjectsNamespace(RoleBindingBuilder builder) { builder.accept(new TypedVisitor<ObjectReferenceBuilder>() { @Override public void visit(ObjectReferenceBuilder o) { if (o.getKind() != null && o.getKind().equals(SERVICE_ACCOUNT) && (o.getNamespace() == null || o.getNamespace().isEmpty())) { o.withNamespace(getNamespace()); } } }); }
Example #18
Source File: DefaultServiceEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
private boolean hasServices(KubernetesListBuilder builder) { final AtomicBoolean hasService = new AtomicBoolean(false); builder.accept(new TypedVisitor<ServiceBuilder>() { @Override public void visit(ServiceBuilder element) { hasService.set(true); } }); return hasService.get(); }
Example #19
Source File: DefaultServiceEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
private void normalizeServicePorts(KubernetesListBuilder builder) { builder.accept(new TypedVisitor<ServicePortBuilder>() { @Override public void visit(ServicePortBuilder portBuilder) { PORT_NORMALIZATION_MAPPING.keySet().forEach(key -> { if (key.intValue() == portBuilder.buildTargetPort().getIntVal()) { portBuilder.withPort(PORT_NORMALIZATION_MAPPING.get(key)); } }); } }); }
Example #20
Source File: ImageEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
private void ensureTemplateSpecsInDeploymentConfig(KubernetesListBuilder builder) { builder.accept(new TypedVisitor<DeploymentConfigBuilder>() { @Override public void visit(DeploymentConfigBuilder item) { DeploymentConfigFluent.SpecNested<DeploymentConfigBuilder> spec = item.buildSpec() == null ? item.withNewSpec() : item.editSpec(); DeploymentConfigSpecFluent.TemplateNested<DeploymentConfigFluent.SpecNested<DeploymentConfigBuilder>> template = spec.buildTemplate() == null ? spec.withNewTemplate() : spec.editTemplate(); template.endTemplate().endSpec(); } }); }
Example #21
Source File: ImageEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
private void ensureTemplateSpecsInStatefulSet(KubernetesListBuilder builder) { builder.accept(new TypedVisitor<StatefulSetBuilder>() { @Override public void visit(StatefulSetBuilder item) { StatefulSetFluent.SpecNested<StatefulSetBuilder> spec = item.buildSpec() == null ? item.withNewSpec() : item.editSpec(); StatefulSetSpecFluent.TemplateNested<StatefulSetFluent.SpecNested<StatefulSetBuilder>> template = spec.buildTemplate() == null ? spec.withNewTemplate() : spec.editTemplate(); template.endTemplate().endSpec(); } }); }
Example #22
Source File: ImageEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
private void ensureTemplateSpecsInDaemonSet(KubernetesListBuilder builder) { builder.accept(new TypedVisitor<DaemonSetBuilder>() { @Override public void visit(DaemonSetBuilder item) { DaemonSetFluent.SpecNested<DaemonSetBuilder> spec = item.buildSpec() == null ? item.withNewSpec() : item.editSpec(); DaemonSetSpecFluent.TemplateNested<DaemonSetFluent.SpecNested<DaemonSetBuilder>> template = spec.buildTemplate() == null ? spec.withNewTemplate() : spec.editTemplate(); template.endTemplate().endSpec(); } }); }
Example #23
Source File: ImageEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
private void ensureTemplateSpecsInDeployments(KubernetesListBuilder builder) { builder.accept(new TypedVisitor<DeploymentBuilder>() { @Override public void visit(DeploymentBuilder item) { DeploymentFluent.SpecNested<DeploymentBuilder> spec = item.buildSpec() == null ? item.withNewSpec() : item.editSpec(); DeploymentSpecFluent.TemplateNested<DeploymentFluent.SpecNested<DeploymentBuilder>> template = spec.buildTemplate() == null ? spec.withNewTemplate() : spec.editTemplate(); template.endTemplate().endSpec(); } }); }
Example #24
Source File: ImageEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
private void ensureTemplateSpecsInRelicaSet(KubernetesListBuilder builder) { builder.accept(new TypedVisitor<ReplicaSetBuilder>() { @Override public void visit(ReplicaSetBuilder item) { ReplicaSetFluent.SpecNested<ReplicaSetBuilder> spec = item.buildSpec() == null ? item.withNewSpec() : item.editSpec(); ReplicaSetSpecFluent.TemplateNested<ReplicaSetFluent.SpecNested<ReplicaSetBuilder>> template = spec.buildTemplate() == null ? spec.withNewTemplate() : spec.editTemplate(); template.endTemplate().endSpec(); } }); }
Example #25
Source File: ImageEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
private void ensureTemplateSpecsInReplicationControllers(KubernetesListBuilder builder) { builder.accept(new TypedVisitor<ReplicationControllerBuilder>() { @Override public void visit(ReplicationControllerBuilder item) { ReplicationControllerFluent.SpecNested<ReplicationControllerBuilder> spec = item.buildSpec() == null ? item.withNewSpec() : item.editSpec(); ReplicationControllerSpecFluent.TemplateNested<ReplicationControllerFluent.SpecNested<ReplicationControllerBuilder>> template = spec.buildTemplate() == null ? spec.withNewTemplate() : spec.editTemplate(); template.endTemplate().endSpec(); } }); }
Example #26
Source File: RouteEnricher.java From jkube with Eclipse Public License 2.0 | 5 votes |
/** * Returns true if we already have a route created for the given name */ private boolean hasRoute(final KubernetesListBuilder listBuilder, final String name) { final AtomicBoolean answer = new AtomicBoolean(false); listBuilder.accept(new TypedVisitor<RouteBuilder>() { @Override public void visit(RouteBuilder builder) { ObjectMeta metadata = builder.buildMetadata(); if (metadata != null && name.equals(metadata.getName())) { answer.set(true); } } }); return answer.get(); }
Example #27
Source File: AbstractHealthCheckEnricherTest.java From jkube with Eclipse Public License 2.0 | 5 votes |
@Test public void enrichContainerWithSidecar() { KubernetesListBuilder list = new KubernetesListBuilder().addToItems(new DeploymentBuilder() .withNewSpec() .withNewTemplate() .withNewSpec() .addNewContainer() .withName("app") .withImage("app:latest") .endContainer() .addNewContainer() .withName("sidecar") .withImage("sidecar:latest") .endContainer() .endSpec() .endTemplate() .endSpec() .build()); createEnricher(new Properties(), Collections.singletonMap("FABRIC8_GENERATED_CONTAINERS", "app")).create(PlatformMode.kubernetes, list); final AtomicInteger containerFound = new AtomicInteger(0); list.accept(new TypedVisitor<ContainerBuilder>() { @Override public void visit(ContainerBuilder container) { if (container.getName().equals("app")) { assertNotNull(container.build().getLivenessProbe()); assertNotNull(container.build().getReadinessProbe()); containerFound.incrementAndGet(); } else if (container.getName().equals("sidecar")) { assertNull(container.build().getLivenessProbe()); assertNull(container.build().getReadinessProbe()); containerFound.incrementAndGet(); } } }); assertEquals(2, containerFound.get()); }
Example #28
Source File: AbstractHealthCheckEnricherTest.java From jkube with Eclipse Public License 2.0 | 5 votes |
@Test public void enrichSingleContainer() { KubernetesListBuilder list = new KubernetesListBuilder().addToItems(new DeploymentBuilder() .withNewSpec() .withNewTemplate() .withNewSpec() .addNewContainer() .withName("app") .withImage("app:latest") .endContainer() .endSpec() .endTemplate() .endSpec() .build()); createEnricher(new Properties(), Collections.emptyMap()).create(PlatformMode.kubernetes, list); final AtomicInteger containerFound = new AtomicInteger(0); list.accept(new TypedVisitor<ContainerBuilder>() { @Override public void visit(ContainerBuilder container) { assertNotNull(container.build().getLivenessProbe()); assertNotNull(container.build().getReadinessProbe()); containerFound.incrementAndGet(); } }); assertEquals(1, containerFound.get()); }
Example #29
Source File: ServiceAccountEnricher.java From jkube with Eclipse Public License 2.0 | 4 votes |
@Override public void create(PlatformMode mode, KubernetesListBuilder builder) { Map<String, String> deploymentToSaPair = new HashMap<>(); List<ServiceAccount> serviceAccounts = new ArrayList<>(); // Check XML config and see if there are any service accounts specified ResourceConfig xmlResourceConfig = getConfiguration().getResource(); if(xmlResourceConfig != null && xmlResourceConfig.getServiceAccounts() != null) { for(ServiceAccountConfig serviceAccountConfig : xmlResourceConfig.getServiceAccounts()) { if(serviceAccountConfig.getName() != null) { serviceAccounts.add(createServiceAccount(builder, serviceAccountConfig.getName())); } if(serviceAccountConfig.getDeploymentRef() != null) { deploymentToSaPair.put(serviceAccountConfig.getDeploymentRef(), serviceAccountConfig.getName()); } } } // If any service account is referenced in deployment spec, then // create sa on fly. builder.accept(new TypedVisitor<DeploymentBuilder>() { @Override public void visit(DeploymentBuilder deploymentBuilder) { String serviceAccountName = getServiceAccountNameFromSpec(deploymentBuilder); if(serviceAccountName != null && getServiceAccountFromList(builder, serviceAccountName) == null) { serviceAccounts.add(createServiceAccount(builder, serviceAccountName)); } if(deploymentToSaPair.containsKey(deploymentBuilder.buildMetadata().getName())) { deploymentBuilder.editSpec() .editTemplate() .editSpec() .withServiceAccountName(deploymentToSaPair.get(deploymentBuilder.buildMetadata().getName())) .endSpec() .endTemplate() .endSpec(); } } }); builder.addAllToServiceAccountItems(serviceAccounts); }
Example #30
Source File: AbstractHealthCheckEnricherTest.java From jkube with Eclipse Public License 2.0 | 4 votes |
@Test public void enrichAllContainers() { final Properties properties = new Properties(); properties.put(AbstractHealthCheckEnricher.ENRICH_ALL_CONTAINERS, "true"); KubernetesListBuilder list = new KubernetesListBuilder().addToItems(new DeploymentBuilder() .withNewSpec() .withNewTemplate() .withNewSpec() .addNewContainer() .withName("app") .withImage("app:latest") .endContainer() .addNewContainer() .withName("app2") .withImage("app2:latest") .endContainer() .endSpec() .endTemplate() .endSpec() .build()); createEnricher(properties, Collections.emptyMap()).create(PlatformMode.kubernetes,list); final AtomicInteger containerFound = new AtomicInteger(0); list.accept(new TypedVisitor<ContainerBuilder>() { @Override public void visit(ContainerBuilder container) { if (container.getName().equals("app")) { assertNotNull(container.build().getLivenessProbe()); assertNotNull(container.build().getReadinessProbe()); containerFound.incrementAndGet(); } else if (container.getName().equals("app2")) { assertNotNull(container.build().getLivenessProbe()); assertNotNull(container.build().getReadinessProbe()); containerFound.incrementAndGet(); } } }); assertEquals(2, containerFound.get()); }