From 29bacd08080691333fb93e8a68e1608ae18bcdde Mon Sep 17 00:00:00 2001 From: gonzalezzfelipe Date: Fri, 19 Jul 2024 01:10:04 -0300 Subject: [PATCH] Readd create topic job --- bootstrap/queue/create_topic_job.tf | 72 +++++++++++++++++++++++++++++ bootstrap/queue/main.tf | 16 ------- 2 files changed, 72 insertions(+), 16 deletions(-) create mode 100644 bootstrap/queue/create_topic_job.tf diff --git a/bootstrap/queue/create_topic_job.tf b/bootstrap/queue/create_topic_job.tf new file mode 100644 index 0000000..73c329b --- /dev/null +++ b/bootstrap/queue/create_topic_job.tf @@ -0,0 +1,72 @@ +locals { + create_topic_job_name = "fabric-queue-create-topic" + brokers = join(",", [ + for i in range(1, var.replicas) : "redpanda-${i}.${var.external_domain}:31092" + ]) +} + +resource "kubernetes_job_v1" "fabric_queue_create_topic" { + depends_on = [helm_release.redpanda] + + metadata { + name = local.create_topic_job_name + namespace = var.namespace + } + spec { + template { + metadata { + labels = { + "demeter.run/instance" = local.create_topic_job_name + } + } + spec { + security_context { + fs_group = 1000 + } + + container { + name = "main" + image = "docker.redpanda.com/redpandadata/redpanda:v23.3.18" + command = [ + "rpk", + "-X", + "brokers=${local.brokers}", + "topic", + "create", + "events", + "-r", "3", + "-c", "cleanup.policy=compact", + "-c", "retention.ms=-1", + ] + image_pull_policy = "Always" + + resources { + limits = { + cpu = "500m" + memory = "512Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + } + + toleration { + effect = "NoSchedule" + key = "demeter.run/compute-profile" + operator = "Equal" + value = "general-purpose" + } + + toleration { + effect = "NoSchedule" + key = "demeter.run/compute-arch" + operator = "Equal" + value = "x86" + } + } + } + } + +} diff --git a/bootstrap/queue/main.tf b/bootstrap/queue/main.tf index 46a4405..051ecb2 100644 --- a/bootstrap/queue/main.tf +++ b/bootstrap/queue/main.tf @@ -1,14 +1,3 @@ -locals { - kafka_internal_port = 9092 - kafka_external_port = 19092 - pandaproxy_internal_port = 8082 - pandaproxy_external_port = 18082 - schema_registry_internal_port = 8081 - schema_registry_external_port = 18081 - rpc_port = 33145 - admin_api_external_port = 19644 -} - variable "namespace" { type = string } @@ -38,11 +27,6 @@ variable "image_tag" { default = "v23.3.18" } -variable "console_image" { - type = string - default = "docker.redpanda.com/redpandadata/console:v2.3.1" -} - variable "resources" { type = object({ cpu = number