Search in sources :

Example 1 with EntityOperatorSpec

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

the class EntityUserOperatorTest method testFromCrdCaValidityAndRenewal.

@ParallelTest
public void testFromCrdCaValidityAndRenewal() {
    EntityUserOperatorSpec entityUserOperatorSpec = new EntityUserOperatorSpecBuilder().build();
    EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().withUserOperator(entityUserOperatorSpec).build();
    CertificateAuthority ca = new CertificateAuthority();
    ca.setValidityDays(42);
    ca.setRenewalDays(69);
    Kafka customValues = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).withClientsCa(ca).endSpec().build();
    EntityUserOperator entityUserOperator = EntityUserOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), customValues);
    Kafka defaultValues = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).endSpec().build();
    EntityUserOperator entityUserOperator2 = EntityUserOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), defaultValues);
    assertThat(entityUserOperator.getClientsCaValidityDays(), is(42L));
    assertThat(entityUserOperator.getClientsCaRenewalDays(), is(69L));
    assertThat(entityUserOperator2.getClientsCaValidityDays(), is(Long.valueOf(CertificateAuthority.DEFAULT_CERTS_VALIDITY_DAYS)));
    assertThat(entityUserOperator2.getClientsCaRenewalDays(), is(Long.valueOf(CertificateAuthority.DEFAULT_CERTS_RENEWAL_DAYS)));
}
Also used : EntityOperatorSpec(io.strimzi.api.kafka.model.EntityOperatorSpec) EntityUserOperatorSpec(io.strimzi.api.kafka.model.EntityUserOperatorSpec) Reconciliation(io.strimzi.operator.common.Reconciliation) Kafka(io.strimzi.api.kafka.model.Kafka) CertificateAuthority(io.strimzi.api.kafka.model.CertificateAuthority) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) EntityUserOperatorSpecBuilder(io.strimzi.api.kafka.model.EntityUserOperatorSpecBuilder) EntityOperatorSpecBuilder(io.strimzi.api.kafka.model.EntityOperatorSpecBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 2 with EntityOperatorSpec

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

the class EntityUserOperatorTest method testFromCrdDefault.

@ParallelTest
public void testFromCrdDefault() {
    EntityUserOperatorSpec entityUserOperatorSpec = new EntityUserOperatorSpecBuilder().build();
    EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().withUserOperator(entityUserOperatorSpec).build();
    Kafka resource = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).endSpec().build();
    EntityUserOperator entityUserOperator = EntityUserOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), resource);
    assertThat(entityUserOperator.getWatchedNamespace(), is(namespace));
    assertThat(entityUserOperator.getImage(), is("quay.io/strimzi/operator:latest"));
    assertThat(entityUserOperator.getReconciliationIntervalMs(), is(EntityUserOperatorSpec.DEFAULT_FULL_RECONCILIATION_INTERVAL_SECONDS * 1000));
    assertThat(entityUserOperator.readinessProbeOptions.getInitialDelaySeconds(), is(EntityUserOperatorSpec.DEFAULT_HEALTHCHECK_DELAY));
    assertThat(entityUserOperator.readinessProbeOptions.getTimeoutSeconds(), is(EntityUserOperatorSpec.DEFAULT_HEALTHCHECK_TIMEOUT));
    assertThat(entityUserOperator.livenessProbeOptions.getInitialDelaySeconds(), is(EntityUserOperatorSpec.DEFAULT_HEALTHCHECK_DELAY));
    assertThat(entityUserOperator.livenessProbeOptions.getTimeoutSeconds(), is(EntityUserOperatorSpec.DEFAULT_HEALTHCHECK_TIMEOUT));
    assertThat(entityUserOperator.getKafkaBootstrapServers(), is(EntityUserOperator.defaultBootstrapServers(cluster)));
    assertThat(entityUserOperator.getLogging(), is(nullValue()));
    assertThat(entityUserOperator.getSecretPrefix(), is(EntityUserOperatorSpec.DEFAULT_SECRET_PREFIX));
}
Also used : EntityOperatorSpec(io.strimzi.api.kafka.model.EntityOperatorSpec) EntityUserOperatorSpec(io.strimzi.api.kafka.model.EntityUserOperatorSpec) Reconciliation(io.strimzi.operator.common.Reconciliation) Kafka(io.strimzi.api.kafka.model.Kafka) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) EntityUserOperatorSpecBuilder(io.strimzi.api.kafka.model.EntityUserOperatorSpecBuilder) EntityOperatorSpecBuilder(io.strimzi.api.kafka.model.EntityOperatorSpecBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 3 with EntityOperatorSpec

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

the class KafkaST method testCustomAndUpdatedValues.

@ParallelNamespaceTest
@SuppressWarnings({ "checkstyle:MethodLength", "checkstyle:JavaNCSS" })
void testCustomAndUpdatedValues(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));
    final LabelSelector zkSelector = KafkaResource.getLabelSelector(clusterName, KafkaResources.zookeeperStatefulSetName(clusterName));
    LinkedHashMap<String, String> envVarGeneral = new LinkedHashMap<>();
    envVarGeneral.put("TEST_ENV_1", "test.env.one");
    envVarGeneral.put("TEST_ENV_2", "test.env.two");
    LinkedHashMap<String, String> envVarUpdated = new LinkedHashMap<>();
    envVarUpdated.put("TEST_ENV_2", "updated.test.env.two");
    envVarUpdated.put("TEST_ENV_3", "test.env.three");
    // Kafka Broker config
    Map<String, Object> kafkaConfig = new HashMap<>();
    kafkaConfig.put("offsets.topic.replication.factor", "1");
    kafkaConfig.put("transaction.state.log.replication.factor", "1");
    kafkaConfig.put("default.replication.factor", "1");
    Map<String, Object> updatedKafkaConfig = new HashMap<>();
    updatedKafkaConfig.put("offsets.topic.replication.factor", "2");
    updatedKafkaConfig.put("transaction.state.log.replication.factor", "2");
    updatedKafkaConfig.put("default.replication.factor", "2");
    // Zookeeper Config
    Map<String, Object> zookeeperConfig = new HashMap<>();
    zookeeperConfig.put("tickTime", "2000");
    zookeeperConfig.put("initLimit", "5");
    zookeeperConfig.put("syncLimit", "2");
    zookeeperConfig.put("autopurge.purgeInterval", "1");
    Map<String, Object> updatedZookeeperConfig = new HashMap<>();
    updatedZookeeperConfig.put("tickTime", "2500");
    updatedZookeeperConfig.put("initLimit", "3");
    updatedZookeeperConfig.put("syncLimit", "5");
    final int initialDelaySeconds = 30;
    final int timeoutSeconds = 10;
    final int updatedInitialDelaySeconds = 31;
    final int updatedTimeoutSeconds = 11;
    final int periodSeconds = 10;
    final int successThreshold = 1;
    final int failureThreshold = 3;
    final int updatedPeriodSeconds = 5;
    final int updatedFailureThreshold = 1;
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaPersistent(clusterName, 2).editSpec().editKafka().withNewReadinessProbe().withInitialDelaySeconds(initialDelaySeconds).withTimeoutSeconds(timeoutSeconds).withPeriodSeconds(periodSeconds).withSuccessThreshold(successThreshold).withFailureThreshold(failureThreshold).endReadinessProbe().withNewLivenessProbe().withInitialDelaySeconds(initialDelaySeconds).withTimeoutSeconds(timeoutSeconds).withPeriodSeconds(periodSeconds).withSuccessThreshold(successThreshold).withFailureThreshold(failureThreshold).endLivenessProbe().withConfig(kafkaConfig).withNewTemplate().withNewKafkaContainer().withEnv(StUtils.createContainerEnvVarsFromMap(envVarGeneral)).endKafkaContainer().endTemplate().endKafka().editZookeeper().withReplicas(2).withNewReadinessProbe().withInitialDelaySeconds(initialDelaySeconds).withTimeoutSeconds(timeoutSeconds).endReadinessProbe().withNewLivenessProbe().withInitialDelaySeconds(initialDelaySeconds).withTimeoutSeconds(timeoutSeconds).endLivenessProbe().withConfig(zookeeperConfig).withNewTemplate().withNewZookeeperContainer().withEnv(StUtils.createContainerEnvVarsFromMap(envVarGeneral)).endZookeeperContainer().endTemplate().endZookeeper().editEntityOperator().withNewTemplate().withNewTopicOperatorContainer().withEnv(StUtils.createContainerEnvVarsFromMap(envVarGeneral)).endTopicOperatorContainer().withNewUserOperatorContainer().withEnv(StUtils.createContainerEnvVarsFromMap(envVarGeneral)).endUserOperatorContainer().withNewTlsSidecarContainer().withEnv(StUtils.createContainerEnvVarsFromMap(envVarGeneral)).endTlsSidecarContainer().endTemplate().editUserOperator().withNewReadinessProbe().withInitialDelaySeconds(initialDelaySeconds).withTimeoutSeconds(timeoutSeconds).withPeriodSeconds(periodSeconds).withSuccessThreshold(successThreshold).withFailureThreshold(failureThreshold).endReadinessProbe().withNewLivenessProbe().withInitialDelaySeconds(initialDelaySeconds).withTimeoutSeconds(timeoutSeconds).withPeriodSeconds(periodSeconds).withSuccessThreshold(successThreshold).withFailureThreshold(failureThreshold).endLivenessProbe().endUserOperator().editTopicOperator().withNewReadinessProbe().withInitialDelaySeconds(initialDelaySeconds).withTimeoutSeconds(timeoutSeconds).withPeriodSeconds(periodSeconds).withSuccessThreshold(successThreshold).withFailureThreshold(failureThreshold).endReadinessProbe().withNewLivenessProbe().withInitialDelaySeconds(initialDelaySeconds).withTimeoutSeconds(timeoutSeconds).withPeriodSeconds(periodSeconds).withSuccessThreshold(successThreshold).withFailureThreshold(failureThreshold).endLivenessProbe().endTopicOperator().withNewTlsSidecar().withNewReadinessProbe().withInitialDelaySeconds(initialDelaySeconds).withTimeoutSeconds(timeoutSeconds).withPeriodSeconds(periodSeconds).withSuccessThreshold(successThreshold).withFailureThreshold(failureThreshold).endReadinessProbe().withNewLivenessProbe().withInitialDelaySeconds(initialDelaySeconds).withTimeoutSeconds(timeoutSeconds).withPeriodSeconds(periodSeconds).withSuccessThreshold(successThreshold).withFailureThreshold(failureThreshold).endLivenessProbe().endTlsSidecar().endEntityOperator().endSpec().build());
    final Map<String, String> kafkaSnapshot = PodUtils.podSnapshot(namespaceName, kafkaSelector);
    final Map<String, String> zkSnapshot = PodUtils.podSnapshot(namespaceName, zkSelector);
    final Map<String, String> eoPod = DeploymentUtils.depSnapshot(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName));
    LOGGER.info("Verify values before update");
    checkReadinessLivenessProbe(namespaceName, kafkaStatefulSetName(clusterName), "kafka", initialDelaySeconds, timeoutSeconds, periodSeconds, successThreshold, failureThreshold);
    checkKafkaConfiguration(namespaceName, kafkaStatefulSetName(clusterName), kafkaConfig, clusterName);
    checkSpecificVariablesInContainer(namespaceName, kafkaStatefulSetName(clusterName), "kafka", envVarGeneral);
    String kafkaConfiguration = kubeClient().getConfigMap(namespaceName, KafkaResources.kafkaMetricsAndLogConfigMapName(clusterName)).getData().get("server.config");
    assertThat(kafkaConfiguration, containsString("offsets.topic.replication.factor=1"));
    assertThat(kafkaConfiguration, containsString("transaction.state.log.replication.factor=1"));
    assertThat(kafkaConfiguration, containsString("default.replication.factor=1"));
    String kafkaConfigurationFromPod = cmdKubeClient(namespaceName).execInPod(KafkaResources.kafkaPodName(clusterName, 0), "cat", "/tmp/strimzi.properties").out();
    assertThat(kafkaConfigurationFromPod, containsString("offsets.topic.replication.factor=1"));
    assertThat(kafkaConfigurationFromPod, containsString("transaction.state.log.replication.factor=1"));
    assertThat(kafkaConfigurationFromPod, containsString("default.replication.factor=1"));
    LOGGER.info("Testing Zookeepers");
    checkReadinessLivenessProbe(namespaceName, zookeeperStatefulSetName(clusterName), "zookeeper", initialDelaySeconds, timeoutSeconds, periodSeconds, successThreshold, failureThreshold);
    checkComponentConfiguration(namespaceName, zookeeperStatefulSetName(clusterName), "zookeeper", "ZOOKEEPER_CONFIGURATION", zookeeperConfig);
    checkSpecificVariablesInContainer(namespaceName, zookeeperStatefulSetName(clusterName), "zookeeper", envVarGeneral);
    LOGGER.info("Checking configuration of TO and UO");
    checkReadinessLivenessProbe(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "topic-operator", initialDelaySeconds, timeoutSeconds, periodSeconds, successThreshold, failureThreshold);
    checkSpecificVariablesInContainer(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "topic-operator", envVarGeneral);
    checkReadinessLivenessProbe(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "user-operator", initialDelaySeconds, timeoutSeconds, periodSeconds, successThreshold, failureThreshold);
    checkSpecificVariablesInContainer(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "user-operator", envVarGeneral);
    checkReadinessLivenessProbe(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "tls-sidecar", initialDelaySeconds, timeoutSeconds, periodSeconds, successThreshold, failureThreshold);
    checkSpecificVariablesInContainer(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "tls-sidecar", envVarGeneral);
    LOGGER.info("Updating configuration of Kafka cluster");
    KafkaResource.replaceKafkaResourceInSpecificNamespace(clusterName, k -> {
        KafkaClusterSpec kafkaClusterSpec = k.getSpec().getKafka();
        kafkaClusterSpec.getLivenessProbe().setInitialDelaySeconds(updatedInitialDelaySeconds);
        kafkaClusterSpec.getReadinessProbe().setInitialDelaySeconds(updatedInitialDelaySeconds);
        kafkaClusterSpec.getLivenessProbe().setTimeoutSeconds(updatedTimeoutSeconds);
        kafkaClusterSpec.getReadinessProbe().setTimeoutSeconds(updatedTimeoutSeconds);
        kafkaClusterSpec.getLivenessProbe().setPeriodSeconds(updatedPeriodSeconds);
        kafkaClusterSpec.getReadinessProbe().setPeriodSeconds(updatedPeriodSeconds);
        kafkaClusterSpec.getLivenessProbe().setFailureThreshold(updatedFailureThreshold);
        kafkaClusterSpec.getReadinessProbe().setFailureThreshold(updatedFailureThreshold);
        kafkaClusterSpec.setConfig(updatedKafkaConfig);
        kafkaClusterSpec.getTemplate().getKafkaContainer().setEnv(StUtils.createContainerEnvVarsFromMap(envVarUpdated));
        ZookeeperClusterSpec zookeeperClusterSpec = k.getSpec().getZookeeper();
        zookeeperClusterSpec.getLivenessProbe().setInitialDelaySeconds(updatedInitialDelaySeconds);
        zookeeperClusterSpec.getReadinessProbe().setInitialDelaySeconds(updatedInitialDelaySeconds);
        zookeeperClusterSpec.getLivenessProbe().setTimeoutSeconds(updatedTimeoutSeconds);
        zookeeperClusterSpec.getReadinessProbe().setTimeoutSeconds(updatedTimeoutSeconds);
        zookeeperClusterSpec.getLivenessProbe().setPeriodSeconds(updatedPeriodSeconds);
        zookeeperClusterSpec.getReadinessProbe().setPeriodSeconds(updatedPeriodSeconds);
        zookeeperClusterSpec.getLivenessProbe().setFailureThreshold(updatedFailureThreshold);
        zookeeperClusterSpec.getReadinessProbe().setFailureThreshold(updatedFailureThreshold);
        zookeeperClusterSpec.setConfig(updatedZookeeperConfig);
        zookeeperClusterSpec.getTemplate().getZookeeperContainer().setEnv(StUtils.createContainerEnvVarsFromMap(envVarUpdated));
        // Configuring TO and UO to use new values for InitialDelaySeconds and TimeoutSeconds
        EntityOperatorSpec entityOperatorSpec = k.getSpec().getEntityOperator();
        entityOperatorSpec.getTopicOperator().getLivenessProbe().setInitialDelaySeconds(updatedInitialDelaySeconds);
        entityOperatorSpec.getTopicOperator().getReadinessProbe().setInitialDelaySeconds(updatedInitialDelaySeconds);
        entityOperatorSpec.getTopicOperator().getLivenessProbe().setTimeoutSeconds(updatedTimeoutSeconds);
        entityOperatorSpec.getTopicOperator().getReadinessProbe().setTimeoutSeconds(updatedTimeoutSeconds);
        entityOperatorSpec.getTopicOperator().getLivenessProbe().setPeriodSeconds(updatedPeriodSeconds);
        entityOperatorSpec.getTopicOperator().getReadinessProbe().setPeriodSeconds(updatedPeriodSeconds);
        entityOperatorSpec.getTopicOperator().getLivenessProbe().setFailureThreshold(updatedFailureThreshold);
        entityOperatorSpec.getTopicOperator().getReadinessProbe().setFailureThreshold(updatedFailureThreshold);
        entityOperatorSpec.getUserOperator().getLivenessProbe().setInitialDelaySeconds(updatedInitialDelaySeconds);
        entityOperatorSpec.getUserOperator().getReadinessProbe().setInitialDelaySeconds(updatedInitialDelaySeconds);
        entityOperatorSpec.getUserOperator().getLivenessProbe().setTimeoutSeconds(updatedTimeoutSeconds);
        entityOperatorSpec.getUserOperator().getReadinessProbe().setTimeoutSeconds(updatedTimeoutSeconds);
        entityOperatorSpec.getUserOperator().getLivenessProbe().setPeriodSeconds(updatedPeriodSeconds);
        entityOperatorSpec.getUserOperator().getReadinessProbe().setPeriodSeconds(updatedPeriodSeconds);
        entityOperatorSpec.getUserOperator().getLivenessProbe().setFailureThreshold(updatedFailureThreshold);
        entityOperatorSpec.getUserOperator().getReadinessProbe().setFailureThreshold(updatedFailureThreshold);
        entityOperatorSpec.getTlsSidecar().getLivenessProbe().setInitialDelaySeconds(updatedInitialDelaySeconds);
        entityOperatorSpec.getTlsSidecar().getReadinessProbe().setInitialDelaySeconds(updatedInitialDelaySeconds);
        entityOperatorSpec.getTlsSidecar().getLivenessProbe().setTimeoutSeconds(updatedTimeoutSeconds);
        entityOperatorSpec.getTlsSidecar().getReadinessProbe().setTimeoutSeconds(updatedTimeoutSeconds);
        entityOperatorSpec.getTlsSidecar().getLivenessProbe().setPeriodSeconds(updatedPeriodSeconds);
        entityOperatorSpec.getTlsSidecar().getReadinessProbe().setPeriodSeconds(updatedPeriodSeconds);
        entityOperatorSpec.getTlsSidecar().getLivenessProbe().setFailureThreshold(updatedFailureThreshold);
        entityOperatorSpec.getTlsSidecar().getReadinessProbe().setFailureThreshold(updatedFailureThreshold);
        entityOperatorSpec.getTemplate().getTopicOperatorContainer().setEnv(StUtils.createContainerEnvVarsFromMap(envVarUpdated));
        entityOperatorSpec.getTemplate().getUserOperatorContainer().setEnv(StUtils.createContainerEnvVarsFromMap(envVarUpdated));
        entityOperatorSpec.getTemplate().getTlsSidecarContainer().setEnv(StUtils.createContainerEnvVarsFromMap(envVarUpdated));
    }, namespaceName);
    RollingUpdateUtils.waitTillComponentHasRolled(namespaceName, zkSelector, 2, zkSnapshot);
    RollingUpdateUtils.waitTillComponentHasRolled(namespaceName, kafkaSelector, 2, kafkaSnapshot);
    DeploymentUtils.waitTillDepHasRolled(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), 1, eoPod);
    KafkaUtils.waitForKafkaReady(namespaceName, clusterName);
    LOGGER.info("Verify values after update");
    checkReadinessLivenessProbe(namespaceName, kafkaStatefulSetName(clusterName), "kafka", updatedInitialDelaySeconds, updatedTimeoutSeconds, updatedPeriodSeconds, successThreshold, updatedFailureThreshold);
    checkKafkaConfiguration(namespaceName, kafkaStatefulSetName(clusterName), updatedKafkaConfig, clusterName);
    checkSpecificVariablesInContainer(namespaceName, kafkaStatefulSetName(clusterName), "kafka", envVarUpdated);
    kafkaConfiguration = kubeClient(namespaceName).getConfigMap(namespaceName, KafkaResources.kafkaMetricsAndLogConfigMapName(clusterName)).getData().get("server.config");
    assertThat(kafkaConfiguration, containsString("offsets.topic.replication.factor=2"));
    assertThat(kafkaConfiguration, containsString("transaction.state.log.replication.factor=2"));
    assertThat(kafkaConfiguration, containsString("default.replication.factor=2"));
    kafkaConfigurationFromPod = cmdKubeClient(namespaceName).execInPod(KafkaResources.kafkaPodName(clusterName, 0), "cat", "/tmp/strimzi.properties").out();
    assertThat(kafkaConfigurationFromPod, containsString("offsets.topic.replication.factor=2"));
    assertThat(kafkaConfigurationFromPod, containsString("transaction.state.log.replication.factor=2"));
    assertThat(kafkaConfigurationFromPod, containsString("default.replication.factor=2"));
    LOGGER.info("Testing Zookeepers");
    checkReadinessLivenessProbe(namespaceName, zookeeperStatefulSetName(clusterName), "zookeeper", updatedInitialDelaySeconds, updatedTimeoutSeconds, updatedPeriodSeconds, successThreshold, updatedFailureThreshold);
    checkComponentConfiguration(namespaceName, zookeeperStatefulSetName(clusterName), "zookeeper", "ZOOKEEPER_CONFIGURATION", updatedZookeeperConfig);
    checkSpecificVariablesInContainer(namespaceName, zookeeperStatefulSetName(clusterName), "zookeeper", envVarUpdated);
    LOGGER.info("Getting entity operator to check configuration of TO and UO");
    checkReadinessLivenessProbe(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "topic-operator", updatedInitialDelaySeconds, updatedTimeoutSeconds, updatedPeriodSeconds, successThreshold, updatedFailureThreshold);
    checkSpecificVariablesInContainer(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "topic-operator", envVarUpdated);
    checkReadinessLivenessProbe(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "user-operator", updatedInitialDelaySeconds, updatedTimeoutSeconds, updatedPeriodSeconds, successThreshold, updatedFailureThreshold);
    checkSpecificVariablesInContainer(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "user-operator", envVarUpdated);
    checkReadinessLivenessProbe(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "tls-sidecar", updatedInitialDelaySeconds, updatedTimeoutSeconds, updatedPeriodSeconds, successThreshold, updatedFailureThreshold);
    checkSpecificVariablesInContainer(namespaceName, KafkaResources.entityOperatorDeploymentName(clusterName), "tls-sidecar", envVarUpdated);
}
Also used : KafkaClusterSpec(io.strimzi.api.kafka.model.KafkaClusterSpec) ZookeeperClusterSpec(io.strimzi.api.kafka.model.ZookeeperClusterSpec) EntityOperatorSpec(io.strimzi.api.kafka.model.EntityOperatorSpec) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) LabelSelector(io.fabric8.kubernetes.api.model.LabelSelector) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.emptyOrNullString(org.hamcrest.Matchers.emptyOrNullString) TestUtils.fromYamlString(io.strimzi.test.TestUtils.fromYamlString) LinkedHashMap(java.util.LinkedHashMap) ParallelNamespaceTest(io.strimzi.systemtest.annotations.ParallelNamespaceTest)

