Skip to content

Commit

Permalink
feat: Add pod-pinner to CAST AI onboarding (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejatcastai authored Dec 8, 2023
1 parent b612980 commit e825a5b
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
55 changes: 55 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,61 @@ resource "null_resource" "wait_for_cluster" {
}
}

resource "helm_release" "castai_pod_pinner" {
name = "castai-pod-pinner"
repository = "https://castai.github.io/helm-charts"
chart = "castai-pod-pinner"
namespace = "castai-agent"
create_namespace = true
cleanup_on_fail = true
wait = true

set {
name = "castai.clusterID"
value = castai_aks_cluster.castai_cluster.id
}

dynamic "set" {
for_each = var.api_url != "" ? [var.api_url] : []
content {
name = "castai.apiURL"
value = var.api_url
}
}

set_sensitive {
name = "castai.apiKey"
value = castai_aks_cluster.castai_cluster.cluster_token
}

dynamic "set" {
for_each = var.grpc_url != "" ? [var.grpc_url] : []
content {
name = "castai.grpcURL"
value = var.grpc_url
}
}

dynamic "set" {
for_each = var.castai_components_labels
content {
name = "podLabels.${set.key}"
value = set.value
}
}

set {
name = "replicaCount"
value = "0"
}

depends_on = [helm_release.castai_agent]

lifecycle {
ignore_changes = [set, version]
}
}

resource "helm_release" "castai_spot_handler" {
name = "castai-spot-handler"
repository = "https://castai.github.io/helm-charts"
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ variable "castai_api_token" {
default = ""
}

variable "grpc_url" {
type = string
description = "gRPC endpoint used by pod-pinner"
default = "grpc.cast.ai:443"
}

variable "aks_cluster_name" {
type = string
description = "Name of the cluster to be connected to CAST AI."
Expand Down

0 comments on commit e825a5b

Please sign in to comment.