use of io.fabric8.openshift.api.model.DoneableDeploymentConfig in project kie-wb-common by kiegroup.
the class OpenShiftClient method setReplicas.
private void setReplicas(String id, int replicas) throws InterruptedException {
OpenShiftRuntimeId runtimeId = OpenShiftRuntimeId.fromString(id);
String prjName = runtimeId.project();
String svcName = runtimeId.service();
Service service = delegate.services().inNamespace(prjName).withName(svcName).get();
DeployableScalableResource<DeploymentConfig, DoneableDeploymentConfig> dcr = getDeploymentConfigResource(service);
if (dcr != null) {
DeploymentConfig dc = dcr.get();
dc.getSpec().setReplicas(replicas);
dcr.replace(dc);
dcr.waitUntilReady(buildTimeout, TimeUnit.MILLISECONDS);
}
}
use of io.fabric8.openshift.api.model.DoneableDeploymentConfig in project kie-wb-common by kiegroup.
the class OpenShiftClient method getDeploymentConfigResource.
private DeployableScalableResource<DeploymentConfig, DoneableDeploymentConfig> getDeploymentConfigResource(Service service) {
if (service != null) {
String prjName = service.getMetadata().getNamespace();
Map<String, String> selector = service.getSpec().getSelector();
String dcName = selector.get("deploymentconfig");
if (dcName == null) {
dcName = selector.get("deploymentConfig");
}
if (dcName != null) {
return delegate.deploymentConfigs().inNamespace(prjName).withName(dcName);
}
}
return null;
}
Aggregations