Search in sources :

Example 6 with ZookeeperClusterSpec

use of io.strimzi.api.kafka.model.ZookeeperClusterSpec in project strimzi-kafka-operator by strimzi.

the class ResourceUtils method createKafka.

public static Kafka createKafka(String namespace, String name, int replicas, String image, int healthDelay, int healthTimeout, MetricsConfig metricsConfig, Map<String, Object> kafkaConfiguration, Map<String, Object> zooConfiguration, Storage kafkaStorage, SingleVolumeStorage zkStorage, Logging kafkaLogging, Logging zkLogging, KafkaExporterSpec keSpec, CruiseControlSpec ccSpec) {
    Kafka result = new Kafka();
    ObjectMeta meta = new ObjectMetaBuilder().withNamespace(namespace).withName(name).withLabels(Labels.fromMap(TestUtils.map(Labels.KUBERNETES_DOMAIN + "part-of", "tests", "my-user-label", "cromulent")).toMap()).build();
    result.setMetadata(meta);
    KafkaSpec spec = new KafkaSpec();
    KafkaClusterSpec kafkaClusterSpec = new KafkaClusterSpec();
    kafkaClusterSpec.setReplicas(replicas);
    kafkaClusterSpec.setListeners(singletonList(new GenericKafkaListenerBuilder().withName("plain").withPort(9092).withTls(false).withType(KafkaListenerType.INTERNAL).build()));
    kafkaClusterSpec.setImage(image);
    if (kafkaLogging != null) {
        kafkaClusterSpec.setLogging(kafkaLogging);
    }
    Probe livenessProbe = new Probe();
    livenessProbe.setInitialDelaySeconds(healthDelay);
    livenessProbe.setTimeoutSeconds(healthTimeout);
    livenessProbe.setSuccessThreshold(4);
    livenessProbe.setFailureThreshold(10);
    livenessProbe.setPeriodSeconds(33);
    kafkaClusterSpec.setLivenessProbe(livenessProbe);
    kafkaClusterSpec.setReadinessProbe(livenessProbe);
    kafkaClusterSpec.setMetricsConfig(metricsConfig);
    if (kafkaConfiguration != null) {
        kafkaClusterSpec.setConfig(kafkaConfiguration);
    }
    kafkaClusterSpec.setStorage(kafkaStorage);
    spec.setKafka(kafkaClusterSpec);
    ZookeeperClusterSpec zk = new ZookeeperClusterSpec();
    zk.setReplicas(replicas);
    zk.setImage(image + "-zk");
    if (zkLogging != null) {
        zk.setLogging(zkLogging);
    }
    zk.setLivenessProbe(livenessProbe);
    zk.setReadinessProbe(livenessProbe);
    if (zooConfiguration != null) {
        zk.setConfig(zooConfiguration);
    }
    zk.setStorage(zkStorage);
    zk.setMetricsConfig(metricsConfig);
    spec.setKafkaExporter(keSpec);
    spec.setCruiseControl(ccSpec);
    spec.setZookeeper(zk);
    result.setSpec(spec);
    return result;
}
Also used : KafkaClusterSpec(io.strimzi.api.kafka.model.KafkaClusterSpec) ObjectMeta(io.fabric8.kubernetes.api.model.ObjectMeta) ZookeeperClusterSpec(io.strimzi.api.kafka.model.ZookeeperClusterSpec) GenericKafkaListenerBuilder(io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder) Kafka(io.strimzi.api.kafka.model.Kafka) ObjectMetaBuilder(io.fabric8.kubernetes.api.model.ObjectMetaBuilder) Probe(io.strimzi.api.kafka.model.Probe) KafkaSpec(io.strimzi.api.kafka.model.KafkaSpec)

Aggregations

KafkaClusterSpec (io.strimzi.api.kafka.model.KafkaClusterSpec)6 ZookeeperClusterSpec (io.strimzi.api.kafka.model.ZookeeperClusterSpec)6 IntOrString (io.fabric8.kubernetes.api.model.IntOrString)2 LabelSelector (io.fabric8.kubernetes.api.model.LabelSelector)2 ObjectMeta (io.fabric8.kubernetes.api.model.ObjectMeta)2 ObjectMetaBuilder (io.fabric8.kubernetes.api.model.ObjectMetaBuilder)2 EntityOperatorSpec (io.strimzi.api.kafka.model.EntityOperatorSpec)2 InlineLogging (io.strimzi.api.kafka.model.InlineLogging)2 Kafka (io.strimzi.api.kafka.model.Kafka)2 KafkaSpec (io.strimzi.api.kafka.model.KafkaSpec)2 Logging (io.strimzi.api.kafka.model.Logging)2 Probe (io.strimzi.api.kafka.model.Probe)2 GenericKafkaListenerBuilder (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder)2 Condition (io.strimzi.api.kafka.model.status.Condition)2 Storage (io.strimzi.api.kafka.model.storage.Storage)2 ZookeeperClusterTemplate (io.strimzi.api.kafka.model.template.ZookeeperClusterTemplate)2 MetricsAndLogging (io.strimzi.operator.common.MetricsAndLogging)2 ParallelNamespaceTest (io.strimzi.systemtest.annotations.ParallelNamespaceTest)2 TestUtils.fromYamlString (io.strimzi.test.TestUtils.fromYamlString)2 HashMap (java.util.HashMap)2