io.fabric8.kubernetes.api.model.Node Java Examples

The following examples show how to use io.fabric8.kubernetes.api.model.Node. 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: KubernetesFacade.java    From kubernetes-pipeline-plugin with Apache License 2.0 6 votes vote down vote up
private Node getNodeOfPod(String podName) {
    Node node;
    if (Utils.isNullOrEmpty(podName)) {
        LOGGER.warning("Failed to find the current pod name.");
        return null;
    }

    Pod pod = client.pods().withName(podName).get();
    if (pod == null) {
        LOGGER.warning("Failed to find pod with name:" + podName + " in namespace:" + client.getNamespace() + ".");
        node = null;
    } else {
        String nodeName = pod.getSpec().getNodeName();
        node = client.nodes().withName(nodeName).get();
    }
    if (node == null) {
        LOGGER.warning("Failed to find pod with name:" + podName + ".");
        return null;
    } else {
        return node;
    }
}
 
Example #2
Source File: KubernetesNode.java    From kubernetes-elastic-agents with Apache License 2.0 6 votes vote down vote up
public KubernetesNode(Node node) {
    name = node.getMetadata().getName();
    externalID = node.getSpec().getExternalID();
    nodeAddress = node.getStatus().getAddresses().get(0).getAddress();

    totalCPU = node.getStatus().getCapacity().get("cpu").getAmount();
    Size mem = Size.parse(node.getStatus().getCapacity().get("memory").getAmount());
    totalMemory = mem.readableSize();
    totalPods = node.getStatus().getCapacity().get("pods").getAmount();

    allocatableCPU = node.getStatus().getAllocatable().get("cpu").getAmount();
    String allocatableMemory = node.getStatus().getAllocatable().get("memory").getAmount();
    this.allocatableMemory = Size.parse(allocatableMemory).readableSize();
    allocatablePods = node.getStatus().getAllocatable().get("pods").getAmount();

    osImage = node.getStatus().getNodeInfo().getOsImage();
    operatingSystem = node.getStatus().getNodeInfo().getOperatingSystem();
    architecture = node.getStatus().getNodeInfo().getArchitecture();

    containerRuntimeVersion = node.getStatus().getNodeInfo().getContainerRuntimeVersion();
    kubeletVersion = node.getStatus().getNodeInfo().getKubeletVersion();
    kubeProxyVersion = node.getStatus().getNodeInfo().getKubeProxyVersion();
}
 
Example #3
Source File: NodeTest.java    From kubernetes-client with Apache License 2.0 6 votes vote down vote up
@Test
public void testGet() {
 server.expect().withPath("/api/v1/nodes/node1").andReturn(200, new PodBuilder().build()).once();
 server.expect().withPath("/api/v1/nodes/node2").andReturn(200, new PodBuilder().build()).once();

  KubernetesClient client = server.getClient();

  Node node = client.nodes().withName("node1").get();
  assertNotNull(node);

  node = client.nodes().withName("node2").get();
  assertNotNull(node);

  node = client.nodes().withName("node3").get();
  assertNull(node);
}
 
Example #4
Source File: Readiness.java    From kubernetes-client with Apache License 2.0 6 votes vote down vote up
public static boolean isReady(HasMetadata item) {
  if (item instanceof Deployment) {
    return isDeploymentReady((Deployment) item);
  } else if (item instanceof ReplicaSet) {
    return isReplicaSetReady((ReplicaSet) item);
  } else if (item instanceof Pod) {
    return isPodReady((Pod) item);
  } else if (item instanceof DeploymentConfig) {
    return isDeploymentConfigReady((DeploymentConfig) item);
  } else if (item instanceof ReplicationController) {
    return isReplicationControllerReady((ReplicationController) item);
  } else if (item instanceof Endpoints) {
    return isEndpointsReady((Endpoints) item);
  } else if (item instanceof Node) {
    return isNodeReady((Node) item);
  } else if (item instanceof StatefulSet) {
    return isStatefulSetReady((StatefulSet) item);
  } else {
    throw new IllegalArgumentException("Item needs to be one of [Node, Deployment, ReplicaSet, StatefulSet, Pod, DeploymentConfig, ReplicationController], but was: [" + (item != null ? item.getKind() : "Unknown (null)") + "]");
  }
}
 
