diff --git a/src/com/platform/kubernetes/BasedPathEntity.java b/src/com/platform/kubernetes/BasedPathEntity.java new file mode 100644 index 00000000..07ce83d6 --- /dev/null +++ b/src/com/platform/kubernetes/BasedPathEntity.java @@ -0,0 +1,5 @@ +package com.platform.kubernetes; + +public class BasedPathEntity { + +} diff --git a/src/com/platform/kubernetes/SimpleKubeClient.java b/src/com/platform/kubernetes/SimpleKubeClient.java index 28c0da14..815205c9 100644 --- a/src/com/platform/kubernetes/SimpleKubeClient.java +++ b/src/com/platform/kubernetes/SimpleKubeClient.java @@ -4,6 +4,8 @@ import io.fabric8.kubernetes.api.model.Container; import io.fabric8.kubernetes.api.model.ContainerPort; import io.fabric8.kubernetes.api.model.Pod; import io.fabric8.kubernetes.api.model.ReplicationController; +import io.fabric8.kubernetes.api.model.Volume; +import io.fabric8.kubernetes.api.model.VolumeMount; import io.fabric8.kubernetes.client.Client; import io.fabric8.kubernetes.client.Config; import io.fabric8.kubernetes.client.ConfigBuilder; @@ -156,4 +158,27 @@ public class SimpleKubeClient { client.close(); } + /** + * + * @param rcId --> 资源Id + * @param ns --> 资源名字空间 + * @return + */ + public ReplicationController createReplicas(String rcId, String ns) { + if (checkClientNull()) + client = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL); + ReplicationController rc = client.replicationControllers() + .inNamespace(ns).createNew().editMetadata().withName(rcId) + .endMetadata().done(); + return rc; + } + + public ReplicationController createReplicas(String rcId, String ns, Map selector,Volume volume, VolumeMount volumeMounts){ + if (checkClientNull()) + client = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL); + //Container container = new Container("", "", "", "", "", null, null, "oracle", ports, null, null, null, false, false, null, false, volumeMounts, null); + //container.setName("oracle"); + //ReplicationController rController = client.replicationControllers().inNamespace(ns).createNew().editMetadata().withName(rcId).withLabels(selector).endMetadata().editSpec().withReplicas(1).withSelector(selector).editTemplate().editMetadata().withLabels(selector).endMetadata().editSpec().addNewContainer().a. + return null; + } }