Search in sources :

Example 1 with DoneableDeploymentConfig

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);
    }
}
Also used : DoneableDeploymentConfig(io.fabric8.openshift.api.model.DoneableDeploymentConfig) Service(io.fabric8.kubernetes.api.model.Service) IntOrString(io.fabric8.kubernetes.api.model.IntOrString) DoneableDeploymentConfig(io.fabric8.openshift.api.model.DoneableDeploymentConfig) DeploymentConfig(io.fabric8.openshift.api.model.DeploymentConfig)

Example 2 with DoneableDeploymentConfig

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;
}
Also used : IntOrString(io.fabric8.kubernetes.api.model.IntOrString)

Aggregations

IntOrString (io.fabric8.kubernetes.api.model.IntOrString)2 Service (io.fabric8.kubernetes.api.model.Service)1 DeploymentConfig (io.fabric8.openshift.api.model.DeploymentConfig)1 DoneableDeploymentConfig (io.fabric8.openshift.api.model.DoneableDeploymentConfig)1