Java Code Examples for io.fabric8.kubernetes.api.model.ObjectMeta#setAdditionalProperty()
The following examples show how to use
io.fabric8.kubernetes.api.model.ObjectMeta#setAdditionalProperty() .
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: PodMergerTest.java From che with Eclipse Public License 2.0 | 6 votes |
@Test public void shouldMatchMergedPodTemplateLabelsWithDeploymentSelector() throws Exception { // given ObjectMeta podMeta1 = new ObjectMetaBuilder() .withName("ignored-1") .withAnnotations(ImmutableMap.of("ann1", "v1")) .withLabels(ImmutableMap.of("label1", "v1")) .build(); podMeta1.setAdditionalProperty("add1", 1L); PodData podData1 = new PodData(new PodSpecBuilder().build(), podMeta1); // when Deployment merged = podMerger.merge(Collections.singletonList(podData1)); // then PodTemplateSpec podTemplate = merged.getSpec().getTemplate(); ObjectMeta podMeta = podTemplate.getMetadata(); Map<String, String> deploymentSelector = merged.getSpec().getSelector().getMatchLabels(); assertTrue(podMeta.getLabels().entrySet().containsAll(deploymentSelector.entrySet())); }
Example 2
Source File: KubernetesDiscoveryClientFilterTest.java From spring-cloud-kubernetes with Apache License 2.0 | 5 votes |
private List<Service> createSpringBootServiceByName(List<String> serviceNames) { List<Service> serviceCollection = new ArrayList<>(serviceNames.size()); for (String serviceName : serviceNames) { Service service = new Service(); ObjectMeta objectMeta = new ObjectMeta(); objectMeta.setName(serviceName); objectMeta.setAdditionalProperty("spring-boot", "true"); service.setMetadata(objectMeta); serviceCollection.add(service); } return serviceCollection; }
Example 3
Source File: PodMergerTest.java From che with Eclipse Public License 2.0 | 5 votes |
@Test public void shouldMergeMetasOfPodsData() throws Exception { // given ObjectMeta podMeta1 = new ObjectMetaBuilder() .withName("ignored-1") .withAnnotations(ImmutableMap.of("ann1", "v1")) .withLabels(ImmutableMap.of("label1", "v1")) .build(); podMeta1.setAdditionalProperty("add1", 1L); PodData podData1 = new PodData(new PodSpecBuilder().build(), podMeta1); ObjectMeta podMeta2 = new ObjectMetaBuilder() .withName("ignored-2") .withAnnotations(ImmutableMap.of("ann2", "v2")) .withLabels(ImmutableMap.of("label2", "v2")) .build(); podMeta2.setAdditionalProperty("add2", 2L); PodData podData2 = new PodData(new PodSpecBuilder().build(), podMeta2); // when Deployment merged = podMerger.merge(Arrays.asList(podData1, podData2)); // then PodTemplateSpec podTemplate = merged.getSpec().getTemplate(); ObjectMeta podMeta = podTemplate.getMetadata(); verifyContainsAllFrom(podMeta, podData1.getMetadata()); verifyContainsAllFrom(podMeta, podData2.getMetadata()); }