Skip to content

Commit

Permalink
refactor: use autoscaler_policy_overrides in examples for aks (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
aweris authored Jun 10, 2024
1 parent 4bec234 commit 97fb27b
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 97 deletions.
79 changes: 47 additions & 32 deletions examples/aks/aks_cluster_arm_template/castai.tf
Original file line number Diff line number Diff line change
Expand Up @@ -106,39 +106,54 @@ module "castai-aks-cluster" {
}
}

// Configure Autoscaler policies as per API specification https://api.cast.ai/v1/spec/#/PoliciesAPI/PoliciesAPIUpsertClusterPolicies.
// Here:
// - unschedulablePods - Unscheduled pods policy
// - nodeDownscaler - Node deletion policy
autoscaler_policies_json = <<-EOT
{
"enabled": true,
"unschedulablePods": {
"enabled": true
},
"nodeDownscaler": {
"enabled": true,
"emptyNodes": {
"enabled": true
},
"evictor": {
"aggressiveMode": false,
"cycleInterval": "5m10s",
"dryRun": false,
"enabled": true,
"nodeGracePeriodMinutes": 10,
"scopedMode": false
}
},
"clusterLimits": {
"cpu": {
"maxCores": 20,
"minCores": 1
},
"enabled": true
}

autoscaler_policy_overrides = {
enabled = true
is_scoped_mode = false
node_templates_partial_matching_enabled = false

unschedulable_pods = {
enabled = true

headroom = {
enabled = true
cpu_percentage = 10
memory_percentage = 10
}

headroom_spot = {
enabled = true
cpu_percentage = 10
memory_percentage = 10
}
}

node_downscaler = {
enabled = true

empty_nodes = {
enabled = true
}

evictor = {
aggressive_mode = false
cycle_interval = "5m10s"
dry_run = false
enabled = true
node_grace_period_minutes = 10
scoped_mode = false
}
}
EOT

cluster_limits = {
enabled = true

cpu = {
max_cores = 20
min_cores = 1
}
}
}

}

Expand Down
79 changes: 46 additions & 33 deletions examples/aks/aks_cluster_autoscaler_policies/castai.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,39 +123,52 @@ module "castai-aks-cluster" {
}
}

// Configure Autoscaler policies as per API specification https://api.cast.ai/v1/spec/#/PoliciesAPI/PoliciesAPIUpsertClusterPolicies.
// Here:
// - unschedulablePods - Unscheduled pods policy
// - nodeDownscaler - Node deletion policy
autoscaler_policies_json = <<-EOT
{
"enabled": true,
"unschedulablePods": {
"enabled": true
},
"nodeDownscaler": {
"enabled": true,
"emptyNodes": {
"enabled": true
},
"evictor": {
"aggressiveMode": false,
"cycleInterval": "5m10s",
"dryRun": false,
"enabled": true,
"nodeGracePeriodMinutes": 10,
"scopedMode": false
}
},
"nodeTemplatesPartialMatchingEnabled": false,
"clusterLimits": {
"cpu": {
"maxCores": 20,
"minCores": 1
},
"enabled": true
}
autoscaler_policy_overrides = {
enabled = true
is_scoped_mode = false
node_templates_partial_matching_enabled = false

unschedulable_pods = {
enabled = true

headroom = {
enabled = true
cpu_percentage = 10
memory_percentage = 10
}

headroom_spot = {
enabled = true
cpu_percentage = 10
memory_percentage = 10
}
}
EOT

node_downscaler = {
enabled = true

empty_nodes = {
enabled = true
}

evictor = {
aggressive_mode = false
cycle_interval = "5m10s"
dry_run = false
enabled = true
node_grace_period_minutes = 10
scoped_mode = false
}
}

cluster_limits = {
enabled = true

cpu = {
max_cores = 20
min_cores = 1
}
}
}

}
78 changes: 46 additions & 32 deletions examples/aks/aks_cluster_existing/castai.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,39 +70,53 @@ module "castai-aks-cluster" {
}
}

// Configure Autoscaler policies as per API specification https://api.cast.ai/v1/spec/#/PoliciesAPI/PoliciesAPIUpsertClusterPolicies.
// Here:
// - unschedulablePods - Unscheduled pods policy
// - nodeDownscaler - Node deletion policy
autoscaler_policies_json = <<-EOT
{
"enabled": true,
"unschedulablePods": {
"enabled": true
},
"nodeDownscaler": {
"enabled": true,
"emptyNodes": {
"enabled": true
},
"evictor": {
"aggressiveMode": false,
"cycleInterval": "5m10s",
"dryRun": false,
"enabled": true,
"nodeGracePeriodMinutes": 5,
"scopedMode": false
}
},
"clusterLimits": {
"cpu": {
"maxCores": 100,
"minCores": 1
},
"enabled": false
}
autoscaler_policy_overrides = {
enabled = true
is_scoped_mode = false
node_templates_partial_matching_enabled = false

unschedulable_pods = {
enabled = true

headroom = {
enabled = true
cpu_percentage = 10
memory_percentage = 10
}

headroom_spot = {
enabled = true
cpu_percentage = 10
memory_percentage = 10
}
}
EOT

node_downscaler = {
enabled = true

empty_nodes = {
enabled = true
}

evictor = {
aggressive_mode = false
cycle_interval = "5m10s"
dry_run = false
enabled = true
node_grace_period_minutes = 10
scoped_mode = false
}
}

cluster_limits = {
enabled = true

cpu = {
max_cores = 20
min_cores = 1
}
}
}

}

Expand Down

0 comments on commit 97fb27b

Please sign in to comment.