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

chore: remove spotInstances from examples #249

Merged
merged 2 commits into from
Dec 6, 2023
Merged
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
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
Loading