Search in sources :

Example 6 with ManagedKafkaCapacity

use of org.bf2.operator.resources.v1alpha1.ManagedKafkaCapacity in project kas-fleetshard by bf2fc6cc711aee1a0c2a.

the class ManagedKafkaProvisioner method deployCluster.

/**
 * TODO: if/when this will need to test bin packing, then we'll separate the profile setting from deployCluster
 *
 * Deploy a Kafka cluster using this provisioner.
 * @param profile
 */
public ManagedKafkaDeployment deployCluster(String name, ManagedKafkaCapacity managedKafkaCapacity, KafkaInstanceConfiguration profile) throws Exception {
    // set and validate the strimzi version
    String strimziVersion = PerformanceEnvironment.STRIMZI_VERSION;
    if (strimziVersion == null) {
        strimziVersion = strimziVersions.get(strimziVersions.size() - 1);
    }
    String kafkaVersion = PerformanceEnvironment.KAFKA_VERSION;
    if (kafkaVersion == null) {
        kafkaVersion = getKafkaVersion(strimziVersion);
    }
    List<String> versions = strimziManager.getVersions();
    if (!versions.contains(strimziVersion)) {
        throw new IllegalStateException(String.format("Strimzi version %s is not in the set of installed versions %s", strimziVersion, versions));
    }
    int replicas = 3;
    if (managedKafkaCapacity.getMaxPartitions() != null) {
        replicas = (int) (3 * Math.ceil(managedKafkaCapacity.getMaxPartitions() / (double) profile.getKafka().getPartitionCapacity()));
    }
    applyProfile(profile, replicas);
    String namespace = Constants.KAFKA_NAMESPACE;
    ManagedKafka managedKafka = new ManagedKafkaBuilder().withNewMetadata().withName(name).withNamespace(namespace).endMetadata().withSpec(new ManagedKafkaSpecBuilder().withCapacity(managedKafkaCapacity).withNewEndpoint().withBootstrapServerHost(String.format("%s-kafka-bootstrap-%s.%s", name, namespace, domain)).withNewTls().withCert(tlsConfig.getCert()).withKey(tlsConfig.getKey()).endTls().endEndpoint().withNewVersions().withKafka(kafkaVersion).withStrimzi(strimziVersion).endVersions().build()).build();
    clusters.add(managedKafka);
    LOGGER.info("Deploying {}", Serialization.asYaml(managedKafka));
    ManagedKafkaDeployment kafkaDeployment = deployCluster(namespace, managedKafka);
    kafkaDeployment.start();
    return kafkaDeployment;
}
Also used : ManagedKafka(org.bf2.operator.resources.v1alpha1.ManagedKafka) ManagedKafkaSpecBuilder(org.bf2.operator.resources.v1alpha1.ManagedKafkaSpecBuilder) ManagedKafkaBuilder(org.bf2.operator.resources.v1alpha1.ManagedKafkaBuilder)

Example 7 with ManagedKafkaCapacity

use of org.bf2.operator.resources.v1alpha1.ManagedKafkaCapacity in project kas-fleetshard by bf2fc6cc711aee1a0c2a.

the class ManagedKafkaValueProdMinimumTest method testValueProdMinimumKafkaMem.

@ParameterizedTest(name = "testValueProdMinimumKafkaMem_{3}_{4}")
@CsvSource({ "41943040, 60000, 500, 12Gi, 2G", "41943040, 60000, 500, 12Gi, 3G", "41943040, 60000, 500, 12Gi, 4G", "41943040, 60000, 500, 12Gi, 5G", "41943040, 60000, 500, 10Gi, 2G", "41943040, 60000, 500, 10Gi, 3G", "41943040, 60000, 500, 10Gi, 4G", "41943040, 60000, 500, 10Gi, 5G", "41943040, 60000, 500, 8Gi, 2G", "41943040, 60000, 500, 8Gi, 3G", "41943040, 60000, 500, 8Gi, 4G", "41943040, 60000, 500, 8Gi, 5G", "41943040, 60000, 500, 6Gi, 2G", "41943040, 60000, 20, 6Gi, 3G" })
@Tag(TestTags.CI)
void testValueProdMinimumKafkaMem(long throughput, int workerProducerRate, int clients, String kafkaContainerMemory, String kafkaJavaMemory, TestInfo info) throws Exception {
    ManagedKafkaCapacity capacity = kafkaProvisioner.defaultCapacity(throughput);
    doTestValueProdMinimum(capacity, workerProducerRate, clients, "4Gi", "2G", kafkaContainerMemory, kafkaJavaMemory, "2000m", 10, 205, String.format("kf%s-%s", kafkaContainerMemory, kafkaJavaMemory), info.getDisplayName());
}
Also used : ManagedKafkaCapacity(org.bf2.operator.resources.v1alpha1.ManagedKafkaCapacity) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Tag(org.junit.jupiter.api.Tag)

Aggregations

ManagedKafkaCapacity (org.bf2.operator.resources.v1alpha1.ManagedKafkaCapacity)4 File (java.io.File)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Future (java.util.concurrent.Future)2 Tag (org.junit.jupiter.api.Tag)2 Test (org.junit.jupiter.api.Test)2 CsvSource (org.junit.jupiter.params.provider.CsvSource)2 Quantity (io.fabric8.kubernetes.api.model.Quantity)1 TestResult (io.openmessaging.benchmark.TestResult)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ExecutorService (java.util.concurrent.ExecutorService)1 Executors (java.util.concurrent.Executors)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 TimeUnit (java.util.concurrent.TimeUnit)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1