Skip to content

Commit 8dedf9f

Browse files
Updating the locals block ti handle asapd_lite_config_content
1 parent 5a9469c commit 8dedf9f

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

modules/management/kubectl-apply/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ limitations under the License.
246246
| Name | Description | Type | Default | Required |
247247
|------|-------------|------|---------|:--------:|
248248
| <a name="input_apply_manifests"></a> [apply\_manifests](#input\_apply\_manifests) | A list of manifests to apply to the GKE cluster using helm\_install. For more details on the underlying deployment mechanism, see the [helm\_install module](helm\_install/README.md). 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/> wait_for_rollout = optional(bool, true)<br/> namespace = optional(string, null)<br/> }))</pre> | `[]` | no |
249-
| <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 |
249+
| <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, null)<br/> config_template_vars = optional(map(any), {})<br/> })</pre> | `{}` | no |
250250
| <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 |
251251
| <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 |
252252
| <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: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ locals {
3333
]))
3434
configure_kueue = local.install_kueue && (try(var.kueue.config_path, "") != "" || try(var.kueue.enable_pathways_for_tpus, false))
3535

36+
asapd_lite_config_content = (
37+
var.asapd_lite.config_path != null && var.asapd_lite.config_path != "" ?
38+
(
39+
endswith(var.asapd_lite.config_path, ".tftpl") || (var.asapd_lite.config_template_vars != null ? length(var.asapd_lite.config_template_vars) : 0) > 0 ?
40+
templatefile(var.asapd_lite.config_path, var.asapd_lite.config_template_vars != null ? var.asapd_lite.config_template_vars : {}) :
41+
file(var.asapd_lite.config_path)
42+
) : ""
43+
)
44+
3645
kueue_docs = [for doc in split("\n---", local.kueue_config_content) : trimspace(doc) if length(trimspace(doc)) > 0]
3746
parsed_kueue_docs = [for doc in local.kueue_docs : yamldecode(doc)]
3847
cluster_queues = [for doc in local.parsed_kueue_docs : doc if try(doc.kind, "") == "ClusterQueue"]
@@ -97,8 +106,8 @@ locals {
97106
) :
98107
# Step C: Single file logic (implied if source is provided but not a URL or Dir)
99108
(manifest.source != null && manifest.source != "") ? (
100-
endswith(manifest.source, ".tftpl") || length(try(manifest.template_vars, {})) > 0 ?
101-
templatefile(manifest.source, try(manifest.template_vars, {})) :
109+
endswith(manifest.source, ".tftpl") || length(manifest.template_vars != null ? manifest.template_vars : {}) > 0 ?
110+
templatefile(manifest.source, manifest.template_vars != null ? manifest.template_vars : {}) :
102111
file(manifest.source)
103112
)
104113
:

0 commit comments

Comments
 (0)