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()));
}
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));
}
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"));
}
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"));
}
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);
}
Aggregations