Example #5
Source File: InitWriterTest.java    From strimzi-kafka-operator with Apache License 2.0 6 votes vote down vote up
/**
 * Mock a Kubernetes client for getting cluster node information
 *
 * @param nodeName cluster node name
 * @param labels metadata labels to be returned for the provided cluster node name
 * @return mocked Kubernetes client
 */
private KubernetesClient mockKubernetesClient(String nodeName, Map<String, String> labels, List<NodeAddress> addresses) {

    KubernetesClient client = mock(KubernetesClient.class);
    NonNamespaceOperation mockNodes = mock(NonNamespaceOperation.class);
    Resource mockResource = mock(Resource.class);
    Node mockNode = mock(Node.class);
    ObjectMeta mockNodeMetadata = mock(ObjectMeta.class);
    NodeStatus mockNodeStatus = mock(NodeStatus.class);

    when(client.nodes()).thenReturn(mockNodes);
    when(mockNodes.withName(nodeName)).thenReturn(mockResource);
    when(mockResource.get()).thenReturn(mockNode);
    when(mockNode.getMetadata()).thenReturn(mockNodeMetadata);
    when(mockNodeMetadata.getLabels()).thenReturn(labels);
    when(mockNode.getStatus()).thenReturn(mockNodeStatus);
    when(mockNodeStatus.getAddresses()).thenReturn(addresses);

    return client;
}
 
Example #6
Source File: Readiness.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
public static boolean isNodeReady(Node node) {
  Utils.checkNotNull(node, "Node can't be null.");
  NodeCondition condition = getNodeReadyCondition(node);
  if (condition == null || condition.getStatus() == null) {
    return false;
  }
  return condition.getStatus().equalsIgnoreCase(TRUE);
}
 
Example #7
Source File: KubernetesTestUtil.java    From kubernetes-plugin with Apache License 2.0 5 votes vote down vote up
public static boolean isWindows() {
    try (KubernetesClient client = new DefaultKubernetesClient(new ConfigBuilder(Config.autoConfigure(null)).build())) {
        for (Node n : client.nodes().list().getItems()) {
            String os = n.getMetadata().getLabels().get("kubernetes.io/os");
            LOGGER.info(() -> "Found node " + n.getMetadata().getName() + " running OS " + os);
            if ("windows".equals(os)) {
                return true;
            }
        }
    }
    return false;
}
 
Example #8
Source File: Readiness.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
public static boolean isReadinessApplicable(Class<? extends HasMetadata> itemClass) {
  return Deployment.class.isAssignableFrom(itemClass)
    || ReplicaSet.class.isAssignableFrom(itemClass)
    || Pod.class.isAssignableFrom(itemClass)
    || DeploymentConfig.class.isAssignableFrom(itemClass)
    || ReplicationController.class.isAssignableFrom(itemClass)
    || Endpoints.class.isAssignableFrom(itemClass)
    || Node.class.isAssignableFrom(itemClass)
    || StatefulSet.class.isAssignableFrom(itemClass)
    ;
}
 
Example #9
Source File: NodeOperatorTest.java    From strimzi-kafka-operator with Apache License 2.0 5 votes vote down vote up
@Override
protected Node resource() {
    return new NodeBuilder()
            .withNewMetadata()
                .withName(RESOURCE_NAME)
                .withLabels(singletonMap("foo", "bar"))
            .endMetadata()
            .build();
}
 
Example #10
Source File: Readiness.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the ready condition of the node.
 * 
 * @param node The target node.
 * @return The {@link NodeCondition} or null if not found.
 */
private static NodeCondition getNodeReadyCondition(Node node) {
  Utils.checkNotNull(node, "Node can't be null.");

  if (node.getStatus() == null || node.getStatus().getConditions() == null) {
    return null;
  }

  for (NodeCondition condition : node.getStatus().getConditions()) {
    if (NODE_READY.equals(condition.getType())) {
      return condition;
    }
  }
  return null;
}
 
