use of io.fabric8.kubernetes.client.dsl.RollableScallableResource in project camel by apache.
the class KubernetesReplicationControllersProducer method doListReplicationControllersByLabels.
protected void doListReplicationControllersByLabels(Exchange exchange, String operation) throws Exception {
ReplicationControllerList rcList = null;
Map<String, String> labels = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_REPLICATION_CONTROLLERS_LABELS, Map.class);
String namespaceName = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class);
if (!ObjectHelper.isEmpty(namespaceName)) {
NonNamespaceOperation<ReplicationController, ReplicationControllerList, DoneableReplicationController, RollableScallableResource<ReplicationController, DoneableReplicationController>> replicationControllers;
replicationControllers = getEndpoint().getKubernetesClient().replicationControllers().inNamespace(namespaceName);
for (Map.Entry<String, String> entry : labels.entrySet()) {
replicationControllers.withLabel(entry.getKey(), entry.getValue());
}
rcList = replicationControllers.list();
} else {
MixedOperation<ReplicationController, ReplicationControllerList, DoneableReplicationController, RollableScallableResource<ReplicationController, DoneableReplicationController>> replicationControllers;
replicationControllers = getEndpoint().getKubernetesClient().replicationControllers();
for (Map.Entry<String, String> entry : labels.entrySet()) {
replicationControllers.withLabel(entry.getKey(), entry.getValue());
}
rcList = replicationControllers.list();
}
MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true);
exchange.getOut().setBody(rcList.getItems());
}
Aggregations