use of io.strimzi.operator.cluster.operator.resource.ZookeeperScaler in project strimzi-kafka-operator by strimzi.
the class ZooKeeperReconciler method zkScaler.
/**
* Helper method for getting the required secrets with certificates and creating the ZookeeperScaler instance
* for the given cluster. The ZookeeperScaler instance created by this method should be closed manually after
* it is not used anymore.
*
* @param connectToReplicas Number of pods from the Zookeeper STS which the scaler should use
*
* @return Zookeeper scaler instance.
*/
private Future<ZookeeperScaler> zkScaler(int connectToReplicas) {
return ReconcilerUtils.clientSecrets(reconciliation, secretOperator).compose(compositeFuture -> {
Secret clusterCaCertSecret = compositeFuture.resultAt(0);
Secret coKeySecret = compositeFuture.resultAt(1);
Function<Integer, String> zkNodeAddress = (Integer i) -> DnsNameGenerator.podDnsNameWithoutClusterDomain(reconciliation.namespace(), KafkaResources.zookeeperHeadlessServiceName(reconciliation.name()), KafkaResources.zookeeperPodName(reconciliation.name(), i));
ZookeeperScaler zkScaler = zooScalerProvider.createZookeeperScaler(reconciliation, vertx, zkConnectionString(connectToReplicas, zkNodeAddress), zkNodeAddress, clusterCaCertSecret, coKeySecret, operationTimeoutMs, adminSessionTimeoutMs);
return Future.succeededFuture(zkScaler);
});
}
use of io.strimzi.operator.cluster.operator.resource.ZookeeperScaler in project strimzi by strimzi.
the class ZooKeeperReconciler method zkScaler.
/**
* Helper method for getting the required secrets with certificates and creating the ZookeeperScaler instance
* for the given cluster. The ZookeeperScaler instance created by this method should be closed manually after
* it is not used anymore.
*
* @param connectToReplicas Number of pods from the Zookeeper STS which the scaler should use
*
* @return Zookeeper scaler instance.
*/
private Future<ZookeeperScaler> zkScaler(int connectToReplicas) {
return ReconcilerUtils.clientSecrets(reconciliation, secretOperator).compose(compositeFuture -> {
Secret clusterCaCertSecret = compositeFuture.resultAt(0);
Secret coKeySecret = compositeFuture.resultAt(1);
Function<Integer, String> zkNodeAddress = (Integer i) -> DnsNameGenerator.podDnsNameWithoutClusterDomain(reconciliation.namespace(), KafkaResources.zookeeperHeadlessServiceName(reconciliation.name()), KafkaResources.zookeeperPodName(reconciliation.name(), i));
ZookeeperScaler zkScaler = zooScalerProvider.createZookeeperScaler(reconciliation, vertx, zkConnectionString(connectToReplicas, zkNodeAddress), zkNodeAddress, clusterCaCertSecret, coKeySecret, operationTimeoutMs, adminSessionTimeoutMs);
return Future.succeededFuture(zkScaler);
});
}
use of io.strimzi.operator.cluster.operator.resource.ZookeeperScaler in project strimzi by strimzi.
the class ResourceUtils method zookeeperScalerProvider.
public static ZookeeperScalerProvider zookeeperScalerProvider() {
return new ZookeeperScalerProvider() {
@Override
public ZookeeperScaler createZookeeperScaler(Reconciliation reconciliation, Vertx vertx, String zookeeperConnectionString, Function<Integer, String> zkNodeAddress, Secret clusterCaCertSecret, Secret coKeySecret, long operationTimeoutMs, int zkAdminSessionTimoutMs) {
ZookeeperScaler mockZooScaler = mock(ZookeeperScaler.class);
when(mockZooScaler.scale(anyInt())).thenReturn(Future.succeededFuture());
return mockZooScaler;
}
};
}
use of io.strimzi.operator.cluster.operator.resource.ZookeeperScaler in project strimzi-kafka-operator by strimzi.
the class ResourceUtils method zookeeperScalerProvider.
public static ZookeeperScalerProvider zookeeperScalerProvider() {
return new ZookeeperScalerProvider() {
@Override
public ZookeeperScaler createZookeeperScaler(Reconciliation reconciliation, Vertx vertx, String zookeeperConnectionString, Function<Integer, String> zkNodeAddress, Secret clusterCaCertSecret, Secret coKeySecret, long operationTimeoutMs, int zkAdminSessionTimoutMs) {
ZookeeperScaler mockZooScaler = mock(ZookeeperScaler.class);
when(mockZooScaler.scale(anyInt())).thenReturn(Future.succeededFuture());
return mockZooScaler;
}
};
}
Aggregations