io.fabric8.kubernetes.api.model.DoneableReplicationController Java Examples

The following examples show how to use io.fabric8.kubernetes.api.model.DoneableReplicationController. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PatchService.java    From jkube with Eclipse Public License 2.0 6 votes vote down vote up
private static EntityPatcher<ReplicationController> rcPatcher() {
    return (KubernetesClient client, String namespace, ReplicationController newObj, ReplicationController oldObj) -> {
        if (UserConfigurationCompare.configEqual(newObj, oldObj)) {
            return oldObj;
        }

        DoneableReplicationController entity =
            client.replicationControllers()
                  .inNamespace(namespace)
                  .withName(oldObj.getMetadata().getName())
                  .edit();

        if (!UserConfigurationCompare.configEqual(newObj.getMetadata(), oldObj.getMetadata())) {
            entity.withMetadata(newObj.getMetadata());
        }

        if(!UserConfigurationCompare.configEqual(newObj.getSpec(), oldObj.getSpec())) {
                entity.withSpec(newObj.getSpec());
        }
        return entity.done();
    };
}
 
Example #2
Source File: SparkClusterOperator.java    From spark-operator with Apache License 2.0 5 votes vote down vote up
private Map<String, Integer> getActual() {
    MixedOperation<ReplicationController, ReplicationControllerList, DoneableReplicationController, RollableScalableResource<ReplicationController, DoneableReplicationController>> aux1 =
            client.replicationControllers();
    FilterWatchListMultiDeletable<ReplicationController, ReplicationControllerList, Boolean, Watch, Watcher<ReplicationController>> aux2 =
            "*".equals(namespace) ? aux1.inAnyNamespace() : aux1.inNamespace(namespace);
    Map<String, String> labels =new HashMap<>(2);
    labels.put(prefix + OPERATOR_KIND_LABEL, entityName);
    labels.put(prefix + OPERATOR_RC_TYPE_LABEL, "worker");
    List<ReplicationController> workerRcs = aux2.withLabels(labels).list().getItems();
    Map<String, Integer> retMap = workerRcs
            .stream()
            .collect(Collectors.toMap(rc -> rc.getMetadata().getLabels().get(prefix + entityName),
                    rc -> rc.getSpec().getReplicas()));
    return retMap;
}
 
Example #3
Source File: ReplicationControllerRollingUpdater.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
@Override
protected void updateDeploymentKey(DoneableReplicationController obj, String hash) {
  obj.editSpec()
    .addToSelector(DEPLOYMENT_KEY, hash)
    .editTemplate().editMetadata().addToLabels(DEPLOYMENT_KEY, hash).endMetadata().endTemplate()
    .endSpec();
}
 
Example #4
Source File: ReplicationControllerRollingUpdater.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
@Override
protected void removeDeploymentKey(DoneableReplicationController obj) {
  obj.editSpec()
    .removeFromSelector(DEPLOYMENT_KEY)
    .editTemplate().editMetadata().removeFromLabels(DEPLOYMENT_KEY).endMetadata().endTemplate()
    .endSpec();
}
 
Example #5
Source File: ReplicationControllerRollingUpdater.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
protected Operation<ReplicationController, ReplicationControllerList, DoneableReplicationController, RollableScalableResource<ReplicationController, DoneableReplicationController>> resources() {
  return new ReplicationControllerOperationsImpl(client, config);
}
 
Example #6
Source File: ReplicationControllerOperationsImpl.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public ReplicationControllerOperationsImpl(RollingOperationContext context) {
  super(context.withPlural("replicationcontrollers"));
  this.type = ReplicationController.class;
  this.listType = ReplicationControllerList.class;
  this.doneableType = DoneableReplicationController.class;
}
 
Example #7
Source File: ReplicationControllerOperationsImpl.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public RollableScalableResource<ReplicationController, DoneableReplicationController> load(InputStream is) {
    ReplicationController item = unmarshal(is, ReplicationController.class);
    return new ReplicationControllerOperationsImpl((RollingOperationContext) context.withItem(item));
}
 
Example #8
Source File: ReplicationControllerOperationsImpl.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public RollingUpdater<ReplicationController, ReplicationControllerList, DoneableReplicationController> getRollingUpdater(long rollingTimeout, TimeUnit rollingTimeUnit) {
  return new ReplicationControllerRollingUpdater(client, config, namespace, rollingTimeUnit.toMillis(rollingTimeout), config.getLoggingInterval());
}
 
Example #9
Source File: ReplicationControllerOperationsImpl.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public ImageEditReplacePatchable<ReplicationController, ReplicationController, DoneableReplicationController> withTimeout(long timeout, TimeUnit unit) {
  return new ReplicationControllerOperationsImpl(((RollingOperationContext)context).withRollingTimeout(unit.toMillis(timeout)).withRollingTimeUnit(TimeUnit.MILLISECONDS));
}
 
Example #10
Source File: ReplicationControllerOperationsImpl.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public ImageEditReplacePatchable<ReplicationController, ReplicationController, DoneableReplicationController> withTimeoutInMillis(long timeoutInMillis) {
  return new ReplicationControllerOperationsImpl(((RollingOperationContext)context).withRollingTimeout(timeoutInMillis));
}
 
Example #11
Source File: AutoAdaptableKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public MixedOperation<ReplicationController, ReplicationControllerList, DoneableReplicationController, RollableScalableResource<ReplicationController, DoneableReplicationController>> replicationControllers() {
  return delegate.replicationControllers();
}
 
Example #12
Source File: DefaultKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public MixedOperation<ReplicationController, ReplicationControllerList, DoneableReplicationController, RollableScalableResource<ReplicationController, DoneableReplicationController>> replicationControllers() {
  return new ReplicationControllerOperationsImpl(httpClient, getConfiguration());
}
 
Example #13
Source File: ManagedKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public MixedOperation<ReplicationController, ReplicationControllerList, DoneableReplicationController, RollableScalableResource<ReplicationController, DoneableReplicationController>> replicationControllers() {
  return delegate.replicationControllers();
}
 
Example #14
Source File: DefaultOpenShiftClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public MixedOperation<ReplicationController, ReplicationControllerList, DoneableReplicationController, RollableScalableResource<ReplicationController, DoneableReplicationController>> replicationControllers() {
  return delegate.replicationControllers();
}
 
Example #15
Source File: KubernetesClient.java    From kubernetes-client with Apache License 2.0 2 votes vote down vote up
/**
 * API entrypoint for ReplicationController related operations. ReplicationController (core/v1)
 *
 * @return MixedOperation object for ReplicationController related operations.
 */
MixedOperation<ReplicationController, ReplicationControllerList, DoneableReplicationController, RollableScalableResource<ReplicationController, DoneableReplicationController>> replicationControllers();