本文整理汇总了Java中io.fabric8.kubernetes.api.model.ObjectMeta.setNamespace方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectMeta.setNamespace方法的具体用法?Java ObjectMeta.setNamespace怎么用?Java ObjectMeta.setNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.fabric8.kubernetes.api.model.ObjectMeta
的用法示例。
在下文中一共展示了ObjectMeta.setNamespace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createService
import io.fabric8.kubernetes.api.model.ObjectMeta; //导入方法依赖的package包/类
protected Service createService(final String namespace,
final String serviceName,
Map<String, String> labels) {
labels = normalizeLabels(labels);
final Service service = new Service();
final ObjectMeta metadata = new ObjectMeta();
metadata.setNamespace(normalizeNamespace(namespace));
metadata.setName(normalizeServiceName(serviceName));
metadata.setLabels(labels);
service.setMetadata(metadata);
service.setSpec(this.createServiceSpec(labels));
return service;
}
示例2: createDeployment
import io.fabric8.kubernetes.api.model.ObjectMeta; //导入方法依赖的package包/类
protected Deployment createDeployment(String namespace,
final String deploymentName,
Map<String, String> labels,
final String serviceAccountName,
final String imageName,
final ImagePullPolicy imagePullPolicy,
final boolean hostNetwork,
final boolean tls,
final boolean verifyTls) {
namespace = normalizeNamespace(namespace);
labels = normalizeLabels(labels);
final Deployment deployment = new Deployment();
final ObjectMeta metadata = new ObjectMeta();
metadata.setNamespace(namespace);
metadata.setName(normalizeDeploymentName(deploymentName));
metadata.setLabels(labels);
deployment.setMetadata(metadata);
deployment.setSpec(this.createDeploymentSpec(labels, serviceAccountName, imageName, imagePullPolicy, namespace, hostNetwork, tls, verifyTls));
return deployment;
}
示例3: newPod
import io.fabric8.kubernetes.api.model.ObjectMeta; //导入方法依赖的package包/类
private Pod newPod(String uid, String namespace, String name, String node) {
Pod pod = new Pod();
ObjectMeta objMeta = new ObjectMeta();
objMeta.setName(name);
objMeta.setNamespace(namespace);
objMeta.setUid(uid);
PodSpec spec = new PodSpec();
spec.setNodeName(node);
pod.setMetadata(objMeta);
pod.setSpec(spec);
return pod;
}
示例4: createSecret
import io.fabric8.kubernetes.api.model.ObjectMeta; //导入方法依赖的package包/类
protected Secret createSecret(final String namespace,
final URI tlsKeyUri,
final URI tlsCertUri,
final URI tlsCaCertUri,
final Map<String, String> labels)
throws IOException {
final Secret secret = new Secret();
secret.setType("Opaque");
final Map<String, String> secretData = new HashMap<>();
try (final InputStream tlsKeyStream = read(tlsKeyUri)) {
if (tlsKeyStream != null) {
secretData.put("tls.key", Base64.getEncoder().encodeToString(toByteArray(tlsKeyStream)));
}
}
try (final InputStream tlsCertStream = read(tlsCertUri)) {
if (tlsCertStream != null) {
secretData.put("tls.crt", Base64.getEncoder().encodeToString(toByteArray(tlsCertStream)));
}
}
try (final InputStream tlsCaCertStream = read(tlsCaCertUri)) {
if (tlsCaCertStream != null) {
secretData.put("ca.crt", Base64.getEncoder().encodeToString(toByteArray(tlsCaCertStream)));
}
}
secret.setData(secretData);
final ObjectMeta metadata = new ObjectMeta();
metadata.setNamespace(normalizeNamespace(namespace));
metadata.setName(SECRET_NAME);
metadata.setLabels(normalizeLabels(labels));
secret.setMetadata(metadata);
return secret;
}
示例5: newDeployment
import io.fabric8.kubernetes.api.model.ObjectMeta; //导入方法依赖的package包/类
private Deployment newDeployment(String uid, String namespace, String name, int desiredReplicaCount, String containerImageName) {
Deployment deployment = new Deployment();
ObjectMeta objMeta = new ObjectMeta();
objMeta.setName(name);
objMeta.setNamespace(namespace);
objMeta.setUid(uid);
DeploymentSpec spec = new DeploymentSpec();
spec.setReplicas(desiredReplicaCount);
Container container = new Container();
container.setImage(containerImageName);
PodSpec podSpec = new PodSpec();
podSpec.setContainers(Arrays.asList(container));
PodTemplateSpec podTemplateSpec = new PodTemplateSpec();
podTemplateSpec.setSpec(podSpec);
spec.setTemplate(podTemplateSpec);
deployment.setMetadata(objMeta);
deployment.setSpec(spec);
DeploymentStatus deploymentStatus = new DeploymentStatus();
deploymentStatus.setAvailableReplicas(3);
deployment.setStatus(deploymentStatus);
return deployment;
}