From 59d6464799e49c7aa349aecf664fd0229a22c3d5 Mon Sep 17 00:00:00 2001 From: ivanstankovcast <148750907+ivanstankovcast@users.noreply.github.com> Date: Wed, 6 Dec 2023 09:36:28 +0200 Subject: [PATCH] chore: remove spotInstances from examples (#249) * chore: remove spotInstances from examples * generate sdk --- castai/resource_autoscaler_test.go | 53 ------------------- castai/sdk/api.gen.go | 3 ++ e2e/tests/gke_cluster_zonal/main.tf | 22 +++++--- examples/eks/eks_cluster_webshop/main.tf | 25 ++++++--- .../gke_cluster_zonal_autoscaler/castai.tf | 26 ++++++--- 5 files changed, 54 insertions(+), 75 deletions(-) diff --git a/castai/resource_autoscaler_test.go b/castai/resource_autoscaler_test.go index 0f70b726..24324966 100644 --- a/castai/resource_autoscaler_test.go +++ b/castai/resource_autoscaler_test.go @@ -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, @@ -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" - } } }` @@ -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, @@ -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, @@ -261,12 +214,6 @@ func TestAutoscalerResource_PoliciesUpdateAction_Fail(t *testing.T) { "enabled": true, "maxCpuCores": 96 } - }, - "spotInstances": { - "clouds": ["aws"], - "spotBackups": { - "enabled": true - } } }` diff --git a/castai/sdk/api.gen.go b/castai/sdk/api.gen.go index b89402a8..1cfe1a64 100644 --- a/castai/sdk/api.gen.go +++ b/castai/sdk/api.gen.go @@ -672,6 +672,9 @@ type CastaiUsersV1beta1CurrentUserProfileResponse struct { // User first login. FirstLogin *bool `json:"firstLogin,omitempty"` + // HasHubspotContact is true if user has Hubspot contact form submitted. + HasHubspotContact *bool `json:"hasHubspotContact,omitempty"` + // User ID. Id *string `json:"id,omitempty"` diff --git a/e2e/tests/gke_cluster_zonal/main.tf b/e2e/tests/gke_cluster_zonal/main.tf index 4e50412f..58b31161 100644 --- a/e2e/tests/gke_cluster_zonal/main.tf +++ b/e2e/tests/gke_cluster_zonal/main.tf @@ -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 @@ -104,13 +119,6 @@ module "castai-gke-cluster" { "unschedulablePods": { "enabled": true }, - "spotInstances": { - "enabled": true, - "clouds": ["gcp"], - "spotBackups": { - "enabled": true - } - }, "nodeDownscaler": { "emptyNodes": { "enabled": true diff --git a/examples/eks/eks_cluster_webshop/main.tf b/examples/eks/eks_cluster_webshop/main.tf index f9fffd44..d40983ba 100644 --- a/examples/eks/eks_cluster_webshop/main.tf +++ b/examples/eks/eks_cluster_webshop/main.tf @@ -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 @@ -97,13 +115,6 @@ module "castai-eks-cluster" { "unschedulablePods": { "enabled": true }, - "spotInstances": { - "enabled": true, - "clouds": ["aws"], - "spotBackups": { - "enabled": true - } - }, "nodeDownscaler": { "emptyNodes": { "enabled": true diff --git a/examples/gke/gke_cluster_zonal_autoscaler/castai.tf b/examples/gke/gke_cluster_zonal_autoscaler/castai.tf index fb1139e1..dbbe49f6 100644 --- a/examples/gke/gke_cluster_zonal_autoscaler/castai.tf +++ b/examples/gke/gke_cluster_zonal_autoscaler/castai.tf @@ -55,10 +55,27 @@ 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 { @@ -66,13 +83,6 @@ module "castai-gke-cluster" { "unschedulablePods": { "enabled": true }, - "spotInstances": { - "enabled": true, - "clouds": ["gcp"], - "spotBackups": { - "enabled": true - } - }, "nodeDownscaler": { "enabled": true, "emptyNodes": {