Skip to content

Commit

Permalink
chore: Improve queue bootstrapping (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalezzfelipe authored Sep 4, 2024
1 parent a4123e6 commit bc1bfa1
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 27 deletions.
1 change: 1 addition & 0 deletions bootstrap/queue/chart.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ resource "helm_release" "redpanda" {
rpc_username = var.rpc_username
rpc_password = var.rpc_password
daemon_users = var.daemon_users
tolerations = var.tolerations
}
)]

Expand Down
28 changes: 28 additions & 0 deletions bootstrap/queue/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,31 @@ variable "replication" {
type = number
default = null
}

variable "tolerations" {
type = list(object({
effect = string
key = string
operator = string
value = optional(string)
}))
default = [
{
effect = "NoSchedule"
key = "demeter.run/compute-profile"
operator = "Exists"
},
{
effect = "NoSchedule"
key = "demeter.run/compute-arch"
operator = "Exists"
},
{
effect = "NoSchedule"
key = "demeter.run/availability-sla"
operator = "Equal"
value = "consistent"
}

]
}
4 changes: 2 additions & 2 deletions bootstrap/queue/setup.sh.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if ! acl_exists "User:${rpc_username}"; then
rpk $RPK_PARAMS acl user create ${rpc_username} -p '${rpc_password}' --mechanism SCRAM-SHA-256
rpk $RPK_PARAMS acl create \
--allow-principal User:${rpc_username} \
--operation all --topic ${events_topic}
--operation all --topic '${events_topic}'
rpk $RPK_PARAMS acl create \
--allow-principal User:${rpc_username} \
--operation all --group '${rpc_username}-*' --resource-pattern-type prefixed
Expand All @@ -46,7 +46,7 @@ if ! acl_exists "User:${user.name}"; then
rpk $RPK_PARAMS acl user create ${user.name} -p '${user.password}' --mechanism SCRAM-SHA-256
rpk $RPK_PARAMS acl create \
--allow-principal User:${user.name} \
--operation all --topic ${events_topic}
--operation all --topic '${events_topic}'
rpk $RPK_PARAMS acl create \
--allow-principal User:${user.name} \
--operation all --group '${user.consumer_name}-*' --resource-pattern-type prefixed
Expand Down
22 changes: 9 additions & 13 deletions bootstrap/queue/setup_job.tf
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,17 @@ resource "kubernetes_job_v1" "fabric_queue_setup" {
}
}

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"
dynamic "toleration" {
for_each = var.tolerations

content {
effect = toleration.value.effect
key = toleration.value.key
operator = toleration.value.operator
value = toleration.value.value
}
}
}
}
}

}
20 changes: 8 additions & 12 deletions bootstrap/queue/values.yml.tftpl
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
tolerations:
- effect: "NoSchedule"
key: "demeter.run/compute-profile"
operator: "Equal"
value: "general-purpose"
- effect: "NoSchedule"
key: "demeter.run/compute-arch"
operator: "Equal"
value: "x86"
- effect: "NoSchedule"
key: "demeter.run/availability-sla"
operator: "Equal"
value: "consistent"
%{ for toleration in tolerations }
- effect: "${toleration.effect}"
key: "${toleration.key}"
operator: "${toleration.operator}"
%{ if toleration.value != null }
value: "${toleration.value}"
%{ endif }
%{ endfor }

# -- Authentication settings.
# https://docs.redpanda.com/docs/manage/kubernetes/security/sasl-kubernetes/
Expand Down

0 comments on commit bc1bfa1

Please sign in to comment.