Example #11
Source File: NodeOperatorIT.java    From strimzi-kafka-operator with Apache License 2.0 5 votes vote down vote up
@Override
protected Node getModified()  {
    return new NodeBuilder()
            .withNewMetadata()
                .withName(RESOURCE_NAME)
                .withLabels(singletonMap("bar", "foo"))
            .endMetadata()
            .withNewSpec()
                .withNewUnschedulable(true)
            .endSpec()
            .build();
}
 
Example #12
Source File: NodeOperatorIT.java    From strimzi-kafka-operator with Apache License 2.0 5 votes vote down vote up
@Override
protected Node getOriginal()  {
    return new NodeBuilder()
            .withNewMetadata()
                .withName(RESOURCE_NAME)
                .withLabels(singletonMap("foo", "bar"))
            .endMetadata()
            .withNewSpec()
                .withNewUnschedulable(true)
            .endSpec()
            .build();
}
 
Example #13
Source File: DefaultK8sApiConfigHandler.java    From onos with Apache License 2.0 4 votes vote down vote up
private K8sNode buildK8sNode(Node node) {
    String hostname = node.getMetadata().getName();
    IpAddress managementIp = null;
    IpAddress dataIp = null;

    for (NodeAddress nodeAddress:node.getStatus().getAddresses()) {
        // we need to consider assigning managementIp and dataIp differently
        // FIXME: ExternalIp is not considered currently
        if (nodeAddress.getType().equals(INTERNAL_IP)) {
            managementIp = IpAddress.valueOf(nodeAddress.getAddress());
            dataIp = IpAddress.valueOf(nodeAddress.getAddress());
        }
    }

    String roleStr = node.getMetadata().getLabels().keySet().stream()
            .filter(l -> l.contains(K8S_ROLE))
            .findFirst().orElse(null);

    K8sNode.Type nodeType = MINION;

    if (roleStr != null) {
        String role = roleStr.split("/")[1];
        if (MASTER.name().equalsIgnoreCase(role)) {
            nodeType = MASTER;
        } else {
            nodeType = MINION;
        }
    }

    Map<String, String> annots = node.getMetadata().getAnnotations();

    String extIntf = annots.get(EXT_INTF_NAME);
    String extGatewayIpStr = annots.get(EXT_GATEWAY_IP);
    String extBridgeIpStr = annots.get(EXT_BRIDGE_IP);

    return DefaultK8sNode.builder()
            .hostname(hostname)
            .managementIp(managementIp)
            .dataIp(dataIp)
            .extIntf(extIntf)
            .type(nodeType)
            .state(PRE_ON_BOARD)
            .extBridgeIp(IpAddress.valueOf(extBridgeIpStr))
            .extGatewayIp(IpAddress.valueOf(extGatewayIpStr))
            .podCidr(node.getSpec().getPodCIDR())
            .build();
}
 
Example #14
Source File: ManagedKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public NonNamespaceOperation<Node, NodeList, DoneableNode, Resource<Node, DoneableNode>> nodes() {
  return delegate.nodes();
}
 
