本文整理了Java中io.fabric8.kubernetes.client.utils.Utils.checkNotNull()
方法的一些代码示例,展示了Utils.checkNotNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.checkNotNull()
方法的具体详情如下:
包路径:io.fabric8.kubernetes.client.utils.Utils
类名称:Utils
方法名:checkNotNull
暂无
代码示例来源:origin: fabric8io/kubernetes-client
public static boolean isPodReady(Pod pod) {
Utils.checkNotNull(pod, "Pod can't be null.");
PodCondition condition = getPodReadyCondition(pod);
//Can be true in testing, so handle it to make test writing easier.
if (condition == null || condition.getStatus() == null) {
return false;
}
return condition.getStatus().equalsIgnoreCase(TRUE);
}
代码示例来源:origin: fabric8io/kubernetes-client
public static boolean isNodeReady(Node node) {
Utils.checkNotNull(node, "Node can't be null.");
NodeCondition condition = getNodeReadyCondition(node);
if (condition == null || condition.getStatus() == null) {
return false;
}
return condition.getStatus().equalsIgnoreCase(TRUE);
}
代码示例来源:origin: fabric8io/kubernetes-client
public static boolean isEndpointsReady(Endpoints e) {
Utils.checkNotNull(e, "Endpoints can't be null.");
String name = e.getMetadata().getName();
Utils.checkNotNull(name, "Endpoints name can't be null.");
if (e.getSubsets() == null) {
return false;
}
for (EndpointSubset subset : e.getSubsets()) {
if(!subset.getAddresses().isEmpty() && !subset.getPorts().isEmpty()) {
return true;
}
}
return false;
}
代码示例来源:origin: fabric8io/kubernetes-client
public static boolean isReplicaSetReady(ReplicaSet r) {
Utils.checkNotNull(r, "ReplicationController can't be null.");
ReplicaSetSpec spec = r.getSpec();
ReplicaSetStatus 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();
}
代码示例来源:origin: fabric8io/kubernetes-client
public static boolean isStatefulSetReady(StatefulSet ss) {
Utils.checkNotNull(ss, "StatefulSet can't be null.");
StatefulSetSpec spec = ss.getSpec();
StatefulSetStatus status =ss.getStatus();
if (status == null || status.getReplicas() == 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.getReplicas();
}
代码示例来源:origin: fabric8io/kubernetes-client
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();
}
代码示例来源:origin: fabric8io/kubernetes-client
public static boolean isDeploymentReady(Deployment d) {
Utils.checkNotNull(d, "Deployment can't be null.");
DeploymentSpec spec = d.getSpec();
DeploymentStatus status = d.getStatus();
if (status == null || status.getReplicas() == null || status.getAvailableReplicas() == 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.getReplicas() &&
spec.getReplicas().intValue() <= status.getAvailableReplicas();
}
代码示例来源:origin: fabric8io/kubernetes-client
/**
* Returns the ready condition of the pod.
* @param pod The target pod.
* @return The {@link PodCondition} or null if not found.
*/
private static PodCondition getPodReadyCondition(Pod pod) {
Utils.checkNotNull(pod, "Pod can't be null.");
if (pod.getStatus() == null || pod.getStatus().getConditions() == null) {
return null;
}
for (PodCondition condition : pod.getStatus().getConditions()) {
if (POD_READY.equals(condition.getType())) {
return condition;
}
}
return null;
}
代码示例来源:origin: fabric8io/kubernetes-client
public static boolean isDeploymentConfigReady(DeploymentConfig d) {
Utils.checkNotNull(d, "Deployment can't be null.");
DeploymentConfigSpec spec = d.getSpec();
DeploymentConfigStatus status = d.getStatus();
if (status == null || status.getReplicas() == null || status.getAvailableReplicas() == 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.getReplicas() &&
spec.getReplicas().intValue() <= status.getAvailableReplicas();
}
代码示例来源:origin: fabric8io/kubernetes-client
/**
* Returns the ready condition of the node.
*
* @param node The target node.
* @return The {@link NodeCondition} or null if not found.
*/
private static NodeCondition getNodeReadyCondition(Node node) {
Utils.checkNotNull(node, "Node can't be null.");
if (node.getStatus() == null || node.getStatus().getConditions() == null) {
return null;
}
for (NodeCondition condition : node.getStatus().getConditions()) {
if (NODE_READY.equals(condition.getType())) {
return condition;
}
}
return null;
}
}
代码示例来源:origin: org.domeos/kubernetes-client
public static boolean isPodReady(Pod pod) {
Utils.checkNotNull(pod, "Pod can't be null.");
PodCondition condition = getPodReadyCondition(pod);
//Can be true in testing, so handle it to make test writing easier.
if (condition == null || condition.getStatus() == null) {
return false;
}
return condition.getStatus().equalsIgnoreCase(TRUE);
}
代码示例来源:origin: org.domeos/kubernetes-client
public static boolean isEndpointsReady(Endpoints e) {
Utils.checkNotNull(e, "Endpoints can't be null.");
String name = e.getMetadata().getName();
Utils.checkNotNull(name, "Endpoints name can't be null.");
if (e.getSubsets() == null) {
return false;
}
for (EndpointSubset subset : e.getSubsets()) {
if(!subset.getAddresses().isEmpty() && !subset.getPorts().isEmpty()) {
return true;
}
}
return true;
}
代码示例来源:origin: org.domeos/kubernetes-client
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();
}
代码示例来源:origin: org.domeos/kubernetes-client
public static boolean isReplicaSetReady(ReplicaSet r) {
Utils.checkNotNull(r, "ReplicationController can't be null.");
ReplicaSetSpec spec = r.getSpec();
ReplicaSetStatus 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();
}
代码示例来源:origin: org.domeos/kubernetes-client
public static boolean isDeploymentConfigReady(DeploymentConfig d) {
Utils.checkNotNull(d, "Deployment can't be null.");
DeploymentConfigSpec spec = d.getSpec();
DeploymentConfigStatus status = d.getStatus();
if (status == null || status.getReplicas() == null || status.getAvailableReplicas() == 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.getReplicas() &&
spec.getReplicas().intValue() <= status.getAvailableReplicas();
}
代码示例来源:origin: org.domeos/kubernetes-client
/**
* Returns the ready condition of the pod.
* @param pod The target pod.
* @return The {@link PodCondition} or null if not found.
*/
private static PodCondition getPodReadyCondition(Pod pod) {
Utils.checkNotNull(pod, "Pod can't be null.");
if (pod.getStatus() == null || pod.getStatus().getConditions() == null) {
return null;
}
for (PodCondition condition : pod.getStatus().getConditions()) {
if (POD_READY.equals(condition.getType())) {
return condition;
}
}
return null;
}
}
代码示例来源:origin: org.domeos/kubernetes-client
public static boolean isDeploymentReady(Deployment d) {
Utils.checkNotNull(d, "Deployment can't be null.");
DeploymentSpec spec = d.getSpec();
DeploymentStatus status = d.getStatus();
if (status == null || status.getReplicas() == null || status.getAvailableReplicas() == 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.getReplicas() &&
spec.getReplicas().intValue() <= status.getAvailableReplicas();
}
内容来源于网络,如有侵权,请联系作者删除!