@Test public void testFromCrdNoEntityOperator() { Kafka resource = ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout); EntityUserOperator entityUserOperator = EntityUserOperator.fromCrd(resource); assertThat(entityUserOperator, is(nullValue())); }
public static EntityUserOperator fromCrd(Kafka kafkaAssembly) { EntityUserOperator result = null; EntityOperatorSpec entityOperatorSpec = kafkaAssembly.getSpec().getEntityOperator(); if (entityOperatorSpec != null) { EntityUserOperatorSpec userOperatorSpec = entityOperatorSpec.getUserOperator(); if (userOperatorSpec != null) { String namespace = kafkaAssembly.getMetadata().getNamespace(); result = new EntityUserOperator(kafkaAssembly); result.setOwnerReference(kafkaAssembly); String image = userOperatorSpec.getImage(); if (image == null) { image = System.getenv().getOrDefault(ClusterOperatorConfig.STRIMZI_DEFAULT_USER_OPERATOR_IMAGE, "strimzi/operator:latest"); } result.setImage(image); result.setWatchedNamespace(userOperatorSpec.getWatchedNamespace() != null ? userOperatorSpec.getWatchedNamespace() : namespace); result.setReconciliationIntervalMs(userOperatorSpec.getReconciliationIntervalSeconds() * 1_000); result.setZookeeperSessionTimeoutMs(userOperatorSpec.getZookeeperSessionTimeoutSeconds() * 1_000); result.setLogging(userOperatorSpec.getLogging()); result.setGcLoggingEnabled(userOperatorSpec.getJvmOptions() == null ? DEFAULT_JVM_GC_LOGGING_ENABLED : userOperatorSpec.getJvmOptions().isGcLoggingEnabled()); if (userOperatorSpec.getJvmOptions() != null) { result.setJavaSystemProperties(userOperatorSpec.getJvmOptions().getJavaSystemProperties()); } result.setJvmOptions(userOperatorSpec.getJvmOptions()); result.setResources(userOperatorSpec.getResources()); if (userOperatorSpec.getReadinessProbe() != null) { result.setReadinessProbe(userOperatorSpec.getReadinessProbe()); } if (userOperatorSpec.getLivenessProbe() != null) { result.setLivenessProbe(userOperatorSpec.getLivenessProbe()); } if (kafkaAssembly.getSpec().getClientsCa() != null) { if (kafkaAssembly.getSpec().getClientsCa().getValidityDays() > 0) { result.setClientsCaValidityDays(kafkaAssembly.getSpec().getClientsCa().getValidityDays()); } if (kafkaAssembly.getSpec().getClientsCa().getRenewalDays() > 0) { result.setClientsCaRenewalDays(kafkaAssembly.getSpec().getClientsCa().getRenewalDays()); } } } } return result; }
EntityUserOperator extends AbstractModel { public static EntityUserOperator fromCrd(Kafka kafkaAssembly) { EntityUserOperator result = null; EntityOperatorSpec entityOperatorSpec = kafkaAssembly.getSpec().getEntityOperator(); if (entityOperatorSpec != null) { EntityUserOperatorSpec userOperatorSpec = entityOperatorSpec.getUserOperator(); if (userOperatorSpec != null) { String namespace = kafkaAssembly.getMetadata().getNamespace(); result = new EntityUserOperator(kafkaAssembly); result.setOwnerReference(kafkaAssembly); String image = userOperatorSpec.getImage(); if (image == null) { image = System.getenv().getOrDefault(ClusterOperatorConfig.STRIMZI_DEFAULT_USER_OPERATOR_IMAGE, "strimzi/operator:latest"); } result.setImage(image); result.setWatchedNamespace(userOperatorSpec.getWatchedNamespace() != null ? userOperatorSpec.getWatchedNamespace() : namespace); result.setReconciliationIntervalMs(userOperatorSpec.getReconciliationIntervalSeconds() * 1_000); result.setZookeeperSessionTimeoutMs(userOperatorSpec.getZookeeperSessionTimeoutSeconds() * 1_000); result.setLogging(userOperatorSpec.getLogging()); result.setGcLoggingEnabled(userOperatorSpec.getJvmOptions() == null ? DEFAULT_JVM_GC_LOGGING_ENABLED : userOperatorSpec.getJvmOptions().isGcLoggingEnabled()); if (userOperatorSpec.getJvmOptions() != null) { result.setJavaSystemProperties(userOperatorSpec.getJvmOptions().getJavaSystemProperties()); } result.setJvmOptions(userOperatorSpec.getJvmOptions()); result.setResources(userOperatorSpec.getResources()); if (userOperatorSpec.getReadinessProbe() != null) { result.setReadinessProbe(userOperatorSpec.getReadinessProbe()); } if (userOperatorSpec.getLivenessProbe() != null) { result.setLivenessProbe(userOperatorSpec.getLivenessProbe()); } if (kafkaAssembly.getSpec().getClientsCa() != null) { if (kafkaAssembly.getSpec().getClientsCa().getValidityDays() > 0) { result.setClientsCaValidityDays(kafkaAssembly.getSpec().getClientsCa().getValidityDays()); } if (kafkaAssembly.getSpec().getClientsCa().getRenewalDays() > 0) { result.setClientsCaRenewalDays(kafkaAssembly.getSpec().getClientsCa().getRenewalDays()); } } } } return result; } }
EntityUserOperator extends AbstractModel { public static EntityUserOperator fromCrd(Kafka kafkaAssembly) { EntityUserOperator result = null; EntityOperatorSpec entityOperatorSpec = kafkaAssembly.getSpec().getEntityOperator(); if (entityOperatorSpec != null) { EntityUserOperatorSpec userOperatorSpec = entityOperatorSpec.getUserOperator(); if (userOperatorSpec != null) { String namespace = kafkaAssembly.getMetadata().getNamespace(); result = new EntityUserOperator(kafkaAssembly); result.setOwnerReference(kafkaAssembly); String image = userOperatorSpec.getImage(); if (image == null) { image = System.getenv().getOrDefault(ClusterOperatorConfig.STRIMZI_DEFAULT_USER_OPERATOR_IMAGE, "strimzi/operator:latest"); } result.setImage(image); result.setWatchedNamespace(userOperatorSpec.getWatchedNamespace() != null ? userOperatorSpec.getWatchedNamespace() : namespace); result.setReconciliationIntervalMs(userOperatorSpec.getReconciliationIntervalSeconds() * 1_000); result.setZookeeperSessionTimeoutMs(userOperatorSpec.getZookeeperSessionTimeoutSeconds() * 1_000); result.setLogging(userOperatorSpec.getLogging()); result.setGcLoggingEnabled(userOperatorSpec.getJvmOptions() == null ? DEFAULT_JVM_GC_LOGGING_ENABLED : userOperatorSpec.getJvmOptions().isGcLoggingEnabled()); if (userOperatorSpec.getJvmOptions() != null) { result.setJavaSystemProperties(userOperatorSpec.getJvmOptions().getJavaSystemProperties()); } result.setJvmOptions(userOperatorSpec.getJvmOptions()); result.setResources(userOperatorSpec.getResources()); if (userOperatorSpec.getReadinessProbe() != null) { result.setReadinessProbe(userOperatorSpec.getReadinessProbe()); } if (userOperatorSpec.getLivenessProbe() != null) { result.setLivenessProbe(userOperatorSpec.getLivenessProbe()); } if (kafkaAssembly.getSpec().getClientsCa() != null) { if (kafkaAssembly.getSpec().getClientsCa().getValidityDays() > 0) { result.setClientsCaValidityDays(kafkaAssembly.getSpec().getClientsCa().getValidityDays()); } if (kafkaAssembly.getSpec().getClientsCa().getRenewalDays() > 0) { result.setClientsCaRenewalDays(kafkaAssembly.getSpec().getClientsCa().getRenewalDays()); } } } } return result; } protected  EntityUserOperator(HasMetadata resource); }
EntityUserOperator extends AbstractModel { public static EntityUserOperator fromCrd(Kafka kafkaAssembly) { EntityUserOperator result = null; EntityOperatorSpec entityOperatorSpec = kafkaAssembly.getSpec().getEntityOperator(); if (entityOperatorSpec != null) { EntityUserOperatorSpec userOperatorSpec = entityOperatorSpec.getUserOperator(); if (userOperatorSpec != null) { String namespace = kafkaAssembly.getMetadata().getNamespace(); result = new EntityUserOperator(kafkaAssembly); result.setOwnerReference(kafkaAssembly); String image = userOperatorSpec.getImage(); if (image == null) { image = System.getenv().getOrDefault(ClusterOperatorConfig.STRIMZI_DEFAULT_USER_OPERATOR_IMAGE, "strimzi/operator:latest"); } result.setImage(image); result.setWatchedNamespace(userOperatorSpec.getWatchedNamespace() != null ? userOperatorSpec.getWatchedNamespace() : namespace); result.setReconciliationIntervalMs(userOperatorSpec.getReconciliationIntervalSeconds() * 1_000); result.setZookeeperSessionTimeoutMs(userOperatorSpec.getZookeeperSessionTimeoutSeconds() * 1_000); result.setLogging(userOperatorSpec.getLogging()); result.setGcLoggingEnabled(userOperatorSpec.getJvmOptions() == null ? DEFAULT_JVM_GC_LOGGING_ENABLED : userOperatorSpec.getJvmOptions().isGcLoggingEnabled()); if (userOperatorSpec.getJvmOptions() != null) { result.setJavaSystemProperties(userOperatorSpec.getJvmOptions().getJavaSystemProperties()); } result.setJvmOptions(userOperatorSpec.getJvmOptions()); result.setResources(userOperatorSpec.getResources()); if (userOperatorSpec.getReadinessProbe() != null) { result.setReadinessProbe(userOperatorSpec.getReadinessProbe()); } if (userOperatorSpec.getLivenessProbe() != null) { result.setLivenessProbe(userOperatorSpec.getLivenessProbe()); } if (kafkaAssembly.getSpec().getClientsCa() != null) { if (kafkaAssembly.getSpec().getClientsCa().getValidityDays() > 0) { result.setClientsCaValidityDays(kafkaAssembly.getSpec().getClientsCa().getValidityDays()); } if (kafkaAssembly.getSpec().getClientsCa().getRenewalDays() > 0) { result.setClientsCaRenewalDays(kafkaAssembly.getSpec().getClientsCa().getRenewalDays()); } } } } return result; } protected  EntityUserOperator(HasMetadata resource); void setWatchedNamespace(String watchedNamespace); String getWatchedNamespace(); void setReconciliationIntervalMs(long reconciliationIntervalMs); long getReconciliationIntervalMs(); void setClientsCaValidityDays(int clientsCaValidityDays); long getClientsCaValidityDays(); void setClientsCaRenewalDays(int clientsCaRenewalDays); long getClientsCaRenewalDays(); void setZookeeperSessionTimeoutMs(long zookeeperSessionTimeoutMs); long getZookeeperSessionTimeoutMs(); void setZookeeperConnect(String zookeeperConnect); String getZookeeperConnect(); void setKafkaBootstrapServers(String kafkaBootstrapServers); String getKafkaBootstrapServers(); static String userOperatorName(String cluster); static String metricAndLogConfigsName(String cluster); static String roleBindingName(String cluster); @Override String getAncillaryConfigMapKeyLogConfig(); static EntityUserOperator fromCrd(Kafka kafkaAssembly); List<Volume> getVolumes(); RoleBinding generateRoleBinding(String namespace, String watchedNamespace); void setContainerEnvVars(List<ContainerEnvVar> envVars); void setContainerSecurityContext(SecurityContext securityContext); @Override String createLog4jProperties(OrderedProperties properties); }
EntityUserOperator extends AbstractModel { public static EntityUserOperator fromCrd(Kafka kafkaAssembly) { EntityUserOperator result = null; EntityOperatorSpec entityOperatorSpec = kafkaAssembly.getSpec().getEntityOperator(); if (entityOperatorSpec != null) { EntityUserOperatorSpec userOperatorSpec = entityOperatorSpec.getUserOperator(); if (userOperatorSpec != null) { String namespace = kafkaAssembly.getMetadata().getNamespace(); result = new EntityUserOperator(kafkaAssembly); result.setOwnerReference(kafkaAssembly); String image = userOperatorSpec.getImage(); if (image == null) { image = System.getenv().getOrDefault(ClusterOperatorConfig.STRIMZI_DEFAULT_USER_OPERATOR_IMAGE, "strimzi/operator:latest"); } result.setImage(image); result.setWatchedNamespace(userOperatorSpec.getWatchedNamespace() != null ? userOperatorSpec.getWatchedNamespace() : namespace); result.setReconciliationIntervalMs(userOperatorSpec.getReconciliationIntervalSeconds() * 1_000); result.setZookeeperSessionTimeoutMs(userOperatorSpec.getZookeeperSessionTimeoutSeconds() * 1_000); result.setLogging(userOperatorSpec.getLogging()); result.setGcLoggingEnabled(userOperatorSpec.getJvmOptions() == null ? DEFAULT_JVM_GC_LOGGING_ENABLED : userOperatorSpec.getJvmOptions().isGcLoggingEnabled()); if (userOperatorSpec.getJvmOptions() != null) { result.setJavaSystemProperties(userOperatorSpec.getJvmOptions().getJavaSystemProperties()); } result.setJvmOptions(userOperatorSpec.getJvmOptions()); result.setResources(userOperatorSpec.getResources()); if (userOperatorSpec.getReadinessProbe() != null) { result.setReadinessProbe(userOperatorSpec.getReadinessProbe()); } if (userOperatorSpec.getLivenessProbe() != null) { result.setLivenessProbe(userOperatorSpec.getLivenessProbe()); } if (kafkaAssembly.getSpec().getClientsCa() != null) { if (kafkaAssembly.getSpec().getClientsCa().getValidityDays() > 0) { result.setClientsCaValidityDays(kafkaAssembly.getSpec().getClientsCa().getValidityDays()); } if (kafkaAssembly.getSpec().getClientsCa().getRenewalDays() > 0) { result.setClientsCaRenewalDays(kafkaAssembly.getSpec().getClientsCa().getRenewalDays()); } } } } return result; } protected  EntityUserOperator(HasMetadata resource); void setWatchedNamespace(String watchedNamespace); String getWatchedNamespace(); void setReconciliationIntervalMs(long reconciliationIntervalMs); long getReconciliationIntervalMs(); void setClientsCaValidityDays(int clientsCaValidityDays); long getClientsCaValidityDays(); void setClientsCaRenewalDays(int clientsCaRenewalDays); long getClientsCaRenewalDays(); void setZookeeperSessionTimeoutMs(long zookeeperSessionTimeoutMs); long getZookeeperSessionTimeoutMs(); void setZookeeperConnect(String zookeeperConnect); String getZookeeperConnect(); void setKafkaBootstrapServers(String kafkaBootstrapServers); String getKafkaBootstrapServers(); static String userOperatorName(String cluster); static String metricAndLogConfigsName(String cluster); static String roleBindingName(String cluster); @Override String getAncillaryConfigMapKeyLogConfig(); static EntityUserOperator fromCrd(Kafka kafkaAssembly); List<Volume> getVolumes(); RoleBinding generateRoleBinding(String namespace, String watchedNamespace); void setContainerEnvVars(List<ContainerEnvVar> envVars); void setContainerSecurityContext(SecurityContext securityContext); @Override String createLog4jProperties(OrderedProperties properties); static final String ENV_VAR_RESOURCE_LABELS; static final String ENV_VAR_KAFKA_BOOTSTRAP_SERVERS; static final String ENV_VAR_ZOOKEEPER_CONNECT; static final String ENV_VAR_WATCHED_NAMESPACE; static final String ENV_VAR_FULL_RECONCILIATION_INTERVAL_MS; static final String ENV_VAR_ZOOKEEPER_SESSION_TIMEOUT_MS; static final String ENV_VAR_CLIENTS_CA_CERT_SECRET_NAME; static final String ENV_VAR_CLIENTS_CA_KEY_SECRET_NAME; static final String ENV_VAR_CLIENTS_CA_NAMESPACE; static final String ENV_VAR_CLIENTS_CA_VALIDITY; static final String ENV_VAR_CLIENTS_CA_RENEWAL; static final String ENV_VAR_CLUSTER_CA_CERT_SECRET_NAME; static final String ENV_VAR_EO_KEY_SECRET_NAME; static final Probe DEFAULT_HEALTHCHECK_OPTIONS; }