Example #15
Source File: UtilsTest.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Test
void testGetPluralFromKind() {
  // Given
  Map<String, Class> pluralToKubernetesResourceMap = new HashMap<>();
  pluralToKubernetesResourceMap.put("bindings", Binding.class);
  pluralToKubernetesResourceMap.put("componentstatuses", ComponentStatus.class);
  pluralToKubernetesResourceMap.put("configmaps", ConfigMap.class);
  pluralToKubernetesResourceMap.put("endpoints", Endpoints.class);
  pluralToKubernetesResourceMap.put("events", Event.class);
  pluralToKubernetesResourceMap.put("limitranges", LimitRange.class);
  pluralToKubernetesResourceMap.put("namespaces", Namespace.class);
  pluralToKubernetesResourceMap.put("nodes", Node.class);
  pluralToKubernetesResourceMap.put("persistentvolumeclaims", PersistentVolumeClaim.class);
  pluralToKubernetesResourceMap.put("persistentvolumes", PersistentVolume.class);
  pluralToKubernetesResourceMap.put("pods", Pod.class);
  pluralToKubernetesResourceMap.put("podtemplates", PodTemplate.class);
  pluralToKubernetesResourceMap.put("replicationcontrollers", ReplicationController.class);
  pluralToKubernetesResourceMap.put("resourcequotas", ResourceQuota.class);
  pluralToKubernetesResourceMap.put("secrets", Secret.class);
  pluralToKubernetesResourceMap.put("serviceaccounts", ServiceAccount.class);
  pluralToKubernetesResourceMap.put("services", Service.class);
  pluralToKubernetesResourceMap.put("mutatingwebhookconfigurations", MutatingWebhookConfiguration.class);
  pluralToKubernetesResourceMap.put("validatingwebhookconfigurations", ValidatingWebhookConfiguration.class);
  pluralToKubernetesResourceMap.put("customresourcedefinitions", CustomResourceDefinition.class);
  pluralToKubernetesResourceMap.put("controllerrevisions", ControllerRevision.class);
  pluralToKubernetesResourceMap.put("daemonsets", DaemonSet.class);
  pluralToKubernetesResourceMap.put("deployments", Deployment.class);
  pluralToKubernetesResourceMap.put("replicasets", ReplicaSet.class);
  pluralToKubernetesResourceMap.put("statefulsets", StatefulSet.class);
  pluralToKubernetesResourceMap.put("tokenreviews", TokenReview.class);
  pluralToKubernetesResourceMap.put("localsubjectaccessreviews", LocalSubjectAccessReview.class);
  pluralToKubernetesResourceMap.put("selfsubjectaccessreviews", SelfSubjectAccessReview.class);
  pluralToKubernetesResourceMap.put("selfsubjectrulesreviews", SelfSubjectRulesReview.class);
  pluralToKubernetesResourceMap.put("subjectaccessreviews", SubjectAccessReview.class);
  pluralToKubernetesResourceMap.put("horizontalpodautoscalers", HorizontalPodAutoscaler.class);
  pluralToKubernetesResourceMap.put("cronjobs", CronJob.class);
  pluralToKubernetesResourceMap.put("jobs", Job.class);
  pluralToKubernetesResourceMap.put("certificatesigningrequests", CertificateSigningRequest.class);
  pluralToKubernetesResourceMap.put("leases", Lease.class);
  pluralToKubernetesResourceMap.put("endpointslices", EndpointSlice.class);
  pluralToKubernetesResourceMap.put("ingresses", Ingress.class);
  pluralToKubernetesResourceMap.put("networkpolicies", NetworkPolicy.class);
  pluralToKubernetesResourceMap.put("poddisruptionbudgets", PodDisruptionBudget.class);
  pluralToKubernetesResourceMap.put("podsecuritypolicies", PodSecurityPolicy.class);
  pluralToKubernetesResourceMap.put("clusterrolebindings", ClusterRoleBinding.class);
  pluralToKubernetesResourceMap.put("clusterroles", ClusterRole.class);
  pluralToKubernetesResourceMap.put("rolebindings", RoleBinding.class);
  pluralToKubernetesResourceMap.put("roles", Role.class);
  pluralToKubernetesResourceMap.put("priorityclasses", PriorityClass.class);
  pluralToKubernetesResourceMap.put("csidrivers", CSIDriver.class);
  pluralToKubernetesResourceMap.put("csinodes", CSINode.class);
  pluralToKubernetesResourceMap.put("storageclasses", StorageClass.class);
  pluralToKubernetesResourceMap.put("volumeattachments", VolumeAttachment.class);

  // When & Then
  pluralToKubernetesResourceMap.forEach((plural, kubernetesResource)
    -> assertEquals(plural, Utils.getPluralFromKind(kubernetesResource.getSimpleName())));
}
 
