Skip to content

Commit 3638311

Browse files
Migrating install_aspad_lite module to helm
1 parent 7d82252 commit 3638311

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

modules/management/kubectl-apply/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ limitations under the License.
220220
| Name | Source | Version |
221221
|------|--------|---------|
222222
| <a name="module_configure_kueue"></a> [configure\_kueue](#module\_configure\_kueue) | ./helm_install | n/a |
223-
| <a name="module_install_asapd_lite"></a> [install\_asapd\_lite](#module\_install\_asapd\_lite) | ./kubectl | n/a |
223+
| <a name="module_install_asapd_lite"></a> [install\_asapd\_lite](#module\_install\_asapd\_lite) | ./helm_install | n/a |
224224
| <a name="module_install_gib"></a> [install\_gib](#module\_install\_gib) | ./helm_install | n/a |
225225
| <a name="module_install_gpu_operator"></a> [install\_gpu\_operator](#module\_install\_gpu\_operator) | ./helm_install | n/a |
226226
| <a name="module_install_jobset"></a> [install\_jobset](#module\_install\_jobset) | ./helm_install | n/a |
@@ -245,7 +245,7 @@ limitations under the License.
245245
| Name | Description | Type | Default | Required |
246246
|------|-------------|------|---------|:--------:|
247247
| <a name="input_apply_manifests"></a> [apply\_manifests](#input\_apply\_manifests) | A list of manifests to apply to GKE cluster using kubectl. For more details see [kubectl module's inputs](kubectl/README.md).<br/> NOTE: The `enable` input acts as a FF to apply a manifest or not. By default it is always set to `true`. | <pre>list(object({<br/> enable = optional(bool, true)<br/> content = optional(string, null)<br/> source = optional(string, null)<br/> template_vars = optional(map(any), null)<br/> server_side_apply = optional(bool, false)<br/> wait_for_rollout = optional(bool, true)<br/> }))</pre> | `[]` | no |
248-
| <a name="input_asapd_lite"></a> [asapd\_lite](#input\_asapd\_lite) | Install the asapd-lite daemonset for A4X-Max Bare Metal. | <pre>object({<br/> install = bool<br/> config_path = string<br/> })</pre> | <pre>{<br/> "config_path": "",<br/> "install": false<br/>}</pre> | no |
248+
| <a name="input_asapd_lite"></a> [asapd\_lite](#input\_asapd\_lite) | Install the asapd-lite daemonset for A4X-Max Bare Metal. | <pre>object({<br/> install = optional(bool, false)<br/> config_path = optional(string, "")<br/> config_template_vars = optional(map(any), {})<br/> })</pre> | `{}` | no |
249249
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | An identifier for the gke cluster resource with format projects/<project\_id>/locations/<region>/clusters/<name>. | `string` | n/a | yes |
250250
| <a name="input_gib"></a> [gib](#input\_gib) | Install the NCCL gIB plugin | <pre>object({<br/> install = bool<br/> path = string<br/> template_vars = object({<br/> image = optional(string, "us-docker.pkg.dev/gce-ai-infra/gpudirect-gib/nccl-plugin-gib")<br/> version = string<br/> node_affinity = optional(any, {<br/> requiredDuringSchedulingIgnoredDuringExecution = {<br/> nodeSelectorTerms = [{<br/> matchExpressions = [{<br/> key = "cloud.google.com/gke-gpu",<br/> operator = "In",<br/> values = ["true"]<br/> }]<br/> }]<br/> }<br/> })<br/> accelerator_count = number<br/> max_unavailable = optional(string, "50%")<br/> })<br/> })</pre> | <pre>{<br/> "install": false,<br/> "path": "",<br/> "template_vars": {<br/> "accelerator_count": 0,<br/> "version": ""<br/> }<br/>}</pre> | no |
251251
| <a name="input_gke_cluster_exists"></a> [gke\_cluster\_exists](#input\_gke\_cluster\_exists) | A static flag that signals to downstream modules that a cluster has been created. | `bool` | `false` | no |

modules/management/kubectl-apply/main.tf

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ locals {
2727
file(var.kueue.config_path)
2828
) : ""
2929
)
30+
31+
asapd_lite_config_content = (
32+
var.asapd_lite.config_path != null && var.asapd_lite.config_path != "" ?
33+
(
34+
endswith(var.asapd_lite.config_path, ".tftpl") || length(try(var.asapd_lite.config_template_vars, {})) > 0 ?
35+
templatefile(var.asapd_lite.config_path, try(var.asapd_lite.config_template_vars, {})) :
36+
file(var.asapd_lite.config_path)
37+
) : ""
38+
)
39+
3040
configure_kueue = local.install_kueue && try(var.kueue.config_path, "") != ""
3141

3242
# 1. First, Identify manifests that are explicitly enabled.
@@ -298,12 +308,18 @@ module "install_gib" {
298308
}
299309

300310
module "install_asapd_lite" {
301-
source = "./kubectl"
302-
source_path = local.install_asapd_lite ? var.asapd_lite.config_path : null
303-
server_side_apply = true
304-
wait_for_rollout = true
311+
source = "./helm_install"
312+
count = local.install_asapd_lite ? 1 : 0
313+
release_name = "asapd-lite"
314+
chart_name = "${path.module}/raw-config-chart"
315+
chart_version = "0.1.0"
316+
namespace = "kube-system"
317+
wait = true
318+
depends_on = [var.gke_cluster_exists]
305319

306-
providers = {
307-
kubectl = kubectl
308-
}
320+
values_yaml = [
321+
yamlencode({
322+
manifests = [for doc in split("\n---", local.asapd_lite_config_content) : trimspace(doc) if length(trimspace(doc)) > 0]
323+
})
324+
]
309325
}

modules/management/kubectl-apply/variables.tf

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,9 @@ variable "system_node_pool_id" {
201201
variable "asapd_lite" {
202202
description = "Install the asapd-lite daemonset for A4X-Max Bare Metal."
203203
type = object({
204-
install = bool
205-
config_path = string
204+
install = optional(bool, false)
205+
config_path = optional(string, "")
206+
config_template_vars = optional(map(any), {})
206207
})
207-
default = {
208-
install = false
209-
config_path = ""
210-
}
208+
default = {}
211209
}

0 commit comments

Comments
 (0)