io.kubernetes.client.openapi.models.V1ObjectMeta Java Examples
The following examples show how to use
io.kubernetes.client.openapi.models.V1ObjectMeta.
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: CacheTest.java From java with Apache License 2.0 | 6 votes |
@Test public void testMultiIndexFuncCacheStore() { String testIndexFuncName = "test-idx-func"; Cache<V1Pod> podCache = new Cache<>(); podCache.addIndexFunc( testIndexFuncName, (V1Pod pod) -> { return Arrays.asList(pod.getSpec().getNodeName()); }); V1Pod testPod = new V1Pod() .metadata(new V1ObjectMeta().namespace("ns").name("n")) .spec(new V1PodSpec().nodeName("node1")); podCache.add(testPod); List<V1Pod> namespaceIndexedPods = podCache.byIndex(Caches.NAMESPACE_INDEX, "ns"); assertEquals(1, namespaceIndexedPods.size()); List<V1Pod> nodeNameIndexedPods = podCache.byIndex(testIndexFuncName, "node1"); assertEquals(1, nodeNameIndexedPods.size()); }
Example #2
Source File: ListerTest.java From java with Apache License 2.0 | 6 votes |
@Test public void testListerBasic() { Cache<V1Pod> podCache = new Cache<>(); Lister<V1Pod> namespacedPodLister = new Lister<>(podCache, "default"); List<V1Pod> emptyPodList = namespacedPodLister.list(); assertEquals(0, emptyPodList.size()); podCache.replace( Arrays.asList( new V1Pod().metadata(new V1ObjectMeta().name("foo1").namespace("default")), new V1Pod().metadata(new V1ObjectMeta().name("foo2").namespace("default")), new V1Pod().metadata(new V1ObjectMeta().name("foo3").namespace("default"))), "0"); List<V1Pod> namespacedPodList = namespacedPodLister.list(); assertEquals(3, namespacedPodList.size()); Lister<V1Pod> allNamespacedPodLister = new Lister<>(podCache); List<V1Pod> allPodList = allNamespacedPodLister.list(); assertEquals(3, allPodList.size()); namespacedPodList = allNamespacedPodLister.namespace("default").list(); assertEquals(3, namespacedPodList.size()); }
Example #3
Source File: DeltaFIFOTest.java From java with Apache License 2.0 | 6 votes |
@Test public void testDeltaFIFOResync() { V1Pod foo1 = new V1Pod().metadata(new V1ObjectMeta().name("foo1").namespace("default")); Cache cache = new Cache(); DeltaFIFO deltaFIFO = new DeltaFIFO(Caches::deletionHandlingMetaNamespaceKeyFunc, cache); // sync after add cache.add(foo1); deltaFIFO.resync(); Deque<MutablePair<DeltaFIFO.DeltaType, KubernetesObject>> deltas = deltaFIFO.getItems().get(Caches.deletionHandlingMetaNamespaceKeyFunc(foo1)); assertEquals(1, deltas.size()); assertEquals(foo1, deltas.peekLast().getRight()); assertEquals(DeltaFIFO.DeltaType.Sync, deltas.peekLast().getLeft()); }
Example #4
Source File: V1HorizontalPodAutoscaler.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #5
Source File: V1Node.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #6
Source File: DefaultTaskToPodConverter.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Override public V1Pod apply(Job<?> job, Task task) { String taskId = task.getId(); TitanProtos.ContainerInfo containerInfo = buildContainerInfo(job, task); Map<String, String> annotations = KubeUtil.createPodAnnotations(job, task, containerInfo.toByteArray(), containerInfo.getPassthroughAttributesMap(), configuration.isJobDescriptorAnnotationEnabled()); V1ObjectMeta metadata = new V1ObjectMeta() .name(taskId) .annotations(annotations) .labels(ImmutableMap.of( KubeConstants.POD_LABEL_JOB_ID, job.getId(), KubeConstants.POD_LABEL_TASK_ID, taskId )); V1Container container = new V1Container() .name(taskId) .image("imageIsInContainerInfo") .resources(buildV1ResourceRequirements(job.getJobDescriptor().getContainer().getContainerResources())); V1PodSpec spec = new V1PodSpec() .schedulerName(configuration.getKubeSchedulerName()) .containers(Collections.singletonList(container)) .terminationGracePeriodSeconds(POD_TERMINATION_GRACE_PERIOD_SECONDS) .restartPolicy(NEVER_RESTART_POLICY) .affinity(podAffinityFactory.buildV1Affinity(job, task)) .tolerations(taintTolerationFactory.buildV1Toleration(job, task)) .topologySpreadConstraints(buildTopologySpreadConstraints(job)); return new V1Pod().metadata(metadata).spec(spec); }
Example #7
Source File: CachesTest.java From java with Apache License 2.0 | 5 votes |
@Test public void testDefaultNamespaceNameKey() { String testName = "test-name"; String testNamespace = "test-namespace"; V1Pod pod = new V1Pod().metadata(new V1ObjectMeta().name(testName).namespace(testNamespace)); assertEquals(testNamespace + "/" + testName, Caches.metaNamespaceKeyFunc(pod)); }
Example #8
Source File: V1StorageClass.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #9
Source File: V1Pod.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #10
Source File: V1RoleBinding.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #11
Source File: V1PriorityClass.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #12
Source File: V1SubjectAccessReview.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #13
Source File: V1Scale.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #14
Source File: V1beta2ReplicaSet.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #15
Source File: V1beta1JobTemplateSpec.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #16
Source File: V1Namespace.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #17
Source File: V1PodTemplateSpec.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #18
Source File: V1VolumeAttachment.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #19
Source File: V1LocalSubjectAccessReview.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #20
Source File: V1alpha1PodPreset.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #21
Source File: V1beta1StorageClass.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #22
Source File: V1APIService.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #23
Source File: V1beta1Role.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #24
Source File: PortForwardTest.java From java with Apache License 2.0 | 5 votes |
@Test public void testUrl() throws IOException, ApiException, InterruptedException { PortForward forward = new PortForward(client); V1Pod pod = new V1Pod().metadata(new V1ObjectMeta().name(podName).namespace(namespace)); stubFor( get(urlPathEqualTo("/api/v1/namespaces/" + namespace + "/pods/" + podName + "/portforward")) .willReturn( aResponse() .withStatus(404) .withHeader("Content-Type", "application/json") .withBody("{}"))); int portNumber = 8080; List<Integer> ports = new ArrayList<>(); ports.add(portNumber); forward.forward(pod, ports); // TODO: Kill this sleep, the trouble is that the test tries to validate before the connection // event has happened Thread.sleep(2000); verify( getRequestedFor( urlPathEqualTo( "/api/v1/namespaces/" + namespace + "/pods/" + podName + "/portforward")) .withQueryParam("ports", equalTo(Integer.toString(portNumber)))); }
Example #25
Source File: ExtensionsV1beta1Scale.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #26
Source File: CacheTest.java From java with Apache License 2.0 | 5 votes |
@Parameterized.Parameters public static Collection data() { V1Pod normalPod = new V1Pod(); V1ObjectMeta normalPodMeta = new V1ObjectMeta(); normalPodMeta.setName("foo"); normalPodMeta.setNamespace("default"); normalPod.setMetadata(normalPodMeta); V1Pod missingNamespacePod = new V1Pod(); V1ObjectMeta missingNamespacePodMeta = new V1ObjectMeta(); missingNamespacePodMeta.setName("foo"); missingNamespacePodMeta.setNamespace(null); missingNamespacePod.setMetadata(missingNamespacePodMeta); V1Pod missingNamePod = new V1Pod(); V1ObjectMeta missingNamePodMeta = new V1ObjectMeta(); missingNamePodMeta.setName(null); missingNamePodMeta.setNamespace("default"); missingNamePod.setMetadata(missingNamePodMeta); return Arrays.asList( new Object[][] { {normalPod, "io.kubernetes.client.openapi.models.V1Pod"}, {missingNamespacePod, "io.kubernetes.client.openapi.models.V1Pod"}, {missingNamePod, "io.kubernetes.client.openapi.models.V1Pod"}, {null, "null"}, }); }
Example #27
Source File: V1PersistentVolume.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #28
Source File: V1beta1CSIDriver.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #29
Source File: V1ReplicationController.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }
Example #30
Source File: V1alpha1PriorityLevelConfiguration.java From java with Apache License 2.0 | 5 votes |
/** * Get metadata * @return metadata **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public V1ObjectMeta getMetadata() { return metadata; }