Example #16
Source File: UtilsTest.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Test
@DisplayName("Should test whether resource is namespaced or not")
void testWhetherNamespacedOrNot() {
  assertTrue(Utils.isResourceNamespaced(Binding.class));
  assertFalse(Utils.isResourceNamespaced(ComponentStatus.class));
  assertTrue(Utils.isResourceNamespaced(ConfigMap.class));
  assertTrue(Utils.isResourceNamespaced(Endpoints.class));
  assertTrue(Utils.isResourceNamespaced(Event.class));
  assertTrue(Utils.isResourceNamespaced(LimitRange.class));
  assertFalse(Utils.isResourceNamespaced(Namespace.class));
  assertFalse(Utils.isResourceNamespaced(Node.class));
  assertTrue(Utils.isResourceNamespaced(PersistentVolumeClaim.class));
  assertFalse(Utils.isResourceNamespaced(PersistentVolume.class));
  assertTrue(Utils.isResourceNamespaced(Pod.class));
  assertTrue(Utils.isResourceNamespaced(PodTemplate.class));
  assertTrue(Utils.isResourceNamespaced(ReplicationController.class));
  assertTrue(Utils.isResourceNamespaced(ResourceQuota.class));
  assertTrue(Utils.isResourceNamespaced(Secret.class));
  assertTrue(Utils.isResourceNamespaced(ServiceAccount.class));
  assertTrue(Utils.isResourceNamespaced(Service.class));
  assertFalse(Utils.isResourceNamespaced(MutatingWebhookConfiguration.class));
  assertFalse(Utils.isResourceNamespaced(ValidatingWebhookConfiguration.class));
  assertFalse(Utils.isResourceNamespaced(CustomResourceDefinition.class));
  assertTrue(Utils.isResourceNamespaced(ControllerRevision.class));
  assertTrue(Utils.isResourceNamespaced(DaemonSet.class));
  assertTrue(Utils.isResourceNamespaced(Deployment.class));
  assertTrue(Utils.isResourceNamespaced(ReplicaSet.class));
  assertTrue(Utils.isResourceNamespaced(StatefulSet.class));
  assertTrue(Utils.isResourceNamespaced(TokenReview.class));
  assertTrue(Utils.isResourceNamespaced(LocalSubjectAccessReview.class));
  assertTrue(Utils.isResourceNamespaced(SelfSubjectAccessReview.class));
  assertTrue(Utils.isResourceNamespaced(SelfSubjectRulesReview.class));
  assertTrue(Utils.isResourceNamespaced(SubjectAccessReview.class));
  assertTrue(Utils.isResourceNamespaced(HorizontalPodAutoscaler.class));
  assertTrue(Utils.isResourceNamespaced(CronJob.class));
  assertTrue(Utils.isResourceNamespaced(Job.class));
  assertTrue(Utils.isResourceNamespaced(CertificateSigningRequest.class));
  assertTrue(Utils.isResourceNamespaced(Lease.class));
  assertTrue(Utils.isResourceNamespaced(EndpointSlice.class));
  assertTrue(Utils.isResourceNamespaced(Ingress.class));
  assertTrue(Utils.isResourceNamespaced(NetworkPolicy.class));
  assertTrue(Utils.isResourceNamespaced(PodDisruptionBudget.class));
  assertFalse(Utils.isResourceNamespaced(PodSecurityPolicy.class));
  assertFalse(Utils.isResourceNamespaced(ClusterRoleBinding.class));
  assertFalse(Utils.isResourceNamespaced(ClusterRole.class));
  assertTrue(Utils.isResourceNamespaced(RoleBinding.class));
  assertTrue(Utils.isResourceNamespaced(Role.class));
  assertFalse(Utils.isResourceNamespaced(PriorityClass.class));
  assertTrue(Utils.isResourceNamespaced(CSIDriver.class));
  assertTrue(Utils.isResourceNamespaced(CSINode.class));
  assertFalse(Utils.isResourceNamespaced(StorageClass.class));
  assertTrue(Utils.isResourceNamespaced(VolumeAttachment.class));
}
 
Example #17
Source File: DefaultKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public NonNamespaceOperation<Node, NodeList, DoneableNode, Resource<Node, DoneableNode>> nodes() {
  return new NodeOperationsImpl(httpClient, getConfiguration());
}
 
Example #18
Source File: AutoAdaptableKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public NonNamespaceOperation<Node, NodeList, DoneableNode, Resource<Node, DoneableNode>> nodes() {
  return delegate.nodes();
}
 
Example #19
Source File: KubeClusterManager.java    From enmasse with Apache License 2.0 4 votes vote down vote up
public List<Node> getMasterNodes() {
    return kube.getClient().nodes().list().getItems().stream().filter(node ->
            node.getMetadata().getName().contains("master")).collect(Collectors.toList());
}
 
