Search in sources :

Example 6 with CruiseControlSpec

use of io.strimzi.api.kafka.model.CruiseControlSpec in project strimzi by strimzi.

the class CruiseControlTest method testMetricsParsingNoMetrics.

@ParallelTest
public void testMetricsParsingNoMetrics() {
    CruiseControlSpec cruiseControlSpec = new CruiseControlSpecBuilder().build();
    Kafka kafkaAssembly = createKafka(cruiseControlSpec);
    CruiseControl cc = createCruiseControl(kafkaAssembly);
    assertThat(cc.isMetricsEnabled(), is(false));
    assertThat(cc.getMetricsConfigInCm(), is(nullValue()));
}
Also used : CruiseControlSpec(io.strimzi.api.kafka.model.CruiseControlSpec) Kafka(io.strimzi.api.kafka.model.Kafka) CruiseControlSpecBuilder(io.strimzi.api.kafka.model.CruiseControlSpecBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 7 with CruiseControlSpec

use of io.strimzi.api.kafka.model.CruiseControlSpec in project strimzi by strimzi.

the class CruiseControlTest method testGoalsCheck.

@ParallelTest
public void testGoalsCheck() {
    String customGoals = "com.linkedin.kafka.cruisecontrol.analyzer.goals.RackAwareGoal," + "com.linkedin.kafka.cruisecontrol.analyzer.goals.ReplicaCapacityGoal";
    Map<String, Object> customGoalConfig = ccConfig;
    customGoalConfig.put(CRUISE_CONTROL_DEFAULT_GOALS_CONFIG_KEY.getValue(), customGoals);
    CruiseControlSpec cruiseControlSpec = new CruiseControlSpecBuilder().withImage(ccImage).withConfig(customGoalConfig).build();
    Kafka resourceWithCustomGoals = createKafka(cruiseControlSpec);
    CruiseControl cruiseControlWithCustomGoals = createCruiseControl(resourceWithCustomGoals);
    String anomalyDetectionGoals = cruiseControlWithCustomGoals.getConfiguration().asOrderedProperties().asMap().get(CRUISE_CONTROL_ANOMALY_DETECTION_CONFIG_KEY.getValue());
    assertThat(anomalyDetectionGoals, is(customGoals));
}
Also used : CruiseControlSpec(io.strimzi.api.kafka.model.CruiseControlSpec) Kafka(io.strimzi.api.kafka.model.Kafka) CruiseControlSpecBuilder(io.strimzi.api.kafka.model.CruiseControlSpecBuilder) IntOrString(io.fabric8.kubernetes.api.model.IntOrString) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 8 with CruiseControlSpec

use of io.strimzi.api.kafka.model.CruiseControlSpec in project strimzi by strimzi.

the class KafkaBrokerConfigurationBuilderTest method testCruiseControl.

@ParallelTest
public void testCruiseControl() {
    CruiseControlSpec cruiseControlSpec = new CruiseControlSpecBuilder().build();
    String configuration = new KafkaBrokerConfigurationBuilder(Reconciliation.DUMMY_RECONCILIATION).withCruiseControl("my-cluster", cruiseControlSpec, "1", "1", "1").build();
    assertThat(configuration, containsString(CruiseControlConfigurationParameters.METRICS_TOPIC_NAME + "=strimzi.cruisecontrol.metrics\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_ENDPOINT_ID_ALGO + "=HTTPS\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_BOOTSTRAP_SERVERS + "=my-cluster-kafka-brokers:9091\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SECURITY_PROTOCOL + "=SSL\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_KEYSTORE_TYPE + "=PKCS12\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_KEYSTORE_LOCATION + "=/tmp/kafka/cluster.keystore.p12\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_KEYSTORE_PASSWORD + "=${CERTS_STORE_PASSWORD}\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_TRUSTSTORE_TYPE + "=PKCS12\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_TRUSTSTORE_LOCATION + "=/tmp/kafka/cluster.truststore.p12\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_TRUSTSTORE_PASSWORD + "=${CERTS_STORE_PASSWORD}\n" + CruiseControlConfigurationParameters.METRICS_TOPIC_AUTO_CREATE + "=true\n" + CruiseControlConfigurationParameters.METRICS_TOPIC_NUM_PARTITIONS + "=1\n" + CruiseControlConfigurationParameters.METRICS_TOPIC_REPLICATION_FACTOR + "=1\n" + CruiseControlConfigurationParameters.METRICS_TOPIC_MIN_ISR + "=1"));
}
Also used : CruiseControlSpec(io.strimzi.api.kafka.model.CruiseControlSpec) CruiseControlSpecBuilder(io.strimzi.api.kafka.model.CruiseControlSpecBuilder) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 9 with CruiseControlSpec

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

the class KafkaBrokerConfigurationBuilderTest method testCruiseControl.

@ParallelTest
public void testCruiseControl() {
    CruiseControlSpec cruiseControlSpec = new CruiseControlSpecBuilder().build();
    String configuration = new KafkaBrokerConfigurationBuilder(Reconciliation.DUMMY_RECONCILIATION).withCruiseControl("my-cluster", cruiseControlSpec, "1", "1", "1").build();
    assertThat(configuration, containsString(CruiseControlConfigurationParameters.METRICS_TOPIC_NAME + "=strimzi.cruisecontrol.metrics\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_ENDPOINT_ID_ALGO + "=HTTPS\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_BOOTSTRAP_SERVERS + "=my-cluster-kafka-brokers:9091\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SECURITY_PROTOCOL + "=SSL\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_KEYSTORE_TYPE + "=PKCS12\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_KEYSTORE_LOCATION + "=/tmp/kafka/cluster.keystore.p12\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_KEYSTORE_PASSWORD + "=${CERTS_STORE_PASSWORD}\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_TRUSTSTORE_TYPE + "=PKCS12\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_TRUSTSTORE_LOCATION + "=/tmp/kafka/cluster.truststore.p12\n" + CruiseControlConfigurationParameters.METRICS_REPORTER_SSL_TRUSTSTORE_PASSWORD + "=${CERTS_STORE_PASSWORD}\n" + CruiseControlConfigurationParameters.METRICS_TOPIC_AUTO_CREATE + "=true\n" + CruiseControlConfigurationParameters.METRICS_TOPIC_NUM_PARTITIONS + "=1\n" + CruiseControlConfigurationParameters.METRICS_TOPIC_REPLICATION_FACTOR + "=1\n" + CruiseControlConfigurationParameters.METRICS_TOPIC_MIN_ISR + "=1"));
}
Also used : CruiseControlSpec(io.strimzi.api.kafka.model.CruiseControlSpec) CruiseControlSpecBuilder(io.strimzi.api.kafka.model.CruiseControlSpecBuilder) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 10 with CruiseControlSpec

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

the class CruiseControlConfigurationST method testConfigurationDiskChangeDoNotTriggersRollingUpdateOfKafkaPods.

@ParallelNamespaceTest
void testConfigurationDiskChangeDoNotTriggersRollingUpdateOfKafkaPods(ExtensionContext extensionContext) {
    final String namespaceName = StUtils.getNamespaceBasedOnRbac(namespace, extensionContext);
    final String clusterName = mapWithClusterNames.get(extensionContext.getDisplayName());
    final LabelSelector kafkaSelector = KafkaResource.getLabelSelector(clusterName, KafkaResources.kafkaStatefulSetName(clusterName));
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaWithCruiseControl(clusterName, 3, 3).build());
    Map<String, String> kafkaSnapShot = PodUtils.podSnapshot(namespaceName, kafkaSelector);
    Map<String, String> cruiseControlSnapShot = DeploymentUtils.depSnapshot(namespaceName, CruiseControlResources.deploymentName(clusterName));
    KafkaResource.replaceKafkaResourceInSpecificNamespace(clusterName, kafka -> {
        LOGGER.info("Changing the broker capacity of the cruise control");
        CruiseControlSpec cruiseControl = new CruiseControlSpecBuilder().withNewBrokerCapacity().withOutboundNetwork("20KB/s").endBrokerCapacity().build();
        kafka.getSpec().setCruiseControl(cruiseControl);
    }, namespaceName);
    LOGGER.info("Verifying that CC pod is rolling, because of change size of disk");
    DeploymentUtils.waitTillDepHasRolled(namespaceName, CruiseControlResources.deploymentName(clusterName), 1, cruiseControlSnapShot);
    LOGGER.info("Verifying that Kafka pods did not roll");
    RollingUpdateUtils.waitForNoRollingUpdate(namespaceName, kafkaSelector, kafkaSnapShot);
    LOGGER.info("Verifying new configuration in the Kafka CR");
    assertThat(KafkaResource.kafkaClient().inNamespace(namespaceName).withName(clusterName).get().getSpec().getCruiseControl().getBrokerCapacity().getOutboundNetwork(), is("20KB/s"));
    CruiseControlUtils.verifyThatCruiseControlTopicsArePresent(namespaceName);
}
Also used : CruiseControlSpec(io.strimzi.api.kafka.model.CruiseControlSpec) LabelSelector(io.fabric8.kubernetes.api.model.LabelSelector) CruiseControlSpecBuilder(io.strimzi.api.kafka.model.CruiseControlSpecBuilder) ParallelNamespaceTest(io.strimzi.systemtest.annotations.ParallelNamespaceTest)

Aggregations

CruiseControlSpec (io.strimzi.api.kafka.model.CruiseControlSpec)38 CruiseControlSpecBuilder (io.strimzi.api.kafka.model.CruiseControlSpecBuilder)34 Kafka (io.strimzi.api.kafka.model.Kafka)30 ParallelTest (io.strimzi.test.annotations.ParallelTest)30 IntOrString (io.fabric8.kubernetes.api.model.IntOrString)16 Deployment (io.fabric8.kubernetes.api.model.apps.Deployment)16 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)14 Container (io.fabric8.kubernetes.api.model.Container)8 EnvVar (io.fabric8.kubernetes.api.model.EnvVar)8 ContainerEnvVar (io.strimzi.api.kafka.model.ContainerEnvVar)8 PodSecurityContextBuilder (io.fabric8.kubernetes.api.model.PodSecurityContextBuilder)6 LabelSelector (io.fabric8.kubernetes.api.model.LabelSelector)4 SecurityContext (io.fabric8.kubernetes.api.model.SecurityContext)4 SecurityContextBuilder (io.fabric8.kubernetes.api.model.SecurityContextBuilder)4 Capacity (io.strimzi.operator.cluster.model.cruisecontrol.Capacity)4 ParallelNamespaceTest (io.strimzi.systemtest.annotations.ParallelNamespaceTest)4 Affinity (io.fabric8.kubernetes.api.model.Affinity)2 AffinityBuilder (io.fabric8.kubernetes.api.model.AffinityBuilder)2 ConfigMapKeySelectorBuilder (io.fabric8.kubernetes.api.model.ConfigMapKeySelectorBuilder)2 HostAlias (io.fabric8.kubernetes.api.model.HostAlias)2