KafkaBridgeCluster extends AbstractModel { @Override protected List<EnvVar> getEnvVars() { List<EnvVar> varList = new ArrayList<>(); varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_METRICS_ENABLED, String.valueOf(isMetricsEnabled))); varList.add(buildEnvVar(ENV_VAR_STRIMZI_GC_LOG_ENABLED, String.valueOf(gcLoggingEnabled))); if (javaSystemProperties != null) { varList.add(buildEnvVar(ENV_VAR_STRIMZI_JAVA_SYSTEM_PROPERTIES, ModelUtils.getJavaSystemPropertiesToString(javaSystemProperties))); } varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_BOOTSTRAP_SERVERS, bootstrapServers)); varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_CONSUMER_CONFIG, kafkaBridgeConsumer == null ? "" : new KafkaBridgeConsumerConfiguration(kafkaBridgeConsumer.getConfig().entrySet()).getConfiguration())); varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_PRODUCER_CONFIG, kafkaBridgeProducer == null ? "" : new KafkaBridgeProducerConfiguration(kafkaBridgeProducer.getConfig().entrySet()).getConfiguration())); varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_ID, cluster)); varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_HTTP_ENABLED, String.valueOf(httpEnabled))); varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_HTTP_HOST, KafkaBridgeHttpConfig.HTTP_DEFAULT_HOST)); varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_HTTP_PORT, String.valueOf(http != null ? http.getPort() : KafkaBridgeHttpConfig.HTTP_DEFAULT_PORT))); if (http != null && http.getCors() != null) { varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_CORS_ENABLED, "true")); if (http.getCors().getAllowedOrigins() != null) { varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_CORS_ALLOWED_ORIGINS, String.join(",", http.getCors().getAllowedOrigins()))); } if (http.getCors().getAllowedMethods() != null) { varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_CORS_ALLOWED_METHODS, String.join(",", http.getCors().getAllowedMethods()))); } } else { varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_CORS_ENABLED, "false")); } varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_AMQP_ENABLED, String.valueOf(amqpEnabled))); if (tls != null) { varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_TLS, "true")); List<CertSecretSource> trustedCertificates = tls.getTrustedCertificates(); if (trustedCertificates != null && trustedCertificates.size() > 0) { StringBuilder sb = new StringBuilder(); boolean separator = false; for (CertSecretSource certSecretSource : trustedCertificates) { if (separator) { sb.append(";"); } sb.append(certSecretSource.getSecretName() + "/" + certSecretSource.getCertificate()); separator = true; } varList.add(buildEnvVar(ENV_VAR_KAFKA_BRIDGE_TRUSTED_CERTS, sb.toString())); } } AuthenticationUtils.configureClientAuthenticationEnvVars(authentication, varList, name -> ENV_VAR_PREFIX + name); if (tracing != null) { varList.add(buildEnvVar(ENV_VAR_STRIMZI_TRACING, tracing.getType())); } varList.addAll(getRequiredEnvVars()); addContainerEnvsToExistingEnvs(varList, templateContainerEnvVars); return varList; } protected  KafkaBridgeCluster(HasMetadata resource); static KafkaBridgeCluster fromCrd(KafkaBridge kafkaBridge, KafkaVersion.Lookup versions); Service generateService(); Deployment generateDeployment(Map<String, String> annotations, boolean isOpenShift, ImagePullPolicy imagePullPolicy, List<LocalObjectReference> imagePullSecrets); @Override String getAncillaryConfigMapKeyLogConfig(); PodDisruptionBudget generatePodDisruptionBudget(); KafkaBridgeHttpConfig getHttp(); @Override String createLog4jProperties(OrderedProperties properties); static final String APPLICATION_NAME; static final int DEFAULT_REST_API_PORT; static final Probe DEFAULT_HEALTHCHECK_OPTIONS; }
@Test public void testEnvVars() { assertThat(kbc.getEnvVars(), is(getExpectedEnvVars())); }