-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add description for resources & examples for resources/datasources
- Loading branch information
1 parent
43426b4
commit 309fd51
Showing
13 changed files
with
215 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
data "castai_eks_settings" "current" { | ||
account_id = data.aws_caller_identity.current.account_id | ||
region = var.cluster_region | ||
cluster = var.cluster_name | ||
vpc = var.vpc | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
data "castai_gke_user_policies" "gke" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "castai_organization" "dev" { | ||
name = var.castai_dev_organization_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
resource "castai_autoscaler" "castai_autoscaler_policy" { | ||
cluster_id = castai_eks_cluster.castai_cluster.id | ||
|
||
autoscaler_policies_json = var.autoscaler_policies_json | ||
|
||
autoscaler_settings { | ||
enabled = true | ||
is_scoped_mode = false | ||
node_templates_partial_matching_enabled = false | ||
|
||
unschedulable_pods { | ||
enabled = true | ||
custom_instances_enabled = false | ||
|
||
headroom { | ||
enabled = true | ||
cpu_percentage = 20 | ||
memory_percentage = 30 | ||
} | ||
|
||
headroom_spot { | ||
enabled = true | ||
cpu_percentage = 15 | ||
memory_percentage = 25 | ||
} | ||
|
||
node_constraints { | ||
enabled = true | ||
min_cpu_cores = 2 | ||
max_cpu_cores = 8 | ||
min_ram_mib = 2048 | ||
max_ram_mib = 8192 | ||
} | ||
} | ||
|
||
cluster_limits { | ||
enabled = true | ||
|
||
cpu { | ||
min_cores = 1 | ||
max_cores = 10 | ||
} | ||
} | ||
|
||
spot_instances { | ||
enabled = true | ||
max_reclaim_rate = 50 | ||
spot_diversity_enabled = true | ||
spot_diversity_price_increase_limit = 20 | ||
|
||
spot_backups { | ||
enabled = true | ||
spot_backup_restore_rate_seconds = 300 | ||
} | ||
|
||
spot_interruption_predictions { | ||
enabled = true | ||
spot_interruption_predictions_type = "history" | ||
} | ||
} | ||
|
||
node_downscaler { | ||
enabled = true | ||
|
||
empty_nodes { | ||
enabled = true | ||
delay_seconds = 60 | ||
} | ||
|
||
evictor { | ||
enabled = true | ||
dry_run = false | ||
aggressive_mode = false | ||
scoped_mode = false | ||
cycle_interval = 300 | ||
node_grace_period_minutes = 10 | ||
pod_eviction_failure_back_off_interval = 30 | ||
ignore_pod_disruption_budgets = false | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resource "castai_eks_clusterid" "cluster_id" { | ||
account_id = data.aws_caller_identity.current.account_id | ||
region = var.cluster_region | ||
cluster_name = var.cluster_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resource "castai_eks_user_arn" "castai_user_arn" { | ||
cluster_id = castai_eks_clusterid.cluster_id.id | ||
} |
25 changes: 25 additions & 0 deletions
25
examples/resources/castai_evictor_advanced_config/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
resource "evictor_advanced_config" "config" { | ||
evictor_advanced_config = [ | ||
{ | ||
pod_selector = { | ||
kind = "Job" | ||
namespace = "castai" | ||
match_labels = { | ||
"app.kubernetes.io/name" = "castai-node" | ||
} | ||
}, | ||
aggressive = true | ||
}, | ||
{ | ||
node_selector = { | ||
match_expressions = [ | ||
{ | ||
key = "pod.cast.ai/flag" | ||
operator = "Exists" | ||
} | ||
] | ||
}, | ||
disposable = true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
resource "castai_node_template" "this" { | ||
cluster_id = castai_eks_cluster.castai_cluster.id | ||
|
||
name = "my-node-template" | ||
is_default = false | ||
is_enabled = true | ||
configuration_id = "config-id-123" | ||
should_taint = true | ||
|
||
custom_labels = { | ||
env = "production" | ||
} | ||
|
||
custom_taints { | ||
key = "dedicated" | ||
value = "backend" | ||
effect = "NoSchedule" | ||
} | ||
|
||
constraints { | ||
compute_optimized = true | ||
storage_optimized = false | ||
compute_optimized_state = "on" | ||
storage_optimized_state = "off" | ||
is_gpu_only = false | ||
spot = true | ||
on_demand = false | ||
use_spot_fallbacks = true | ||
fallback_restore_rate_seconds = 300 | ||
enable_spot_diversity = true | ||
spot_diversity_price_increase_limit_percent = 20 | ||
spot_interruption_predictions_enabled = true | ||
spot_interruption_predictions_type = "history" | ||
min_cpu = 2 | ||
max_cpu = 8 | ||
min_memory = 4096 | ||
max_memory = 16384 | ||
architectures = ["amd64"] | ||
azs = ["us-east-1a", "us-east-1b"] | ||
burstable_instances = false | ||
customer_specific = false | ||
|
||
instance_families { | ||
include = ["m5", "m6i"] | ||
exclude = ["m4"] | ||
} | ||
|
||
gpu { | ||
manufacturers = ["nvidia"] | ||
include_names = ["p2"] | ||
exclude_names = ["p3"] | ||
min_count = 1 | ||
max_count = 4 | ||
} | ||
|
||
custom_priority { | ||
instance_families = ["m5", "m6i"] | ||
spot = true | ||
on_demand = false | ||
} | ||
} | ||
|
||
depends_on = [castai_autoscaler.castai_autoscaler_policies] | ||
} |
19 changes: 19 additions & 0 deletions
19
examples/resources/castai_organization_members/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
data "castai_organization" "dev" { | ||
name = var.castai_dev_organization_name | ||
} | ||
|
||
resource "castai_organization_members" "dev" { | ||
organization_id = data.castai_organization.dev.id | ||
|
||
owners = [ | ||
"owner@test.ai", | ||
] | ||
|
||
members = [ | ||
"member@test.ai", | ||
] | ||
|
||
viewers = [] | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters