本文整理汇总了Java中io.fabric8.kubernetes.api.model.IntOrString类的典型用法代码示例。如果您正苦于以下问题:Java IntOrString类的具体用法?Java IntOrString怎么用?Java IntOrString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntOrString类属于io.fabric8.kubernetes.api.model包,在下文中一共展示了IntOrString类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRuntimeEndpoint
import io.fabric8.kubernetes.api.model.IntOrString; //导入依赖的package包/类
public OpenShiftRuntimeEndpoint getRuntimeEndpoint(String id) throws OpenShiftClientException {
try {
OpenShiftRuntimeId runtimeId = OpenShiftRuntimeId.fromString(id);
String prjName = runtimeId.project();
String svcName = runtimeId.service();
OpenShiftRuntimeEndpoint endpoint = new OpenShiftRuntimeEndpoint();
Route route = delegate.routes().inNamespace(prjName).withName(svcName).get();
if (route != null) {
RouteSpec routeSpec = route.getSpec();
endpoint.setProtocol(routeSpec.getTls() != null ? "https" : "http");
endpoint.setHost(routeSpec.getHost());
RoutePort routePort = routeSpec.getPort();
if (routePort != null) {
IntOrString targetPort = routePort.getTargetPort();
if (targetPort != null) {
endpoint.setPort(targetPort.getIntVal());
}
}
}
return endpoint;
} catch (Throwable t) {
throw new OpenShiftClientException(t.getMessage(), t);
}
}
示例2: createServiceSpec
import io.fabric8.kubernetes.api.model.IntOrString; //导入依赖的package包/类
protected ServiceSpec createServiceSpec(final Map<String, String> labels) {
final ServiceSpec serviceSpec = new ServiceSpec();
serviceSpec.setType("ClusterIP");
final ServicePort servicePort = new ServicePort();
servicePort.setName(DEFAULT_NAME);
servicePort.setPort(Integer.valueOf(44134));
servicePort.setTargetPort(new IntOrString(DEFAULT_NAME));
serviceSpec.setPorts(Arrays.asList(servicePort));
serviceSpec.setSelector(normalizeLabels(labels));
return serviceSpec;
}
示例3: getPort
import io.fabric8.kubernetes.api.model.IntOrString; //导入依赖的package包/类
private IntOrString getPort() {
IntOrStringBuilder builder = new IntOrStringBuilder();
if (StringUtils.isNumeric(port)) {
builder.withIntVal(Integer.valueOf(port));
} else {
builder.withStrVal(port);
}
return builder.build();
}
示例4: configureDatastore
import io.fabric8.kubernetes.api.model.IntOrString; //导入依赖的package包/类
static DeploymentConfigBuilder configureDatastore(final ApplicationBuilder appBuilder) {
final DeploymentConfigBuilder cassandra = appBuilder.deploymentConfig("middleware-manager-datastore", "middleware-manager-datastore", false);
cassandra
.onConfigurationChange()
.podTemplate()
.container()
.fromImage(ImageRegistry.get().midlewareManagerStorage())
.envVar("CASSANDRA_START_RPC", "true")
.port(9042, "cql-port")
.port(9160, "thift-port")
.port(7000, "tcp-port")
.port(7001, "ssl-port")
.port(7199, "jmx-port")
.addVolumeMount("cassandra-data", "/opt/apache-cassandra/data", false)
.pod()
.addEmptyDirVolume("cassandra-data").container()
.addReadinessProbe().createTcpProbe("7000");
appBuilder.service("middleware-manager-datastore")
.addContainerSelector("name", "middleware-manager-datastore")
.ports(new ServicePortBuilder().withName("cql-port").withPort(9042).withTargetPort(new IntOrString("cql-port")).build(),
new ServicePortBuilder().withName("thift-port").withPort(9160).withTargetPort(new IntOrString("thift-port")).build(),
new ServicePortBuilder().withName("tcp-port").withPort(7000).withTargetPort(new IntOrString("tcp-port")).build(),
new ServicePortBuilder().withName("ssl-port").withPort(7001).withTargetPort(new IntOrString("ssl-port")).build(),
new ServicePortBuilder().withName("jmx-port").withPort(7199).withTargetPort(new IntOrString("jmx-port")).build()
);
return cassandra;
}
示例5: createContainer
import io.fabric8.kubernetes.api.model.IntOrString; //导入依赖的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;
}
示例6: withTargetPort
import io.fabric8.kubernetes.api.model.IntOrString; //导入依赖的package包/类
private RouteBuilder withTargetPort(String targetPortName) {
this.targetPort = new IntOrString(targetPortName);
return this;
}
示例7: intOrString
import io.fabric8.kubernetes.api.model.IntOrString; //导入依赖的package包/类
private static IntOrString intOrString(int port) {
return new IntOrStringBuilder().withIntVal(port).withStrVal(String.valueOf(port)).build();
}