本文整理汇总了Java中io.fabric8.kubernetes.api.model.Container.setVolumeMounts方法的典型用法代码示例。如果您正苦于以下问题:Java Container.setVolumeMounts方法的具体用法?Java Container.setVolumeMounts怎么用?Java Container.setVolumeMounts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.fabric8.kubernetes.api.model.Container
的用法示例。
在下文中一共展示了Container.setVolumeMounts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addOrUpdateDesiredContainer
import io.fabric8.kubernetes.api.model.Container; //导入方法依赖的package包/类
public static Container addOrUpdateDesiredContainer(Pod pod, String containerName, Container container) {
List<Container> containers = getOrCreatePodDesiredContainers(pod);
Container oldContainer = findContainer(containers, containerName);
if (oldContainer != null) {
// lets update it just in case something changed...
containers.remove(oldContainer);
}
Container newContainer = new Container();
// TODO we should use bean utils or something to copy properties in case we miss one!
newContainer.setCommand(container.getCommand());
newContainer.setEnv(container.getEnv());
newContainer.setImage(container.getImage());
newContainer.setPorts(container.getPorts());
newContainer.setVolumeMounts(container.getVolumeMounts());
newContainer.setWorkingDir(container.getWorkingDir());
newContainer.getAdditionalProperties().putAll(container.getAdditionalProperties());
newContainer.setName(containerName);
LOG.info("Added new container: {}", containerName);
containers.add(newContainer);
return newContainer;
}
示例2: createContainer
import io.fabric8.kubernetes.api.model.Container; //导入方法依赖的package包/类
protected Container createContainer(final String imageName,
final ImagePullPolicy imagePullPolicy,
final String namespace,
final boolean tls,
final boolean verifyTls) {
final Container container = new Container();
container.setName(DEFAULT_NAME);
container.setImage(normalizeImageName(imageName));
container.setImagePullPolicy(normalizeImagePullPolicy(imagePullPolicy));
final ContainerPort containerPort = new ContainerPort();
containerPort.setContainerPort(Integer.valueOf(44134));
containerPort.setName(DEFAULT_NAME);
container.setPorts(Arrays.asList(containerPort));
final List<EnvVar> env = new ArrayList<>();
final EnvVar tillerNamespace = new EnvVar();
tillerNamespace.setName("TILLER_NAMESPACE");
tillerNamespace.setValue(normalizeNamespace(namespace));
env.add(tillerNamespace);
if (tls) {
final EnvVar tlsVerify = new EnvVar();
tlsVerify.setName("TILLER_TLS_VERIFY");
tlsVerify.setValue(verifyTls ? "1" : "");
env.add(tlsVerify);
final EnvVar tlsEnable = new EnvVar();
tlsEnable.setName("TILLER_TLS_ENABLE");
tlsEnable.setValue("1");
env.add(tlsEnable);
final EnvVar tlsCerts = new EnvVar();
tlsCerts.setName("TILLER_TLS_CERTS");
tlsCerts.setValue(TILLER_TLS_CERTS_PATH);
env.add(tlsCerts);
}
container.setEnv(env);
final IntOrString port44135 = new IntOrString(Integer.valueOf(44135));
final HTTPGetAction livenessHttpGetAction = new HTTPGetAction();
livenessHttpGetAction.setPath("/liveness");
livenessHttpGetAction.setPort(port44135);
final Probe livenessProbe = new Probe();
livenessProbe.setHttpGet(livenessHttpGetAction);
livenessProbe.setInitialDelaySeconds(ONE);
livenessProbe.setTimeoutSeconds(ONE);
container.setLivenessProbe(livenessProbe);
final HTTPGetAction readinessHttpGetAction = new HTTPGetAction();
readinessHttpGetAction.setPath("/readiness");
readinessHttpGetAction.setPort(port44135);
final Probe readinessProbe = new Probe();
readinessProbe.setHttpGet(readinessHttpGetAction);
readinessProbe.setInitialDelaySeconds(ONE);
readinessProbe.setTimeoutSeconds(ONE);
container.setReadinessProbe(readinessProbe);
if (tls) {
final VolumeMount volumeMount = new VolumeMount();
volumeMount.setName(DEFAULT_NAME + "-certs");
volumeMount.setReadOnly(true);
volumeMount.setMountPath(TILLER_TLS_CERTS_PATH);
container.setVolumeMounts(Arrays.asList(volumeMount));
}
return container;
}