use of io.fabric8.kubernetes.api.model.batch.v1.JobBuilder in project strimzi by strimzi.
the class KafkaClients method defaultProducerStrimzi.
public JobBuilder defaultProducerStrimzi() {
if (producerName == null || producerName.isEmpty()) {
throw new InvalidParameterException("Producer name is not set.");
}
Map<String, String> producerLabels = new HashMap<>();
producerLabels.put("app", producerName);
producerLabels.put(Constants.KAFKA_CLIENTS_LABEL_KEY, Constants.KAFKA_CLIENTS_LABEL_VALUE);
PodSpecBuilder podSpecBuilder = new PodSpecBuilder();
if (Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET != null && !Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET.isEmpty()) {
List<LocalObjectReference> imagePullSecrets = Collections.singletonList(new LocalObjectReference(Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET));
podSpecBuilder.withImagePullSecrets(imagePullSecrets);
}
return new JobBuilder().withNewMetadata().withNamespace(this.getNamespaceName()).withLabels(producerLabels).withName(producerName).endMetadata().withNewSpec().withBackoffLimit(0).withNewTemplate().withNewMetadata().withName(producerName).withNamespace(this.getNamespaceName()).withLabels(producerLabels).endMetadata().withNewSpecLike(podSpecBuilder.build()).withRestartPolicy("Never").withContainers().addNewContainer().withName(producerName).withImagePullPolicy(Constants.IF_NOT_PRESENT_IMAGE_PULL_POLICY).withImage(Environment.TEST_PRODUCER_IMAGE).addNewEnv().withName("BOOTSTRAP_SERVERS").withValue(this.getBootstrapAddress()).endEnv().addNewEnv().withName("TOPIC").withValue(this.getTopicName()).endEnv().addNewEnv().withName("DELAY_MS").withValue(String.valueOf(delayMs)).endEnv().addNewEnv().withName("LOG_LEVEL").withValue("DEBUG").endEnv().addNewEnv().withName("MESSAGE_COUNT").withValue(String.valueOf(messageCount)).endEnv().addNewEnv().withName("MESSAGE").withValue(message).endEnv().addNewEnv().withName("PRODUCER_ACKS").withValue("all").endEnv().addNewEnv().withName("ADDITIONAL_CONFIG").withValue(this.getAdditionalConfig()).endEnv().addNewEnv().withName("BLOCKING_PRODUCER").withValue("true").endEnv().endContainer().endSpec().endTemplate().endSpec();
}
use of io.fabric8.kubernetes.api.model.batch.v1.JobBuilder in project strimzi by strimzi.
the class KafkaTracingClients method kafkaStreamsWithTracing.
public Job kafkaStreamsWithTracing() {
String kafkaStreamsName = "hello-world-streams";
Map<String, String> kafkaStreamLabels = new HashMap<>();
kafkaStreamLabels.put("app", kafkaStreamsName);
PodSpecBuilder podSpecBuilder = new PodSpecBuilder();
if (Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET != null && !Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET.isEmpty()) {
List<LocalObjectReference> imagePullSecrets = Collections.singletonList(new LocalObjectReference(Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET));
podSpecBuilder.withImagePullSecrets(imagePullSecrets);
}
return new JobBuilder().withNewMetadata().withNamespace(ResourceManager.kubeClient().getNamespace()).withLabels(kafkaStreamLabels).withName(kafkaStreamsName).endMetadata().withNewSpec().withBackoffLimit(0).withNewTemplate().withNewMetadata().withLabels(kafkaStreamLabels).endMetadata().withNewSpecLike(podSpecBuilder.build()).withRestartPolicy("Never").withContainers().addNewContainer().withName(kafkaStreamsName).withImage(Environment.TEST_STREAMS_IMAGE).addNewEnv().withName("BOOTSTRAP_SERVERS").withValue(this.getBootstrapAddress()).endEnv().addNewEnv().withName("APPLICATION_ID").withValue(kafkaStreamsName).endEnv().addNewEnv().withName("SOURCE_TOPIC").withValue(this.getTopicName()).endEnv().addNewEnv().withName("TARGET_TOPIC").withValue(streamsTopicTargetName).endEnv().addNewEnv().withName("LOG_LEVEL").withValue("DEBUG").endEnv().addNewEnv().withName("JAEGER_SERVICE_NAME").withValue(jaegerServiceStreamsName).endEnv().addNewEnv().withName("JAEGER_AGENT_HOST").withValue(jaegerServerAgentName).endEnv().addNewEnv().withName("JAEGER_SAMPLER_TYPE").withValue(JAEGER_SAMPLER_TYPE).endEnv().addNewEnv().withName("JAEGER_SAMPLER_PARAM").withValue(JAEGER_SAMPLER_PARAM).endEnv().endContainer().endSpec().endTemplate().endSpec().build();
}
use of io.fabric8.kubernetes.api.model.batch.v1.JobBuilder in project strimzi-kafka-operator by strimzi.
the class KafkaAdminClients method defaultAdmin.
public Job defaultAdmin() {
Map<String, String> adminLabels = new HashMap<>();
adminLabels.put("app", adminName);
adminLabels.put(Constants.KAFKA_ADMIN_CLIENT_LABEL_KEY, Constants.KAFKA_ADMIN_CLIENT_LABEL_VALUE);
PodSpecBuilder podSpecBuilder = new PodSpecBuilder();
if (Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET != null && !Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET.isEmpty()) {
List<LocalObjectReference> imagePullSecrets = Collections.singletonList(new LocalObjectReference(Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET));
podSpecBuilder.withImagePullSecrets(imagePullSecrets);
}
return new JobBuilder().withNewMetadata().withNamespace(this.getNamespaceName()).withLabels(adminLabels).withName(adminName).endMetadata().withNewSpec().withBackoffLimit(0).withNewTemplate().withNewMetadata().withName(adminName).withNamespace(this.getNamespaceName()).withLabels(adminLabels).endMetadata().withNewSpecLike(podSpecBuilder.build()).withRestartPolicy("Never").withContainers().addNewContainer().withName(adminName).withImagePullPolicy(Constants.IF_NOT_PRESENT_IMAGE_PULL_POLICY).withImage(Environment.TEST_ADMIN_IMAGE).addNewEnv().withName("BOOTSTRAP_SERVERS").withValue(this.getBootstrapAddress()).endEnv().addNewEnv().withName("TOPIC").withValue(this.getTopicName()).endEnv().addNewEnv().withName("TOPIC_OPERATION").withValue(topicOperation).endEnv().addNewEnv().withName("REPLICATION_FACTOR").withValue(String.valueOf(replicationFactor)).endEnv().addNewEnv().withName("PARTITIONS").withValue(String.valueOf(partitions)).endEnv().addNewEnv().withName("TOPICS_COUNT").withValue(String.valueOf(topicCount)).endEnv().addNewEnv().withName("TOPIC_OFFSET").withValue(String.valueOf(topicOffset)).endEnv().addNewEnv().withName("LOG_LEVEL").withValue("DEBUG").endEnv().addNewEnv().withName("ADDITIONAL_CONFIG").withValue(this.getAdditionalConfig()).endEnv().endContainer().endSpec().endTemplate().endSpec().build();
}
use of io.fabric8.kubernetes.api.model.batch.v1.JobBuilder in project strimzi-kafka-operator by strimzi.
the class BridgeClients method consumerStrimziBridge.
public Job consumerStrimziBridge() {
Map<String, String> consumerLabels = new HashMap<>();
consumerLabels.put("app", this.getConsumerName());
consumerLabels.put(Constants.KAFKA_CLIENTS_LABEL_KEY, Constants.KAFKA_BRIDGE_CLIENTS_LABEL_VALUE);
PodSpecBuilder podSpecBuilder = new PodSpecBuilder();
if (Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET != null && !Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET.isEmpty()) {
List<LocalObjectReference> imagePullSecrets = Collections.singletonList(new LocalObjectReference(Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET));
podSpecBuilder.withImagePullSecrets(imagePullSecrets);
}
return new JobBuilder().withNewMetadata().withNamespace(this.getNamespaceName()).withLabels(consumerLabels).withName(this.getConsumerName()).endMetadata().withNewSpec().withBackoffLimit(0).withNewTemplate().withNewMetadata().withLabels(consumerLabels).endMetadata().withNewSpecLike(podSpecBuilder.build()).withRestartPolicy("OnFailure").addNewContainer().withName(this.getConsumerName()).withImagePullPolicy(Constants.IF_NOT_PRESENT_IMAGE_PULL_POLICY).withImage(Environment.TEST_HTTP_CONSUMER_IMAGE).addNewEnv().withName("HOSTNAME").withValue(this.getBootstrapAddress()).endEnv().addNewEnv().withName("PORT").withValue(Integer.toString(port)).endEnv().addNewEnv().withName("TOPIC").withValue(this.getTopicName()).endEnv().addNewEnv().withName("POLL_INTERVAL").withValue(Integer.toString(pollInterval)).endEnv().addNewEnv().withName("MESSAGE_COUNT").withValue(Integer.toString(this.getMessageCount())).endEnv().addNewEnv().withName("GROUP_ID").withValue(this.getConsumerGroup()).endEnv().endContainer().endSpec().endTemplate().endSpec().build();
}
use of io.fabric8.kubernetes.api.model.batch.v1.JobBuilder in project strimzi-kafka-operator by strimzi.
the class BridgeClients method producerStrimziBridge.
public Job producerStrimziBridge() {
Map<String, String> producerLabels = new HashMap<>();
producerLabels.put("app", this.getProducerName());
producerLabels.put(Constants.KAFKA_CLIENTS_LABEL_KEY, Constants.KAFKA_BRIDGE_CLIENTS_LABEL_VALUE);
PodSpecBuilder podSpecBuilder = new PodSpecBuilder();
if (Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET != null && !Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET.isEmpty()) {
List<LocalObjectReference> imagePullSecrets = Collections.singletonList(new LocalObjectReference(Environment.SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET));
podSpecBuilder.withImagePullSecrets(imagePullSecrets);
}
return new JobBuilder().withNewMetadata().withNamespace(this.getNamespaceName()).withLabels(producerLabels).withName(this.getProducerName()).endMetadata().withNewSpec().withBackoffLimit(0).withNewTemplate().withNewMetadata().withLabels(producerLabels).endMetadata().withNewSpecLike(podSpecBuilder.build()).withRestartPolicy("OnFailure").addNewContainer().withName(this.getProducerName()).withImagePullPolicy(Constants.IF_NOT_PRESENT_IMAGE_PULL_POLICY).withImage(Environment.TEST_HTTP_PRODUCER_IMAGE).addNewEnv().withName("HOSTNAME").withValue(this.getBootstrapAddress()).endEnv().addNewEnv().withName("PORT").withValue(Integer.toString(port)).endEnv().addNewEnv().withName("TOPIC").withValue(this.getTopicName()).endEnv().addNewEnv().withName("DELAY_MS").withValue(String.valueOf(this.getDelayMs())).endEnv().addNewEnv().withName("MESSAGE_COUNT").withValue(Integer.toString(this.getMessageCount())).endEnv().endContainer().endSpec().endTemplate().endSpec().build();
}
Aggregations