use of io.fabric8.kubernetes.api.model.ReplicationControllerList in project camel by apache.
the class KubernetesReplicationControllersProducer method doList.
protected void doList(Exchange exchange, String operation) throws Exception {
ReplicationControllerList rcList = null;
String namespaceName = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class);
if (!ObjectHelper.isEmpty(namespaceName)) {
rcList = getEndpoint().getKubernetesClient().replicationControllers().inNamespace(namespaceName).list();
} else {
rcList = getEndpoint().getKubernetesClient().replicationControllers().list();
}
MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true);
exchange.getOut().setBody(rcList.getItems());
}
use of io.fabric8.kubernetes.api.model.ReplicationControllerList in project fabric8 by fabric8io.
the class Example method listReplicationControllers.
protected static void listReplicationControllers(KubernetesClient kube) {
System.out.println("\n\nLooking up replicationControllers");
System.out.println("=========================================================================");
ReplicationControllerList replicationControllers = kube.replicationControllers().list();
List<ReplicationController> items = replicationControllers.getItems();
for (ReplicationController item : items) {
ReplicationControllerSpec replicationControllerSpec = item.getSpec();
if (replicationControllerSpec != null) {
System.out.println("ReplicationController " + KubernetesHelper.getName(item) + " labels: " + item.getMetadata().getLabels() + " replicas: " + replicationControllerSpec.getReplicas() + " replicatorSelector: " + replicationControllerSpec.getSelector() + " podTemplate: " + replicationControllerSpec.getTemplate());
} else {
System.out.println("ReplicationController " + KubernetesHelper.getName(item) + " labels: " + item.getMetadata().getLabels() + " no replicationControllerSpec");
}
}
System.out.println();
}
use of io.fabric8.kubernetes.api.model.ReplicationControllerList 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());
}
use of io.fabric8.kubernetes.api.model.ReplicationControllerList in project fabric8 by fabric8io.
the class KubernetesAssert method replicationControllers.
public ListAssert<ReplicationController> replicationControllers() {
ReplicationControllerList replicationControllerList = client.replicationControllers().inNamespace(namespace()).list();
assertThat(replicationControllerList).isNotNull();
List<ReplicationController> replicationControllers = replicationControllerList.getItems();
return (ListAssert<ReplicationController>) assertThat(replicationControllers);
}
Aggregations