Java Code Examples for io.kubernetes.client.openapi.models.V1Pod#setMetadata()

The following examples show how to use io.kubernetes.client.openapi.models.V1Pod#setMetadata() . 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 5 votes vote down vote up
@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 2
Source File: KubernetesCoordinator.java    From skywalking with Apache License 2.0 5 votes vote down vote up
private List<V1Pod> selfPod() {

        V1Pod v1Pod = new V1Pod();
        v1Pod.setMetadata(new V1ObjectMeta());
        v1Pod.setStatus(new V1PodStatus());
        v1Pod.getMetadata().setUid(uid);
        v1Pod.getStatus().setPodIP("127.0.0.1");
        return Collections.singletonList(v1Pod);

    }
 
Example 3
Source File: KubernetesCoordinatorTest.java    From skywalking with Apache License 2.0 5 votes vote down vote up
private List<V1Pod> mockPodList() {
    List<V1Pod> pods = new ArrayList<>();
    for (int i = 0; i < 5; i++) {
        V1Pod v1Pod = new V1Pod();
        v1Pod.setMetadata(new V1ObjectMeta());
        v1Pod.setStatus(new V1PodStatus());
        v1Pod.getMetadata().setUid(String.valueOf(SELF_UID + i));
        v1Pod.getStatus().setPodIP(LOCAL_HOST);
        pods.add(v1Pod);
    }
    return pods;
}