Class OcpKafkaConnectController

    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • ocp

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

        private final okhttp3.OkHttpClient http
      • project

        private final String project
      • httpUtils

        private final HttpUtils httpUtils
      • connectorResources

        private final boolean connectorResources
      • name

        private final String name
      • kafkaConnect

        private io.strimzi.api.kafka.model.KafkaConnect kafkaConnect
      • apiRoute

        private io.fabric8.openshift.api.model.Route apiRoute
      • metricsRoute

        private io.fabric8.openshift.api.model.Route metricsRoute
      • metricsService

        private io.fabric8.kubernetes.api.model.Service metricsService
    • Constructor Detail

      • OcpKafkaConnectController

        public OcpKafkaConnectController​(io.strimzi.api.kafka.model.KafkaConnect kafkaConnect,
                                         io.fabric8.openshift.client.OpenShiftClient ocp,
                                         okhttp3.OkHttpClient http,
                                         boolean connectorResources)
    • Method Detail

      • disable

        public void disable()
        Disables Kafka Connect by scaling it to ZERO

        NOTICE: cluster operator needs to be disabled first!

        Specified by:
        disable in interface KafkaConnectController
      • destroy

        public void destroy()
        Crashes Kafka Connect by force deleting all pods. Then it immediately scales its deployment to ZERO by calling disable()

        NOTICE: cluster operator needs to be disabled first!

        Specified by:
        destroy in interface KafkaConnectController
      • allowServiceAccess

        public io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicy allowServiceAccess()
        Creates network policy allowing access to ports exposed by Kafka Connect
        Returns:
      • exposeApi

        public io.fabric8.openshift.api.model.Route exposeApi()
        Exposes a route for kafka connect API associated with given KafkaConnect resource
        Returns:
        Route object
      • exposeMetrics

        public io.fabric8.openshift.api.model.Route exposeMetrics()
        Exposes a route for prometheus metrics for kafka connect associated with given KafkaConnect resource
        Returns:
        Route object
      • waitForKafkaConnector

        public io.strimzi.api.kafka.model.KafkaConnector waitForKafkaConnector​(String name)
                                                                        throws InterruptedException
        Waits until connector is properly deployed. Note: works only for CR deployment
        Parameters:
        name - name of the connector
        Throws:
        InterruptedException - on wait error
        IllegalArgumentException - when deployment doesn't use custom resources
      • kafkaConnectorOperation

        private io.fabric8.kubernetes.client.dsl.NonNamespaceOperation<io.strimzi.api.kafka.model.KafkaConnector,​io.strimzi.api.kafka.KafkaConnectorList,​io.fabric8.kubernetes.client.dsl.Resource<io.strimzi.api.kafka.model.KafkaConnector>> kafkaConnectorOperation()
      • undeployConnectorCr

        private void undeployConnectorCr​(String name)
      • waitForSnapshot

        public void waitForSnapshot​(String connectorName,
                                    String metricName)
                             throws IOException
        Waits until Snapshot phase of given connector completes
        Parameters:
        connectorName - name of the connect
        metricName - name of the metric used to determine the state
        Throws:
        IOException - on metric request error
      • undeploy

        public boolean undeploy()
        Undeploy this Kafka Connect cluster by deleted related KafkaConnect CR
        Specified by:
        undeploy in interface KafkaConnectController
        Returns:
        true if the CR was found and deleted