Search in sources :

Example 6 with EntityOperatorSpecBuilder

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

the class EntityTopicOperatorTest method testWatchedNamespace.

@ParallelTest
public void testWatchedNamespace() {
    EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().withNewTopicOperator().withWatchedNamespace("some-other-namespace").endTopicOperator().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.watchedNamespace(), is("some-other-namespace"));
}
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 7 with EntityOperatorSpecBuilder

use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder 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, true);
    assertThat(entityUserOperator.watchedNamespace(), is(namespace));
    assertThat(entityUserOperator.getImage(), is("quay.io/strimzi/operator:latest"));
    assertThat(entityUserOperator.reconciliationIntervalMs, 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.kafkaBootstrapServers, is(KafkaResources.bootstrapServiceName(cluster) + ":" + EntityUserOperatorSpec.DEFAULT_BOOTSTRAP_SERVERS_PORT));
    assertThat(entityUserOperator.getLogging(), is(nullValue()));
    assertThat(entityUserOperator.secretPrefix, 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 8 with EntityOperatorSpecBuilder

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

the class EntityUserOperatorTest method testWatchedNamespace.

@ParallelTest
public void testWatchedNamespace() {
    EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().withNewUserOperator().withWatchedNamespace("some-other-namespace").endUserOperator().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, true);
    assertThat(entityUserOperator.watchedNamespace(), is("some-other-namespace"));
}
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 9 with EntityOperatorSpecBuilder

use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder 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, true);
    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, true);
    assertThat(entityUserOperator.clientsCaValidityDays, is(42));
    assertThat(entityUserOperator.clientsCaRenewalDays, is(69));
    assertThat(entityUserOperator2.clientsCaValidityDays, is(CertificateAuthority.DEFAULT_CERTS_VALIDITY_DAYS));
    assertThat(entityUserOperator2.clientsCaRenewalDays, is(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 10 with EntityOperatorSpecBuilder

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

the class KRaftUtilsTest method testEnabledOnlyUserOperator.

@ParallelTest
public void testEnabledOnlyUserOperator() {
    Set<String> errors = new HashSet<>(0);
    EntityOperatorSpec eo = new EntityOperatorSpecBuilder().withNewUserOperator().endUserOperator().build();
    KRaftUtils.validateEntityOperatorSpec(errors, eo);
    assertThat(errors, is(Collections.emptySet()));
}
Also used : EntityOperatorSpec(io.strimzi.api.kafka.model.EntityOperatorSpec) EntityOperatorSpecBuilder(io.strimzi.api.kafka.model.EntityOperatorSpecBuilder) HashSet(java.util.HashSet) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Aggregations

EntityOperatorSpecBuilder (io.strimzi.api.kafka.model.EntityOperatorSpecBuilder)35 EntityOperatorSpec (io.strimzi.api.kafka.model.EntityOperatorSpec)32 ParallelTest (io.strimzi.test.annotations.ParallelTest)30 Kafka (io.strimzi.api.kafka.model.Kafka)24 KafkaBuilder (io.strimzi.api.kafka.model.KafkaBuilder)24 Reconciliation (io.strimzi.operator.common.Reconciliation)24 EntityUserOperatorSpecBuilder (io.strimzi.api.kafka.model.EntityUserOperatorSpecBuilder)6 HashSet (java.util.HashSet)6 EntityUserOperatorSpec (io.strimzi.api.kafka.model.EntityUserOperatorSpec)5 EntityTopicOperatorSpecBuilder (io.strimzi.api.kafka.model.EntityTopicOperatorSpecBuilder)4 EntityTopicOperatorSpec (io.strimzi.api.kafka.model.EntityTopicOperatorSpec)3 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)2 PersistentVolumeClaim (io.fabric8.kubernetes.api.model.PersistentVolumeClaim)2 CertificateAuthority (io.strimzi.api.kafka.model.CertificateAuthority)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 PersistentClaimStorageBuilder (io.strimzi.api.kafka.model.storage.PersistentClaimStorageBuilder)2 SingleVolumeStorage (io.strimzi.api.kafka.model.storage.SingleVolumeStorage)2 IsolatedTest (io.strimzi.systemtest.annotations.IsolatedTest)2