io.fabric8.kubernetes.api.model.Quantity#getAmount ( )源码实例Demo

下面列出了io.fabric8.kubernetes.api.model.Quantity#getAmount ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: strimzi-kafka-operator   文件: StorageUtils.java
/**
 * Parse a K8S-style representation of a disk size, such as {@code 100Gi},
 * into the equivalent number of bytes represented as a long.
 *
 * @param size The String representation of the volume size.
 * @return The equivalent number of bytes.
 */
public static long parseMemory(Quantity size) {
    String amount = size.getAmount();
    String format = size.getFormat();

    if (format != null) {
        return parseMemory(amount + format);
    } else  {
        return parseMemory(amount);
    }
}
 
源代码2 项目: che   文件: Containers.java
/**
 * Returns the RAM limit in bytes, if it is present in given container otherwise 0 will be
 * returned.
 */
public static long getRamLimit(Container container) {
  final ResourceRequirements resources = container.getResources();
  final Quantity quantity;
  if (resources != null
      && resources.getLimits() != null
      && (quantity = resources.getLimits().get("memory")) != null
      && quantity.getAmount() != null) {
    return Quantity.getAmountInBytes(quantity).longValue();
  }
  return 0;
}
 
源代码3 项目: che   文件: Containers.java
/**
 * Returns the RAM request in bytes, if it is present in given container otherwise 0 will be
 * returned.
 */
public static long getRamRequest(Container container) {
  final ResourceRequirements resources = container.getResources();
  final Quantity quantity;
  if (resources != null
      && resources.getRequests() != null
      && (quantity = resources.getRequests().get("memory")) != null
      && quantity.getAmount() != null) {
    return Quantity.getAmountInBytes(quantity).longValue();
  }
  return 0;
}
 
源代码4 项目: che   文件: Containers.java
/**
 * Returns the CPU limit in cores, if it is present in given container otherwise 0 will be
 * returned.
 */
public static float getCpuLimit(Container container) {
  final ResourceRequirements resources = container.getResources();
  final Quantity quantity;
  if (resources != null
      && resources.getLimits() != null
      && (quantity = resources.getLimits().get("cpu")) != null
      && quantity.getAmount() != null) {
    return KubernetesSize.toCores(quantity.getAmount());
  }
  return 0;
}
 
源代码5 项目: che   文件: Containers.java
/**
 * Returns the CPU request in bytes, if it is present in given container otherwise 0 will be
 * returned.
 */
public static float getCpuRequest(Container container) {
  final ResourceRequirements resources = container.getResources();
  final Quantity quantity;
  if (resources != null
      && resources.getRequests() != null
      && (quantity = resources.getRequests().get("cpu")) != null
      && quantity.getAmount() != null) {
    return KubernetesSize.toCores(quantity.getAmount());
  }
  return 0;
}
 
 同类方法