use of io.strimzi.api.kafka.model.connect.ExternalConfigurationEnvVarSource in project strimzi by strimzi.
the class KafkaConnectCluster method getExternalConfigurationEnvVars.
private List<EnvVar> getExternalConfigurationEnvVars() {
List<EnvVar> varList = new ArrayList<>();
for (ExternalConfigurationEnv var : externalEnvs) {
String name = var.getName();
if (name != null && !name.startsWith("KAFKA_") && !name.startsWith("STRIMZI_")) {
ExternalConfigurationEnvVarSource valueFrom = var.getValueFrom();
if (valueFrom != null) {
if (valueFrom.getConfigMapKeyRef() != null && valueFrom.getSecretKeyRef() != null) {
LOGGER.warnCr(reconciliation, "Environment variable {} with external Kafka Connect configuration has to contain exactly one reference to either ConfigMap or Secret", name);
} else {
if (valueFrom.getConfigMapKeyRef() != null) {
EnvVarSource envVarSource = new EnvVarSourceBuilder().withConfigMapKeyRef(var.getValueFrom().getConfigMapKeyRef()).build();
varList.add(new EnvVarBuilder().withName(name).withValueFrom(envVarSource).build());
} else if (valueFrom.getSecretKeyRef() != null) {
EnvVarSource envVarSource = new EnvVarSourceBuilder().withSecretKeyRef(var.getValueFrom().getSecretKeyRef()).build();
varList.add(new EnvVarBuilder().withName(name).withValueFrom(envVarSource).build());
}
}
}
} else {
LOGGER.warnCr(reconciliation, "Name of an environment variable with external Kafka Connect configuration cannot start with `KAFKA_` or `STRIMZI`.");
}
}
return varList;
}
use of io.strimzi.api.kafka.model.connect.ExternalConfigurationEnvVarSource in project strimzi-kafka-operator by strimzi.
the class KafkaConnectCluster method getExternalConfigurationEnvVars.
private List<EnvVar> getExternalConfigurationEnvVars() {
List<EnvVar> varList = new ArrayList<>();
for (ExternalConfigurationEnv var : externalEnvs) {
String name = var.getName();
if (name != null && !name.startsWith("KAFKA_") && !name.startsWith("STRIMZI_")) {
ExternalConfigurationEnvVarSource valueFrom = var.getValueFrom();
if (valueFrom != null) {
if (valueFrom.getConfigMapKeyRef() != null && valueFrom.getSecretKeyRef() != null) {
LOGGER.warnCr(reconciliation, "Environment variable {} with external Kafka Connect configuration has to contain exactly one reference to either ConfigMap or Secret", name);
} else {
if (valueFrom.getConfigMapKeyRef() != null) {
EnvVarSource envVarSource = new EnvVarSourceBuilder().withConfigMapKeyRef(var.getValueFrom().getConfigMapKeyRef()).build();
varList.add(new EnvVarBuilder().withName(name).withValueFrom(envVarSource).build());
} else if (valueFrom.getSecretKeyRef() != null) {
EnvVarSource envVarSource = new EnvVarSourceBuilder().withSecretKeyRef(var.getValueFrom().getSecretKeyRef()).build();
varList.add(new EnvVarBuilder().withName(name).withValueFrom(envVarSource).build());
}
}
}
} else {
LOGGER.warnCr(reconciliation, "Name of an environment variable with external Kafka Connect configuration cannot start with `KAFKA_` or `STRIMZI`.");
}
}
return varList;
}
Aggregations