Skip to content

Commit

Permalink
feat(gcp): labelling on spot nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtcoder17 committed Apr 13, 2024
1 parent f1b5715 commit 957a919
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
.terraform.d
.dump
.buildx-cache
*.tar
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ RUN <<'EOF'
# tar cf - $tdir | lz4 -v -5 > tf.lz4 && rm -rf $tdir
tar cf - $tdir | zstd --compress > tf.zst && rm -rf $tdir
EOF

# ENV DECOMPRESS_CMD="lz4 -d tf.lz4 | tar xf -"
ENV DECOMPRESS_CMD="zstd --decompress tf.zst --stdout | tar xf -"
ENV TEMPLATES_DIR="/app/infrastructure-templates"
Expand Down
8 changes: 4 additions & 4 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ tasks:
- sh: '[[ -n "{{.Image}}" ]]'
msg: 'var Image must have a value'
vars:
Push: true
DockerArgs: ""
push: true
dockerArgs: "{{.DockerArgs | default ''}}"
cmds:
- docker build -t {{.Image}} . {{.DockerArgs}}
- docker build -t {{.Image}} . {{.dockerArgs}}
- |+
if [ "{{.Push}}" == "true" ]; then
if [ "{{.push}}" == "true" ]; then
docker push {{.Image}}
fi
5 changes: 3 additions & 2 deletions terraform/bundles/gcp/worker-nodes/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ module "worker-nodes" {
tf_node_labels = jsonencode(merge(var.node_labels, {
(module.constants.node_labels.provider_az) = var.availability_zone
(module.constants.node_labels.node_has_role) = "agent"
(module.constants.node_labels.nodepool_name) : var.nodepool_name,
(module.constants.node_labels.nodepool_name) : var.nodepool_name
(module.constants.node_labels.provider_aws_instance_profile_name) : ""
},
# var.nvidia_gpu_enabled == true ? { (module.constants.node_labels.node_has_gpu) : "true" } : {}
var.provision_mode == "SPOT" ? { (module.constants.node_labels.node_is_spot) = "true" } : {},
# var.nvidia_gpu_enabled == true ? { (module.constants.node_labels.node_has_gpu) : "true" } : {}
))
tf_node_name = "${var.nodepool_name}-${each.key}"
tf_use_cloudflare_nameserver = true
Expand Down

0 comments on commit 957a919

Please sign in to comment.