Example 4 with EntityOperatorSpec

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

the class EntityOperatorTest method testFromCrdNoTopicAndUserOperatorInEntityOperator.

@ParallelTest
public void testFromCrdNoTopicAndUserOperatorInEntityOperator() {
    EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().build();
    Kafka resource = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).endSpec().build();
    EntityOperator entityOperator = EntityOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), resource, VERSIONS);
    assertThat(entityOperator.getTopicOperator(), is(nullValue()));
    assertThat(entityOperator.getUserOperator(), is(nullValue()));
}
Also used : EntityOperatorSpec(io.strimzi.api.kafka.model.EntityOperatorSpec) Reconciliation(io.strimzi.operator.common.Reconciliation) Kafka(io.strimzi.api.kafka.model.Kafka) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) EntityOperatorSpecBuilder(io.strimzi.api.kafka.model.EntityOperatorSpecBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 5 with EntityOperatorSpec

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

the class EntityTopicOperatorTest method testFromCrdNoTopicOperatorInEntityOperator.

@ParallelTest
public void testFromCrdNoTopicOperatorInEntityOperator() {
    EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().build();
    Kafka resource = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).endSpec().build();
    EntityTopicOperator entityTopicOperator = EntityTopicOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), resource);
    assertThat(entityTopicOperator, is(nullValue()));
}
Also used : EntityOperatorSpec(io.strimzi.api.kafka.model.EntityOperatorSpec) Reconciliation(io.strimzi.operator.common.Reconciliation) Kafka(io.strimzi.api.kafka.model.Kafka) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) EntityOperatorSpecBuilder(io.strimzi.api.kafka.model.EntityOperatorSpecBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Aggregations

EntityOperatorSpec (io.strimzi.api.kafka.model.EntityOperatorSpec)22 EntityOperatorSpecBuilder (io.strimzi.api.kafka.model.EntityOperatorSpecBuilder)14 Kafka (io.strimzi.api.kafka.model.Kafka)12 KafkaBuilder (io.strimzi.api.kafka.model.KafkaBuilder)12 Reconciliation (io.strimzi.operator.common.Reconciliation)12 ParallelTest (io.strimzi.test.annotations.ParallelTest)12 EntityUserOperatorSpec (io.strimzi.api.kafka.model.EntityUserOperatorSpec)6 EntityUserOperatorSpecBuilder (io.strimzi.api.kafka.model.EntityUserOperatorSpecBuilder)6 EntityTopicOperatorSpec (io.strimzi.api.kafka.model.EntityTopicOperatorSpec)4 EntityTopicOperatorSpecBuilder (io.strimzi.api.kafka.model.EntityTopicOperatorSpecBuilder)4 KafkaClusterSpec (io.strimzi.api.kafka.model.KafkaClusterSpec)4 HashMap (java.util.HashMap)4 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)2 LabelSelector (io.fabric8.kubernetes.api.model.LabelSelector)2 CertificateAuthority (io.strimzi.api.kafka.model.CertificateAuthority)2 TlsSidecar (io.strimzi.api.kafka.model.TlsSidecar)2 ZookeeperClusterSpec (io.strimzi.api.kafka.model.ZookeeperClusterSpec)2 GenericKafkaListener (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListener)2 GenericKafkaListenerBuilder (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder)2 EphemeralStorage (io.strimzi.api.kafka.model.storage.EphemeralStorage)2