Skip to content

Commit

Permalink
chore: remove spotInstances from examples (#249)
Browse files Browse the repository at this point in the history
* chore: remove spotInstances from examples

* generate sdk
  • Loading branch information
ivanstankovcast authored Dec 6, 2023
1 parent 4473c7d commit 59d6464
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 75 deletions.
53 changes: 0 additions & 53 deletions castai/resource_autoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ func TestAutoscalerResource_PoliciesUpdateAction(t *testing.T) {
"maxCores": 20
}
},
"spotInstances": {
"enabled": true,
"clouds": [
"azure"
],
"maxReclaimRate": 0,
"spotBackups": {
"enabled": false,
"spotBackupRestoreRateSeconds": 1800
}
},
"nodeDownscaler": {
"emptyNodes": {
"enabled": false,
Expand All @@ -84,16 +73,6 @@ func TestAutoscalerResource_PoliciesUpdateAction(t *testing.T) {
"enabled": true,
"maxCpuCores": 96
}
},
"spotInstances": {
"clouds": ["aws"],
"spotBackups": {
"enabled": true
},
"spotInterruptionPredictions": {
"enabled": true,
"type": "AWSRebalanceRecommendations"
}
}
}`

Expand Down Expand Up @@ -129,21 +108,6 @@ func TestAutoscalerResource_PoliciesUpdateAction(t *testing.T) {
"maxCores": 20
}
},
"spotInstances": {
"enabled": true,
"clouds": [
"aws"
],
"maxReclaimRate": 0,
"spotBackups": {
"enabled": true,
"spotBackupRestoreRateSeconds": 1800
},
"spotInterruptionPredictions": {
"enabled": true,
"type": "AWSRebalanceRecommendations"
}
},
"nodeDownscaler": {
"emptyNodes": {
"enabled": false,
Expand Down Expand Up @@ -235,17 +199,6 @@ func TestAutoscalerResource_PoliciesUpdateAction_Fail(t *testing.T) {
"maxCores": 20
}
},
"spotInstances": {
"enabled": true,
"clouds": [
"azure"
],
"maxReclaimRate": 0,
"spotBackups": {
"enabled": false,
"spotBackupRestoreRateSeconds": 1800
}
},
"nodeDownscaler": {
"emptyNodes": {
"enabled": false,
Expand All @@ -261,12 +214,6 @@ func TestAutoscalerResource_PoliciesUpdateAction_Fail(t *testing.T) {
"enabled": true,
"maxCpuCores": 96
}
},
"spotInstances": {
"clouds": ["aws"],
"spotBackups": {
"enabled": true
}
}
}`

Expand Down
3 changes: 3 additions & 0 deletions castai/sdk/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 15 additions & 7 deletions e2e/tests/gke_cluster_zonal/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ module "castai-gke-cluster" {
}

node_templates = {
default_by_castai = {
name = "default-by-castai"
configuration_id = module.castai-gke-cluster.castai_node_configurations["default"]
is_default = true
should_taint = false

constraints = {
on_demand = true
spot = true
use_spot_fallbacks = true

enable_spot_diversity = false
spot_diversity_price_increase_limit_percent = 20
}
}
spot_tmpl = {
configuration_id = module.castai-gke-cluster.castai_node_configurations["default"]
should_taint = true
Expand Down Expand Up @@ -104,13 +119,6 @@ module "castai-gke-cluster" {
"unschedulablePods": {
"enabled": true
},
"spotInstances": {
"enabled": true,
"clouds": ["gcp"],
"spotBackups": {
"enabled": true
}
},
"nodeDownscaler": {
"emptyNodes": {
"enabled": true
Expand Down
25 changes: 18 additions & 7 deletions examples/eks/eks_cluster_webshop/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,24 @@ module "castai-eks-cluster" {
}
}

node_templates = {
default_by_castai = {
name = "default-by-castai"
configuration_id = module.castai-eks-cluster.castai_node_configurations["default"]
is_default = true
should_taint = false

constraints = {
on_demand = true
spot = true
use_spot_fallbacks = true

enable_spot_diversity = false
spot_diversity_price_increase_limit_percent = 20
}
}
}

delete_nodes_on_disconnect = var.delete_nodes_on_disconnect

# Full schema can be found here https://api.cast.ai/v1/spec/#/PoliciesAPI/PoliciesAPIUpsertClusterPolicies
Expand All @@ -97,13 +115,6 @@ module "castai-eks-cluster" {
"unschedulablePods": {
"enabled": true
},
"spotInstances": {
"enabled": true,
"clouds": ["aws"],
"spotBackups": {
"enabled": true
}
},
"nodeDownscaler": {
"emptyNodes": {
"enabled": true
Expand Down
26 changes: 18 additions & 8 deletions examples/gke/gke_cluster_zonal_autoscaler/castai.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,34 @@ module "castai-gke-cluster" {

}

node_templates = {
default_by_castai = {
name = "default-by-castai"
configuration_id = module.castai-gke-cluster.castai_node_configurations["default"]
is_default = true
should_taint = false

constraints = {
on_demand = true
spot = true
use_spot_fallbacks = true

enable_spot_diversity = false
spot_diversity_price_increase_limit_percent = 20
}
}
}

// Configure Autoscaler policies as per API specification https://api.cast.ai/v1/spec/#/PoliciesAPI/PoliciesAPIUpsertClusterPolicies.
// Here:
// - unschedulablePods - Unscheduled pods policy
// - spotInstances - Spot instances configuration
// - nodeDownscaler - Node deletion policy
autoscaler_policies_json = <<-EOT
{
"enabled": true,
"unschedulablePods": {
"enabled": true
},
"spotInstances": {
"enabled": true,
"clouds": ["gcp"],
"spotBackups": {
"enabled": true
}
},
"nodeDownscaler": {
"enabled": true,
"emptyNodes": {
Expand Down

0 comments on commit 59d6464

Please sign in to comment.