public class KubernetesClient extends Object implements Kubernetes, KubernetesExtensions
KubernetesFactory
and the differences between
the core Kubernetes
API and the KubernetesExtensions
Constructor and Description |
---|
KubernetesClient() |
KubernetesClient(KubernetesFactory factory) |
KubernetesClient(String url) |
public KubernetesClient()
public KubernetesClient(String url)
public KubernetesClient(KubernetesFactory factory)
public Kubernetes getKubernetes()
public Kubernetes getKubernetes(boolean writeable)
public KubernetesExtensions getKubernetesExtensions()
public KubernetesFactory getFactory(boolean writeable)
public void setFactory(KubernetesFactory factory)
public void setWriteableFactory(KubernetesFactory factory)
public String getAddress()
public String getWriteableAddress()
@GET @Path(value="pods") public PodList getPods()
Kubernetes
getPods
in interface Kubernetes
@DELETE @Path(value="pods/{podId}") public String deletePod(@NotNull String podId) throws Exception
Kubernetes
deletePod
in interface Kubernetes
Exception
@GET @Path(value="replicationControllers/{controllerId}") @Produces(value="application/json") public ReplicationController getReplicationController(@NotNull String controllerId)
Kubernetes
getReplicationController
in interface Kubernetes
@DELETE @Path(value="replicationControllers/{controllerId}") @Produces(value="application/json") public String deleteReplicationController(@NotNull String controllerId) throws Exception
Kubernetes
deleteReplicationController
in interface Kubernetes
Exception
@Path(value="replicationControllers") @GET @Produces(value="application/json") public ReplicationControllerList getReplicationControllers()
Kubernetes
getReplicationControllers
in interface Kubernetes
@PUT @Path(value="replicationControllers/{controllerId}") @Consumes(value="application/json") public String updateReplicationController(@NotNull String controllerId, ReplicationController entity) throws Exception
Kubernetes
updateReplicationController
in interface Kubernetes
entity
- e.g. {
"id": "nginxController",
"apiVersion": "v1beta1",
"kind": "ReplicationController",
"desiredState": {
"replicas": 2,
"replicaSelector": {"name": "nginx"},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "nginxController",
"containers": [{
"name": "nginx",
"image": "dockerfile/nginx",
"ports": [{"containerPort": 80, "hostPort": 8080}]
}]
}
},
"labels": {"name": "nginx"}
}},
"labels": {"name": "nginx"}
}Exception
@PUT @Path(value="services/{serviceId}") @Consumes(value="application/json") public String updateService(@NotNull String serviceId, Service entity) throws Exception
Kubernetes
updateService
in interface Kubernetes
entity
- e.g. {
"kind": "Service",
"apiVersion": "v1beta1",
"id": "example",
"port": 8000,
"labels": {
"name": "nginx"
},
"selector": {
"name": "nginx"
}
}Exception
@GET @Path(value="services/{serviceId}") @Produces(value="application/json") public Service getService(@NotNull String serviceId)
Kubernetes
getService
in interface Kubernetes
@DELETE @Path(value="services/{serviceId}") @Produces(value="application/json") public String deleteService(@NotNull String serviceId) throws Exception
Kubernetes
deleteService
in interface Kubernetes
Exception
@Path(value="services") @POST @Consumes(value="application/json") public String createService(Service entity) throws Exception
Kubernetes
createService
in interface Kubernetes
entity
- e.g. {
"kind": "Service",
"apiVersion": "v1beta1",
"id": "example",
"port": 8000,
"labels": {
"name": "nginx"
},
"selector": {
"name": "nginx"
}
}Exception
@GET @Path(value="pods/{podId}") public Pod getPod(@NotNull String podId)
Kubernetes
getPod
in interface Kubernetes
@PUT @Path(value="pods/{podId}") @Consumes(value="application/json") public String updatePod(@NotNull String podId, Pod entity) throws Exception
Kubernetes
updatePod
in interface Kubernetes
entity
- e.g. {
"kind": "Pod",
"apiVersion": "v1beta1",
"id": "php",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "php",
"containers": [{
"name": "nginx",
"image": "dockerfile/nginx",
"ports": [{
"containerPort": 80,
"hostPort": 8080
}],
"livenessProbe": {
"enabled": true,
"type": "http",
"initialDelaySeconds": 30,
"httpGet": {
"path": "/index.html",
"port": "8080"
}
}
}]
}
},
"labels": {
"name": "foo"
}
}Exception
@Path(value="services") @GET @Produces(value="application/json") public ServiceList getServices()
Kubernetes
getServices
in interface Kubernetes
@POST @Path(value="pods") @Consumes(value="application/json") public String createPod(Pod entity) throws Exception
Kubernetes
createPod
in interface Kubernetes
entity
- e.g. {
"kind": "Pod",
"apiVersion": "v1beta1",
"id": "php",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "php",
"containers": [{
"name": "nginx",
"image": "dockerfile/nginx",
"ports": [{
"containerPort": 80,
"hostPort": 8080
}],
"livenessProbe": {
"enabled": true,
"type": "http",
"initialDelaySeconds": 30,
"httpGet": {
"path": "/index.html",
"port": "8080"
}
}
}]
}
},
"labels": {
"name": "foo"
}
}Exception
@Path(value="replicationControllers") @POST @Consumes(value="application/json") public String createReplicationController(ReplicationController entity) throws Exception
Kubernetes
createReplicationController
in interface Kubernetes
entity
- e.g. {
"id": "nginxController",
"apiVersion": "v1beta1",
"kind": "ReplicationController",
"desiredState": {
"replicas": 2,
"replicaSelector": {"name": "nginx"},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "nginxController",
"containers": [{
"name": "nginx",
"image": "dockerfile/nginx",
"ports": [{"containerPort": 80, "hostPort": 8080}]
}]
}
},
"labels": {"name": "nginx"}
}},
"labels": {"name": "nginx"}
}Exception
@GET @Path(value="endpoints") public EndpointsList getEndpoints()
Kubernetes
getEndpoints
in interface Kubernetes
@GET @Path(value="endpoints/{serviceId}") public Endpoints endpointsForService(@NotNull String serviceId, String namespace)
Kubernetes
endpointsForService
in interface Kubernetes
@GET @Path(value="minions") public MinionList getMinions()
Kubernetes
getMinions
in interface Kubernetes
@GET @Path(value="minions/{minionId}") public Minion minion(@NotNull String minionId)
Kubernetes
minion
in interface Kubernetes
@POST @Path(value="configs") @Consumes(value="application/json") public String createConfig(Object entity) throws Exception
createConfig
in interface KubernetesExtensions
Exception
@POST @Path(value="template") @Consumes(value="application/json") public String createTemplate(Object entity) throws Exception
createTemplate
in interface KubernetesExtensions
Exception
@POST @Path(value="templateConfigs") @Consumes(value="application/json") public String createTemplateConfig(Object entity) throws Exception
createTemplateConfig
in interface KubernetesExtensions
Exception
public ReplicationController getReplicationControllerForPod(String podId)
public ReplicationController getReplicationControllerForPod(Pod pod)
public List<Pod> getPodsForReplicationController(ReplicationController service)
public List<Pod> getPodsForReplicationController(String replicationControllerId)
protected Collection<Pod> getPodList()
Copyright © 2011–2015 Red Hat. All rights reserved.