本文整理汇总了Java中io.fabric8.kubernetes.api.model.Container.getImage方法的典型用法代码示例。如果您正苦于以下问题:Java Container.getImage方法的具体用法?Java Container.getImage怎么用?Java Container.getImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.fabric8.kubernetes.api.model.Container
的用法示例。
在下文中一共展示了Container.getImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: podsAsTable
import io.fabric8.kubernetes.api.model.Container; //导入方法依赖的package包/类
protected TablePrinter podsAsTable(PodList pods) {
TablePrinter table = new TablePrinter();
table.columns("id", "image(s)", "host", "labels", "status");
List<Pod> items = pods.getItems();
if (items == null) {
items = Collections.EMPTY_LIST;
}
Filter<Pod> filter = KubernetesHelper.createPodFilter(filterText.getValue());
for (Pod item : items) {
if (filter.matches(item)) {
String id = KubernetesHelper.getName(item);
PodStatus podStatus = item.getStatus();
String status = "";
String host = "";
if (podStatus != null) {
status = KubernetesHelper.getStatusText(podStatus);
host = podStatus.getHostIP();
}
Map<String, String> labelMap = item.getMetadata().getLabels();
String labels = KubernetesHelper.toLabelsString(labelMap);
PodSpec spec = item.getSpec();
if (spec != null) {
List<Container> containerList = spec.getContainers();
for (Container container : containerList) {
String image = container.getImage();
table.row(id, image, host, labels, status);
id = "";
host = "";
status = "";
labels = "";
}
}
}
}
return table;
}
示例2: createMissingContainers
import io.fabric8.kubernetes.api.model.Container; //导入方法依赖的package包/类
protected ImmutableList<Pod> createMissingContainers(ReplicationController replicationController, PodTemplateSpec podTemplateSpec,
ReplicationControllerSpec replicationControllerSpec, int createCount, List<Pod> pods) throws Exception {
// TODO this is a hack ;) needs replacing with the real host we're creating on
String host = ApiMasterService.getHostName();
List<Pod> list = Lists.newArrayList(pods);
for (int i = 0; i < createCount; i++) {
Pod pod = new Pod();
pod.setKind(NodeHelper.KIND_POD);
createNewId(replicationController, pod);
list.add(pod);
List<Container> containers = KubernetesHelper.getContainers(podTemplateSpec);
for (Container container : containers) {
String containerName = getName(pod) + "-" + container.getName();
ContainerStatus containerInfo = NodeHelper.getOrCreateContainerInfo(pod, containerName);
PodStatus currentState = pod.getStatus();
Objects.notNull(currentState, "currentState");
currentState.setHostIP(host);
String image = container.getImage();
if (Strings.isBlank(image)) {
LOG.warn("Missing image for " + containerName + " so cannot create it!");
continue;
}
NodeHelper.addOrUpdateDesiredContainer(pod, containerName, container);
}
PodTemplateSpec podTemplate = replicationControllerSpec.getTemplate();
if (podTemplate != null) {
getOrCreateMetadata(pod).setLabels(KubernetesHelper.getLabels(podTemplate.getMetadata()));
}
// TODO should we update the pod now we've updated it?
List<Container> desiredContainers = NodeHelper.getOrCreatePodDesiredContainers(pod);
model.remoteCreatePod(pod);
}
return ImmutableList.copyOf(list);
}