Search in sources :

Example 16 with KafkaClusterSpec

use of io.strimzi.api.kafka.model.KafkaClusterSpec 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)16 IntOrString (io.fabric8.kubernetes.api.model.IntOrString)6 InlineLogging (io.strimzi.api.kafka.model.InlineLogging)6 Logging (io.strimzi.api.kafka.model.Logging)6 ZookeeperClusterSpec (io.strimzi.api.kafka.model.ZookeeperClusterSpec)6 LabelSelector (io.fabric8.kubernetes.api.model.LabelSelector)4 EntityOperatorSpec (io.strimzi.api.kafka.model.EntityOperatorSpec)4 KafkaSpec (io.strimzi.api.kafka.model.KafkaSpec)4 TlsSidecar (io.strimzi.api.kafka.model.TlsSidecar)4 Condition (io.strimzi.api.kafka.model.status.Condition)4 Storage (io.strimzi.api.kafka.model.storage.Storage)4 MetricsAndLogging (io.strimzi.operator.common.MetricsAndLogging)4 ObjectMeta (io.fabric8.kubernetes.api.model.ObjectMeta)2 ObjectMetaBuilder (io.fabric8.kubernetes.api.model.ObjectMetaBuilder)2 CruiseControlSpec (io.strimzi.api.kafka.model.CruiseControlSpec)2 Kafka (io.strimzi.api.kafka.model.Kafka)2 KafkaAuthorizationKeycloak (io.strimzi.api.kafka.model.KafkaAuthorizationKeycloak)2 KafkaExporterSpec (io.strimzi.api.kafka.model.KafkaExporterSpec)2 Probe (io.strimzi.api.kafka.model.Probe)2 GenericKafkaListener (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListener)2