use of io.kubernetes.client.models.V1beta1StatefulSet in project java by kubernetes-client.
the class AppsV1beta1Api method replaceNamespacedStatefulSetWithHttpInfo.
/**
* replace the specified StatefulSet
* @param name name of the StatefulSet (required)
* @param namespace object name and auth scope, such as for teams and projects (required)
* @param body (required)
* @param pretty If 'true', then the output is pretty printed. (optional)
* @return ApiResponse<V1beta1StatefulSet>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<V1beta1StatefulSet> replaceNamespacedStatefulSetWithHttpInfo(String name, String namespace, V1beta1StatefulSet body, String pretty) throws ApiException {
com.squareup.okhttp.Call call = replaceNamespacedStatefulSetValidateBeforeCall(name, namespace, body, pretty, null, null);
Type localVarReturnType = new TypeToken<V1beta1StatefulSet>() {
}.getType();
return apiClient.execute(call, localVarReturnType);
}
use of io.kubernetes.client.models.V1beta1StatefulSet in project java by kubernetes-client.
the class AppsV1beta1Api method patchNamespacedStatefulSetStatusWithHttpInfo.
/**
* partially update status of the specified StatefulSet
* @param name name of the StatefulSet (required)
* @param namespace object name and auth scope, such as for teams and projects (required)
* @param body (required)
* @param pretty If 'true', then the output is pretty printed. (optional)
* @return ApiResponse<V1beta1StatefulSet>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<V1beta1StatefulSet> patchNamespacedStatefulSetStatusWithHttpInfo(String name, String namespace, Object body, String pretty) throws ApiException {
com.squareup.okhttp.Call call = patchNamespacedStatefulSetStatusValidateBeforeCall(name, namespace, body, pretty, null, null);
Type localVarReturnType = new TypeToken<V1beta1StatefulSet>() {
}.getType();
return apiClient.execute(call, localVarReturnType);
}
use of io.kubernetes.client.models.V1beta1StatefulSet in project java by kubernetes-client.
the class AppsV1beta1Api method createNamespacedStatefulSetWithHttpInfo.
/**
* create a StatefulSet
* @param namespace object name and auth scope, such as for teams and projects (required)
* @param body (required)
* @param pretty If 'true', then the output is pretty printed. (optional)
* @return ApiResponse<V1beta1StatefulSet>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<V1beta1StatefulSet> createNamespacedStatefulSetWithHttpInfo(String namespace, V1beta1StatefulSet body, String pretty) throws ApiException {
com.squareup.okhttp.Call call = createNamespacedStatefulSetValidateBeforeCall(namespace, body, pretty, null, null);
Type localVarReturnType = new TypeToken<V1beta1StatefulSet>() {
}.getType();
return apiClient.execute(call, localVarReturnType);
}
use of io.kubernetes.client.models.V1beta1StatefulSet in project incubator-heron by apache.
the class AppsV1beta1Controller method submit.
@Override
boolean submit(PackingPlan packingPlan) {
final String topologyName = getTopologyName();
if (!topologyName.equals(topologyName.toLowerCase())) {
throw new TopologySubmissionException("K8S scheduler does not allow upper case topologies.");
}
final Resource containerResource = getContainerResource(packingPlan);
// find the max number of instances in a container so we can open
// enough ports if remote debugging is enabled.
int numberOfInstances = 0;
for (PackingPlan.ContainerPlan containerPlan : packingPlan.getContainers()) {
numberOfInstances = Math.max(numberOfInstances, containerPlan.getInstances().size());
}
final V1beta1StatefulSet statefulSet = createStatefulSet(containerResource, numberOfInstances);
try {
final Response response = client.createNamespacedStatefulSetCall(getNamespace(), statefulSet, null, null, null).execute();
if (!response.isSuccessful()) {
LOG.log(Level.SEVERE, "Error creating topology message: " + response.message());
KubernetesUtils.logResponseBodyIfPresent(LOG, response);
// construct a message based on the k8s api server response
throw new TopologySubmissionException(KubernetesUtils.errorMessageFromResponse(response));
}
} catch (IOException | ApiException e) {
KubernetesUtils.logExceptionWithDetails(LOG, "Error creating topology", e);
throw new TopologySubmissionException(e.getMessage());
}
return true;
}
use of io.kubernetes.client.models.V1beta1StatefulSet in project incubator-heron by apache.
the class AppsV1beta1Controller method addContainers.
@Override
public Set<PackingPlan.ContainerPlan> addContainers(Set<PackingPlan.ContainerPlan> containersToAdd) {
final V1beta1StatefulSet statefulSet;
try {
statefulSet = getStatefulSet();
} catch (ApiException ae) {
final String message = ae.getMessage() + "\ndetails:" + ae.getResponseBody();
throw new TopologyRuntimeManagementException(message, ae);
}
final int currentContainerCount = statefulSet.getSpec().getReplicas();
final int newContainerCount = currentContainerCount + containersToAdd.size();
final V1beta1StatefulSetSpec newSpec = new V1beta1StatefulSetSpec();
newSpec.setReplicas(newContainerCount);
try {
doPatch(newSpec);
} catch (ApiException ae) {
throw new TopologyRuntimeManagementException(ae.getMessage() + "\ndetails\n" + ae.getResponseBody());
}
return containersToAdd;
}
Aggregations