Search in sources :

Example 1 with DoneableNode

use of io.fabric8.kubernetes.api.model.DoneableNode in project camel by apache.

the class KubernetesNodesProducer method doListNodesByLabels.

protected void doListNodesByLabels(Exchange exchange, String operation) throws Exception {
    NodeList nodeList = null;
    Map<String, String> labels = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_NODES_LABELS, Map.class);
    NonNamespaceOperation<Node, NodeList, DoneableNode, Resource<Node, DoneableNode>> nodes = getEndpoint().getKubernetesClient().nodes();
    for (Map.Entry<String, String> entry : labels.entrySet()) {
        nodes.withLabel(entry.getKey(), entry.getValue());
    }
    nodeList = nodes.list();
    MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true);
    exchange.getOut().setBody(nodeList.getItems());
}
Also used : DoneableNode(io.fabric8.kubernetes.api.model.DoneableNode) NodeList(io.fabric8.kubernetes.api.model.NodeList) DoneableNode(io.fabric8.kubernetes.api.model.DoneableNode) Node(io.fabric8.kubernetes.api.model.Node) Resource(io.fabric8.kubernetes.client.dsl.Resource) Map(java.util.Map)

Aggregations

DoneableNode (io.fabric8.kubernetes.api.model.DoneableNode)1 Node (io.fabric8.kubernetes.api.model.Node)1 NodeList (io.fabric8.kubernetes.api.model.NodeList)1 Resource (io.fabric8.kubernetes.client.dsl.Resource)1 Map (java.util.Map)1