Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: compute_plane_defaults for localhost/all-in-one #1210

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module "armonik" {
// If compute plane has no partition data, provides a default
// but always overrides the images
compute_plane = {
for k, v in var.compute_plane : k => merge({
for k, v in local.compute_plane : k => merge({
partition_data = {
priority = 1
reserved_pods = 1
Expand Down
215 changes: 47 additions & 168 deletions infrastructure/quick-deploy/localhost/all-in-one/parameters.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -80,207 +80,86 @@ admin_old_gui = {
}
}

compute_plane_defaults = {
# number of replicas for each deployment of compute plane
replicas = 0
# ArmoniK polling agent
polling_agent = {
limits = {
cpu = "2000m"
memory = "2048Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
# ArmoniK workers
worker = {
limits = {
cpu = "1000m"
memory = "1024Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
hpa = {
type = "prometheus"
polling_interval = 15
cooldown_period = 300
min_replica_count = 0
max_replica_count = 5
behavior = {
restore_to_original_replica_count = true
stabilization_window_seconds = 300
type = "Percent"
value = 100
period_seconds = 15
}
triggers = [
{
type = "prometheus"
threshold = 2
},
]
}
}

# Parameters of the compute plane
compute_plane = {
# Default partition that uses the C# extension for the worker
default = {
# number of replicas for each deployment of compute plane
replicas = 0
# ArmoniK polling agent
polling_agent = {
limits = {
cpu = "2000m"
memory = "2048Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
# ArmoniK workers
worker = [
{
image = "dockerhubaneo/armonik_worker_dll"
limits = {
cpu = "1000m"
memory = "1024Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
]
hpa = {
type = "prometheus"
polling_interval = 15
cooldown_period = 300
min_replica_count = 0
max_replica_count = 5
behavior = {
restore_to_original_replica_count = true
stabilization_window_seconds = 300
type = "Percent"
value = 100
period_seconds = 15
}
triggers = [
{
type = "prometheus"
threshold = 2
},
]
}
},
# Partition for the stream worker
stream = {
# number of replicas for each deployment of compute plane
replicas = 0
# ArmoniK polling agent
polling_agent = {
limits = {
cpu = "2000m"
memory = "2048Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
# ArmoniK workers
worker = [
{
image = "dockerhubaneo/armonik_core_stream_test_worker"
limits = {
cpu = "1000m"
memory = "1024Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
]
hpa = {
type = "prometheus"
polling_interval = 15
cooldown_period = 300
min_replica_count = 0
max_replica_count = 5
behavior = {
restore_to_original_replica_count = true
stabilization_window_seconds = 300
type = "Percent"
value = 100
period_seconds = 15
}
triggers = [
{
type = "prometheus"
threshold = 2
},
]
}
},
# Partition for the htcmock worker
htcmock = {
# number of replicas for each deployment of compute plane
replicas = 0
# ArmoniK polling agent
polling_agent = {
limits = {
cpu = "2000m"
memory = "2048Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
# ArmoniK workers
worker = [
{
image = "dockerhubaneo/armonik_core_htcmock_test_worker"
limits = {
cpu = "1000m"
memory = "1024Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
]
hpa = {
type = "prometheus"
polling_interval = 15
cooldown_period = 300
min_replica_count = 0
max_replica_count = 5
behavior = {
restore_to_original_replica_count = true
stabilization_window_seconds = 300
type = "Percent"
value = 100
period_seconds = 15
}
triggers = [
{
type = "prometheus"
threshold = 2
},
]
}
},
# Partition for the bench worker
bench = {
# number of replicas for each deployment of compute plane
replicas = 0
# ArmoniK polling agent
polling_agent = {
limits = {
cpu = "2000m"
memory = "2048Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
# ArmoniK workers
worker = [
{
image = "dockerhubaneo/armonik_core_bench_test_worker"
limits = {
cpu = "1000m"
memory = "1024Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
]
hpa = {
type = "prometheus"
polling_interval = 15
cooldown_period = 300
min_replica_count = 0
max_replica_count = 5
behavior = {
restore_to_original_replica_count = true
stabilization_window_seconds = 300
type = "Percent"
value = 100
period_seconds = 15
}
triggers = [
{
type = "prometheus"
threshold = 2
},
]
}
},
}

Expand Down
32 changes: 32 additions & 0 deletions infrastructure/quick-deploy/localhost/all-in-one/partitions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
locals {
compute_plane = {
for name, partition in var.compute_plane :
name => {
replicas = try(coalesce(partition.replicas), coalesce(var.compute_plane_defaults.replicas), 1)
termination_grace_period_seconds = try(coalesce(partition.termination_grace_period_seconds), coalesce(var.compute_plane_defaults.termination_grace_period_seconds), 30)
image_pull_secrets = try(coalesce(partition.image_pull_secrets), coalesce(var.compute_plane_defaults.image_pull_secrets), "")
node_selector = try(coalesce(partition.node_selector), coalesce(var.compute_plane_defaults.node_selector), {})
annotations = try(coalesce(partition.annotations), coalesce(var.compute_plane_defaults.annotations), {})
polling_agent = {
image = try(coalesce(partition.polling_agent.image), coalesce(var.compute_plane_defaults.polling_agent.image), "dockerhubaneo/armonik_pollingagent")
tag = try(coalesce(partition.polling_agent.tag), coalesce(var.compute_plane_defaults.polling_agent.tag), null)
image_pull_policy = try(coalesce(partition.polling_agent.image_pull_policy), coalesce(var.compute_plane_defaults.polling_agent.image_pull_policy), "IfNotPresent")
limits = merge(try(coalesce(partition.polling_agent.limits), {}), try(coalesce(var.compute_plane_defaults.polling_agent.limits), {}))
requests = merge(try(coalesce(partition.polling_agent.requests), {}), try(coalesce(var.compute_plane_defaults.polling_agent.requests), {}))
}
worker = [
for i, worker in partition.worker :
{
name = try(coalesce(worker.name), "worker-${i}")
image = try(coalesce(worker.image), coalesce(var.compute_plane_defaults.worker.image))
tag = try(coalesce(worker.tag), coalesce(var.compute_plane_defaults.worker.tag), null)
image_pull_policy = try(coalesce(worker.image_pull_policy), coalesce(var.compute_plane_defaults.worker.image_pull_policy), "IfNotPresent")
limits = merge(try(coalesce(worker.limits), {}), try(coalesce(var.compute_plane_defaults.worker.limits), {}))
requests = merge(try(coalesce(worker.requests), {}), try(coalesce(var.compute_plane_defaults.worker.requests), {}))
}
]
# KEDA scaler
hpa = try(coalesce(partition.hpa), coalesce(var.compute_plane_defaults.hpa), {})
}
}
}
74 changes: 58 additions & 16 deletions infrastructure/quick-deploy/localhost/all-in-one/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -373,18 +373,18 @@ variable "admin_old_gui" {
}

# Parameters of the compute plane
variable "compute_plane" {
variable "compute_plane_defaults" {
description = "Parameters of the compute plane"
type = map(object({
replicas = optional(number, 1)
termination_grace_period_seconds = optional(number, 30)
image_pull_secrets = optional(string, "IfNotPresent")
node_selector = optional(any, {})
annotations = optional(any, {})
polling_agent = object({
image = optional(string, "dockerhubaneo/armonik_pollingagent")
type = object({
replicas = optional(number)
termination_grace_period_seconds = optional(number)
image_pull_secrets = optional(string)
node_selector = optional(any)
annotations = optional(any)
polling_agent = optional(object({
image = optional(string)
tag = optional(string)
image_pull_policy = optional(string, "IfNotPresent")
image_pull_policy = optional(string)
limits = optional(object({
cpu = optional(string)
memory = optional(string)
Expand All @@ -393,12 +393,12 @@ variable "compute_plane" {
cpu = optional(string)
memory = optional(string)
}))
})
worker = list(object({
name = optional(string, "worker")
image = string
}))
worker = optional(object({
name = optional(string)
image = optional(string)
tag = optional(string)
image_pull_policy = optional(string, "IfNotPresent")
image_pull_policy = optional(string)
limits = optional(object({
cpu = optional(string)
memory = optional(string)
Expand All @@ -410,7 +410,49 @@ variable "compute_plane" {
}))
# KEDA scaler
hpa = optional(any)
}))
})
default = {}
}
# Parameters of the compute plane
variable "compute_plane" {
description = "Parameters of the compute plane"
type = any
# type = map(object({
# replicas = optional(number)
# termination_grace_period_seconds = optional(number)
# image_pull_secrets = optional(string)
# node_selector = optional(any)
# annotations = optional(any)
# polling_agent = optional(object({
# image = optional(string)
# tag = optional(string)
# image_pull_policy = optional(string)
# limits = optional(object({
# cpu = optional(string)
# memory = optional(string)
# }))
# requests = optional(object({
# cpu = optional(string)
# memory = optional(string)
# }))
# }))
# worker = optional(list(object({
# name = optional(string)
# image = optional(string)
# tag = optional(string)
# image_pull_policy = optional(string)
# limits = optional(object({
# cpu = optional(string)
# memory = optional(string)
# }))
# requests = optional(object({
# cpu = optional(string)
# memory = optional(string)
# }))
# })))
# # KEDA scaler
# hpa = optional(any)
# }))
}

variable "ingress" {
Expand Down
Loading