Class OcpKafkaController

java.lang.Object
io.debezium.testing.system.tools.kafka.OcpKafkaController
All Implemented Interfaces:
KafkaController

public class OcpKafkaController extends Object implements KafkaController
This class provides control over Kafka instance deployed in OpenShift
Author:
Jakub Cechacek
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • ocp

      private final io.fabric8.openshift.client.OpenShiftClient ocp
    • project

      private final String project
    • name

      private final String name
    • operatorController

      private final StrimziOperatorController operatorController
    • kafka

      private io.strimzi.api.kafka.model.kafka.Kafka kafka
  • Constructor Details

    • OcpKafkaController

      public OcpKafkaController(io.strimzi.api.kafka.model.kafka.Kafka kafka, StrimziOperatorController operatorController, io.fabric8.openshift.client.OpenShiftClient ocp)
  • Method Details

    • getPublicBootstrapAddress

      public String getPublicBootstrapAddress()
      Description copied from interface: KafkaController
      The Bootstrap address returned by this method must be reachable form arbitrary network.
      Specified by:
      getPublicBootstrapAddress in interface KafkaController
      Returns:
      Publicly reachable Kafka Bootstrap Server address
    • getBootstrapAddress

      public String getBootstrapAddress()
      Description copied from interface: KafkaController
      The Bootstrap address returned by this method may not be reachable form arbitrary network.
      Specified by:
      getBootstrapAddress in interface KafkaController
      Returns:
      Kafka Bootstrap Server address
    • getTlsBootstrapAddress

      public String getTlsBootstrapAddress()
      Specified by:
      getTlsBootstrapAddress in interface KafkaController
    • getLocalBootstrapAddress

      public String getLocalBootstrapAddress()
      Returns bootstrap to be used by KC. The address is local.
      Returns:
      bootstrap
    • deployTopic

      public io.strimzi.api.kafka.model.topic.KafkaTopic deployTopic(String yamlPath) throws InterruptedException
      Deploy kafka topic from given CR
      Parameters:
      yamlPath - path to yaml descript
      Returns:
      created topic
      Throws:
      InterruptedException
    • undeploy

      public boolean undeploy()
      Description copied from interface: KafkaController
      Undeploy this Kafka cluster
      Specified by:
      undeploy in interface KafkaController
      Returns:
      true on operation success
    • waitForCluster

      public void waitForCluster() throws InterruptedException
      Description copied from interface: KafkaController
      Waits for cluster to be available
      Specified by:
      waitForCluster in interface KafkaController
      Throws:
      InterruptedException
    • waitForKafkaTopic

      private io.strimzi.api.kafka.model.topic.KafkaTopic waitForKafkaTopic(String name) throws InterruptedException
      Waits until topic is properly deployed.
      Parameters:
      name - name of the topic
      Throws:
      InterruptedException - on wait error
      IllegalArgumentException - when deployment doesn't use custom resources
    • topicOperation

      private io.fabric8.kubernetes.client.dsl.NonNamespaceOperation<io.strimzi.api.kafka.model.topic.KafkaTopic,io.strimzi.api.kafka.model.topic.KafkaTopicList,io.fabric8.kubernetes.client.dsl.Resource<io.strimzi.api.kafka.model.topic.KafkaTopic>> topicOperation()
    • kafkaOperation

      private io.fabric8.kubernetes.client.dsl.NonNamespaceOperation<io.strimzi.api.kafka.model.kafka.Kafka,io.strimzi.api.kafka.model.kafka.KafkaList,io.fabric8.kubernetes.client.dsl.Resource<io.strimzi.api.kafka.model.kafka.Kafka>> kafkaOperation()
    • getDefaultConsumerProperties

      public Properties getDefaultConsumerProperties()
      Specified by:
      getDefaultConsumerProperties in interface KafkaController
      Returns:
      default kafka consumer configuration
    • getDefaultProducerProperties

      public Properties getDefaultProducerProperties()
      Specified by:
      getDefaultProducerProperties in interface KafkaController
      Returns:
      default kafka producer configuration
    • getKafkaCaCertificate

      private File getKafkaCaCertificate() throws IOException
      Throws:
      IOException