Skip to content

Commit

Permalink
chore(k3d): disable volumes if using use_local_repo (#954)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
NathanFlurry committed Jul 3, 2024
1 parent 20822fc commit c375325
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
33 changes: 21 additions & 12 deletions infra/tf/k8s_cluster_k3d/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,32 @@ resource "k3d_cluster" "main" {
name = "rivet-${var.namespace}"

# Mount repository in to k3d so we can access the built binaries
volume {
source = var.cargo_target_dir
destination = "/target"
node_filters = ["server:0"]
dynamic "volume" {
for_each = var.k3d_use_local_repo ? [] : [0]
content {
source = var.cargo_target_dir
destination = "/target"
node_filters = ["server:0"]
}
}

# Mount the /nix/store and /local since the build binaries depend on dynamic libs from there
volume {
source = "/nix/store"
destination = "/nix/store"
node_filters = ["server:0"]
dynamic "volume" {
for_each = var.k3d_use_local_repo ? [] : [0]
content {
source = "/nix/store"
destination = "/nix/store"
node_filters = ["server:0"]
}
}

volume {
source = "/local"
destination = "/local"
node_filters = ["server:0"]
dynamic "volume" {
for_each = var.k3d_use_local_repo ? [] : [0]
content {
source = "/local"
destination = "/local"
node_filters = ["server:0"]
}
}

# HTTP
Expand Down
4 changes: 4 additions & 0 deletions infra/tf/k8s_cluster_k3d/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ variable "namespace" {
type = string
}

variable "k3d_use_local_repo" {
type = bool
}

variable "project_root" {
type = string
}
Expand Down
9 changes: 9 additions & 0 deletions lib/bolt/core/src/dep/terraform/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,15 @@ async fn vars(ctx: &ProjectContext) {
"cargo_target_dir".into(),
json!(ctx.cargo_target_dir().display().to_string()),
);
vars.insert(
"k3d_use_local_repo".into(),
json!(matches!(
&config.kubernetes.provider,
ns::KubernetesProvider::K3d {
use_local_repo: true
}
)),
);

// Services
{
Expand Down

0 comments on commit c375325

Please sign in to comment.