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

The following examples show how to use io.fabric8.kubernetes.api.model.ReplicationControllerStatus. 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: Readiness.java    From kubernetes-client with Apache License 2.0 6 votes vote down vote up
public static boolean isReplicationControllerReady(ReplicationController r) {
  Utils.checkNotNull(r, "ReplicationController can't be null.");
  ReplicationControllerSpec spec = r.getSpec();
  ReplicationControllerStatus status = r.getStatus();

  if (status == null || status.getReadyReplicas() == null) {
    return false;
  }

  //Can be true in testing, so handle it to make test writing easier.
  if (spec == null || spec.getReplicas() == null) {
    return false;
  }

  return spec.getReplicas().intValue() == status.getReadyReplicas();
}
 
Example #2
Source File: ReplicationControllersList.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
private void printReplicationControllers(ReplicationControllerList replicationControllers, PrintStream out) {
    TablePrinter table = new TablePrinter();
    table.columns("id", "labels", "replicas", "replica selector");
    List<ReplicationController> items = replicationControllers.getItems();
    if (items == null) {
        items = Collections.EMPTY_LIST;
    }
    Filter<ReplicationController> filter = KubernetesHelper.createReplicationControllerFilter(filterText.getValue());
    for (ReplicationController item : items) {
        if (filter.matches(item)) {
            String id = KubernetesHelper.getName(item);
            String labels = KubernetesHelper.toLabelsString(item.getMetadata().getLabels());
            Integer replicas = null;
            ReplicationControllerSpec desiredState = item.getSpec();
            ReplicationControllerStatus currentState = item.getStatus();
            String selector = null;
            if (desiredState != null) {
                selector = KubernetesHelper.toLabelsString(desiredState.getSelector());
            }
            if (currentState != null) {
                replicas = currentState.getReplicas();
            }
            table.row(id, labels, toPositiveNonZeroText(replicas), selector);
        }
    }
    table.print();
}
 
Example #3
Source File: ReplicationControllerMixIn.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
@JsonIgnore
public abstract ReplicationControllerStatus getStatus();