Example #20
Source File: KubeClusterManager.java    From enmasse with Apache License 2.0 4 votes vote down vote up
public List<Node> getWorkerNodes() {
    return kube.getClient().nodes().list().getItems().stream().filter(node ->
            node.getMetadata().getName().contains("worker")).collect(Collectors.toList());
}
 
Example #21
Source File: KubeClient.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
public List<Node> listNodes() {
    return client.nodes().list().getItems();
}
 
Example #22
Source File: NodeOperatorTest.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected AbstractNonNamespacedResourceOperator<KubernetesClient, Node, NodeList,
        DoneableNode, Resource<Node, DoneableNode>> createResourceOperations(
                Vertx vertx, KubernetesClient mockClient) {
    return new NodeOperator(vertx, mockClient, 100);
}
 
Example #23
Source File: NodeOperatorIT.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected void assertResources(VertxTestContext context, Node expected, Node actual)   {
    context.verify(() -> assertThat(actual.getMetadata().getName(), is(expected.getMetadata().getName())));
    context.verify(() -> assertThat(actual.getMetadata().getLabels(), is(expected.getMetadata().getLabels())));
    context.verify(() -> assertThat(actual.getSpec().getUnschedulable(), is(expected.getSpec().getUnschedulable())));
}
 
Example #24
Source File: NodeOperatorIT.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected AbstractNonNamespacedResourceOperator<KubernetesClient,
        Node, NodeList, DoneableNode,
        Resource<Node, DoneableNode>> operator() {
    return new NodeOperator(vertx, client, 10_000);
}
 
Example #25
Source File: NodeOperator.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected NonNamespaceOperation<Node, NodeList, DoneableNode, Resource<Node, DoneableNode>> operation() {
    return client.nodes();
}
 
Example #26
Source File: KafkaStatusTest.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
private List<Node> getClusterNodes()    {
    Node node0 = new NodeBuilder()
            .withNewMetadata()
                .withName("node-0")
            .endMetadata()
            .withNewStatus()
                .withAddresses(new NodeAddress("50.35.18.119", "ExternalIP"),
                        new NodeAddress("node-0.my-kube", "InternalDNS"),
                        new NodeAddress("10.0.0.1", "InternalIP"),
                        new NodeAddress("nocde-0", "Hostname"))
            .endStatus()
            .build();

    Node node1 = new NodeBuilder()
            .withNewMetadata()
                .withName("node-1")
            .endMetadata()
            .withNewStatus()
                .withAddresses(new NodeAddress("55.36.78.115", "ExternalIP"),
                        new NodeAddress("node-1.my-kube", "InternalDNS"),
                        new NodeAddress("10.0.0.25", "InternalIP"),
                        new NodeAddress("node-1", "Hostname"))
            .endStatus()
            .build();

    Node node2 = new NodeBuilder()
            .withNewMetadata()
                .withName("node-2")
            .endMetadata()
            .withNewStatus()
                .withAddresses(new NodeAddress("35.15.152.9", "ExternalIP"),
                        new NodeAddress("node-2.my-kube", "InternalDNS"),
                        new NodeAddress("10.0.0.16", "InternalIP"),
                        new NodeAddress("node-2", "Hostname"))
            .endStatus()
            .build();

    Node node3 = new NodeBuilder()
            .withNewMetadata()
                .withName("node-3")
            .endMetadata()
            .withNewStatus()
                .withAddresses(new NodeAddress("5.124.16.8", "ExternalIP"),
                        new NodeAddress("node-3.my-kube", "InternalDNS"),
                        new NodeAddress("10.0.0.13", "InternalIP"),
                        new NodeAddress("node-3", "Hostname"))
            .endStatus()
            .build();

    List<Node> nodes = new ArrayList<>();
    nodes.add(node0);
    nodes.add(node1);
    nodes.add(node2);
    nodes.add(node3);

    return nodes;
}
 
Example #27
Source File: KubernetesClient.java    From kubernetes-client with Apache License 2.0 2 votes vote down vote up
/**
 * API entrypoint for node related operations in Kubernetes. Node (core/v1)
 *
 * @return NonNamespaceOperation object for Node related operations
 */
NonNamespaceOperation<Node, NodeList, DoneableNode, Resource<Node, DoneableNode>> nodes();