From cb13c1397f97f6eebf7001d57eff14d5fc5366d1 Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Fri, 19 Sep 2025 16:57:01 +0000 Subject: [PATCH 01/12] feat(iac): Allow any flavour for k3s compute --- .../terraform/modules/openstack-kubernetes-infra/compute.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf b/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf index 2988872..e0b0ada 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf @@ -120,7 +120,7 @@ data "cloudinit_config" "init_docker_controller" { } data "openstack_compute_flavor_v2" "available_compute_flavors" { - for_each = toset(["2cpu4ram", "8cpu16ram"]) + for_each = toset([for vm in var.host_instances : vm.flavour]) name = each.value } From 8d455147ad80595162fe315ac12ab3131fad2b43 Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Fri, 19 Sep 2025 17:07:07 +0000 Subject: [PATCH 02/12] fix(iac): K3s - fix kubeconfig downloading to wrong path --- .../terraform/modules/openstack-kubernetes-infra/compute.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf b/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf index e0b0ada..b058e40 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf @@ -146,9 +146,9 @@ resource "null_resource" "copy_kubeconfig" { # Use ssh-keyscan to prevent interactive prompt on unknown host # Use sed to replace the localhost address in the KUBECONFIG file with the actual IP adddress of the created VM. command = <> ${path.module}/.build/.known_hosts_cogstack && \ -scp -o UserKnownHostsFile=${path.module}/.build/.known_hosts_cogstack -o StrictHostKeyChecking=yes \ +mkdir -p ${path.root}/.build/ && \ +ssh-keyscan -H ${openstack_compute_instance_v2.kubernetes_server.access_ip_v4} >> ${path.root}/.build/.known_hosts_cogstack && \ +scp -o UserKnownHostsFile=${path.root}/.build/.known_hosts_cogstack -o StrictHostKeyChecking=yes \ -i ${local.ssh_keys.private_key_file} \ ubuntu@${openstack_compute_instance_v2.kubernetes_server.access_ip_v4}:/etc/rancher/k3s/k3s.yaml \ ${local.kubeconfig_file} && \ From f330d354f8970ef63980b87fa1cf52bd5f2f2705 Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Fri, 19 Sep 2025 17:17:13 +0000 Subject: [PATCH 03/12] fix(iac): K3s - fix kubeconfig extraction when run remotely --- .../openstack-kubernetes-infra/compute.tf | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf b/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf index b058e40..d16cd7c 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf @@ -138,21 +138,3 @@ data "openstack_networking_secgroup_v2" "er_https_from_lbs" { name = "er_https_from_lbs" } -resource "null_resource" "copy_kubeconfig" { - depends_on = [openstack_compute_instance_v2.kubernetes_server] - - provisioner "local-exec" { - # Copy the kubeconfig file from the host to a local file using SCP. - # Use ssh-keyscan to prevent interactive prompt on unknown host - # Use sed to replace the localhost address in the KUBECONFIG file with the actual IP adddress of the created VM. - command = <> ${path.root}/.build/.known_hosts_cogstack && \ -scp -o UserKnownHostsFile=${path.root}/.build/.known_hosts_cogstack -o StrictHostKeyChecking=yes \ - -i ${local.ssh_keys.private_key_file} \ - ubuntu@${openstack_compute_instance_v2.kubernetes_server.access_ip_v4}:/etc/rancher/k3s/k3s.yaml \ - ${local.kubeconfig_file} && \ -sed -i "s/127.0.0.1/${openstack_compute_instance_v2.kubernetes_server.access_ip_v4}/" ${local.kubeconfig_file} -EOT - } -} \ No newline at end of file From 414c765e4348022bde5d516912e9bed15a50963d Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Fri, 19 Sep 2025 17:17:42 +0000 Subject: [PATCH 04/12] fix(iac): K3s - fix kubeconfig extraction when run remotely --- .../kubeconfig-extraction.tf | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf new file mode 100644 index 0000000..a8d605a --- /dev/null +++ b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf @@ -0,0 +1,28 @@ +resource "null_resource" "copy_kubeconfig" { + depends_on = [openstack_compute_instance_v2.kubernetes_server] + + provisioner "local-exec" { + # Copy the kubeconfig file from the host to a local file using SCP. + # Use ssh-keyscan to prevent interactive prompt on unknown host + # Use sed to replace the localhost address in the KUBECONFIG file with the actual IP adddress of the created VM. + command = <> ${path.root}/.build/.known_hosts_cogstack && \ +scp -o UserKnownHostsFile=${path.root}/.build/.known_hosts_cogstack -o StrictHostKeyChecking=yes \ + -i ${local.ssh_keys.private_key_file} \ + ubuntu@${openstack_compute_instance_v2.kubernetes_server.access_ip_v4}:/etc/rancher/k3s/k3s.yaml \ + ${local.kubeconfig_file} && \ +sed -i "s/127.0.0.1/${openstack_compute_instance_v2.kubernetes_server.access_ip_v4}/" ${local.kubeconfig_file} +EOT + } +} + +data "local_file" "kube_config_raw_file" { + filename = local.kubeconfig_file + depends_on = [ null_resource.copy_kubeconfig ] +} + +output "kube_config_raw" { + value = data.local_file.kube_config_raw_file + description = "Kubeconfig for this cluster" +} \ No newline at end of file From 8e12e2c30e843a68a6de0fb8f14575317dd407a1 Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Fri, 19 Sep 2025 17:39:36 +0000 Subject: [PATCH 05/12] fixup! fix(iac): K3s - fix kubeconfig extraction when run remotely fix(iac): K3s - fix kubeconfig extraction when run remotely --- .../modules/openstack-kubernetes-infra/kubeconfig-extraction.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf index a8d605a..a01ad43 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf @@ -24,5 +24,5 @@ data "local_file" "kube_config_raw_file" { output "kube_config_raw" { value = data.local_file.kube_config_raw_file - description = "Kubeconfig for this cluster" + description = "Kubeconfig for this clustr" } \ No newline at end of file From ca97613226cb234d3e39ca9ebeed6e064b32ee15 Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Fri, 19 Sep 2025 17:59:45 +0000 Subject: [PATCH 06/12] fix(iac): K3s - working on kubeconfig extraction using remote mode --- .../kubeconfig-extraction.tf | 27 ++++++++++----- .../kubeconfig_extraction.sh | 33 +++++++++++++++++++ 2 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig_extraction.sh diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf index a01ad43..fa1c34e 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf @@ -17,12 +17,23 @@ EOT } } -data "local_file" "kube_config_raw_file" { - filename = local.kubeconfig_file - depends_on = [ null_resource.copy_kubeconfig ] -} +# data "local_file" "kube_config_raw_file" { +# filename = local.kubeconfig_file +# depends_on = [ null_resource.copy_kubeconfig ] +# } + +# output "kube_config_raw" { +# value = data.local_file.kube_config_raw_file +# description = "Kubeconfig for this cluster" +# } + +# data "external" "extract_kubeconfig_file" { +# program = ["bash", "${path.module}/kubeconfig_extraction.sh"] -output "kube_config_raw" { - value = data.local_file.kube_config_raw_file - description = "Kubeconfig for this clustr" -} \ No newline at end of file +# query = { +# PATH_ROOT=path.root +# SERVER_IP=openstack_compute_instance_v2.kubernetes_server.access_ip_v4 +# SSH_KEY=local.ssh_keys.private_key_file +# # KUBECONFIG_FILE=local.kubeconfig_file +# } +# } \ No newline at end of file diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig_extraction.sh b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig_extraction.sh new file mode 100644 index 0000000..ab95380 --- /dev/null +++ b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig_extraction.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +set -euo pipefail + +# ============================== +# Variables (from Terraform) +# ============================== +PATH_ROOT=${path.root} +SERVER_IP=${openstack_compute_instance_v2.kubernetes_server.access_ip_v4} +SSH_KEY=${local.ssh_keys.private_key_file} +KUBECONFIG_FILE=${local.kubeconfig_file} + +# ============================== +# Script Logic +# ============================== + +# Create .build directory if it doesn't exist +mkdir -p "${PATH_ROOT}/.build/" + +# Add server's SSH key to a custom known_hosts file +ssh-keyscan -H "${SERVER_IP}" >> "${PATH_ROOT}/.build/.known_hosts_cogstack" + +# Securely copy the K3s kubeconfig file from the server +scp \ + -o UserKnownHostsFile="${PATH_ROOT}/.build/.known_hosts_cogstack" \ + -o StrictHostKeyChecking=yes \ + -i "${SSH_KEY}" \ + "ubuntu@${SERVER_IP}:/etc/rancher/k3s/k3s.yaml" \ + "${KUBECONFIG_FILE}" + +# Replace localhost with the actual server IP in the kubeconfig +sed -i "s/127\.0\.0\.1/${SERVER_IP}/" "${KUBECONFIG_FILE}" + +echo "Kubeconfig successfully fetched and updated at: ${KUBECONFIG_FILE}" \ No newline at end of file From 977a45f23bfe8401d50f804b09a483ccf49b86d3 Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Fri, 19 Sep 2025 18:10:17 +0000 Subject: [PATCH 07/12] fix(iac): K3s - fix created_hosts name --- .../terraform/modules/openstack-kubernetes-infra/outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf b/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf index 3cf1097..a28c7b2 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf @@ -1,5 +1,5 @@ -output "created_hosts_2" { +output "created_hosts" { value = { for k, value in openstack_compute_instance_v2.kubernetes_nodes : k => { ip_address = value.access_ip_v4 unique_name = value.name From 50968c1b4488eb6fc56089b980ecf5bb0159fdfe Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Mon, 22 Sep 2025 10:50:43 +0000 Subject: [PATCH 08/12] feat(iac): Support overriding an output file path --- .../modules/openstack-cogstack-infra/compute-keypair.tf | 6 +++--- .../modules/openstack-cogstack-infra/shared-locals.tf | 3 +-- .../modules/openstack-cogstack-infra/variables.tf | 7 +++++++ .../modules/openstack-kubernetes-infra/compute-keypair.tf | 4 ++-- .../modules/openstack-kubernetes-infra/shared-locals.tf | 3 ++- .../modules/openstack-kubernetes-infra/variables.tf | 6 ++++++ 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/deployment/terraform/modules/openstack-cogstack-infra/compute-keypair.tf b/deployment/terraform/modules/openstack-cogstack-infra/compute-keypair.tf index 819bd71..7cc50e4 100644 --- a/deployment/terraform/modules/openstack-cogstack-infra/compute-keypair.tf +++ b/deployment/terraform/modules/openstack-cogstack-infra/compute-keypair.tf @@ -21,13 +21,13 @@ resource "openstack_compute_keypair_v2" "compute_keypair" { resource "local_file" "private_key" { count = local.is_using_existing_ssh_keypair ? 0 : 1 content = openstack_compute_keypair_v2.compute_keypair.private_key - filename = "${path.root}/.build/${openstack_compute_keypair_v2.compute_keypair.name}-rsa.pem" + filename = "${local.output_file_directory}/${openstack_compute_keypair_v2.compute_keypair.name}-rsa.pem" file_permission = "0600" } resource "local_file" "public_key" { count = local.is_using_existing_ssh_keypair ? 0 : 1 content = openstack_compute_keypair_v2.compute_keypair.public_key - filename = "${path.root}/.build/${openstack_compute_keypair_v2.compute_keypair.name}-rsa.pub" + filename = "${local.output_file_directory}/${openstack_compute_keypair_v2.compute_keypair.name}-rsa.pub" file_permission = "0600" -} \ No newline at end of file +} diff --git a/deployment/terraform/modules/openstack-cogstack-infra/shared-locals.tf b/deployment/terraform/modules/openstack-cogstack-infra/shared-locals.tf index 6423851..f6ffc63 100644 --- a/deployment/terraform/modules/openstack-cogstack-infra/shared-locals.tf +++ b/deployment/terraform/modules/openstack-cogstack-infra/shared-locals.tf @@ -1,6 +1,7 @@ locals { random_prefix = random_id.server.b64_url + output_file_directory = var.output_file_directory != null ? var.output_file_directory : "${path.root}/.build" } @@ -17,8 +18,6 @@ locals { ip_address = var.preexisting_controller_host != null ? var.preexisting_controller_host.ip_address : local.created_controller_host.access_ip_v4 unique_name = var.preexisting_controller_host != null && var.preexisting_controller_host.unique_name != null ? var.preexisting_controller_host.unique_name : local.created_controller_host.name } - - } resource "random_id" "server" { diff --git a/deployment/terraform/modules/openstack-cogstack-infra/variables.tf b/deployment/terraform/modules/openstack-cogstack-infra/variables.tf index aed9dee..ecdddc6 100644 --- a/deployment/terraform/modules/openstack-cogstack-infra/variables.tf +++ b/deployment/terraform/modules/openstack-cogstack-infra/variables.tf @@ -99,4 +99,11 @@ variable "ssh_key_pair" { condition = var.ssh_key_pair == null || fileexists(var.ssh_key_pair.public_key_file) error_message = "No file exists in SSH public key path" } +} + + +variable "output_file_directory" { + type = string + default = null + description = "Optional path to write output files to. If directory doesnt exist it will be created" } \ No newline at end of file diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/compute-keypair.tf b/deployment/terraform/modules/openstack-kubernetes-infra/compute-keypair.tf index 819bd71..7089791 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/compute-keypair.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/compute-keypair.tf @@ -21,13 +21,13 @@ resource "openstack_compute_keypair_v2" "compute_keypair" { resource "local_file" "private_key" { count = local.is_using_existing_ssh_keypair ? 0 : 1 content = openstack_compute_keypair_v2.compute_keypair.private_key - filename = "${path.root}/.build/${openstack_compute_keypair_v2.compute_keypair.name}-rsa.pem" + filename = "${local.output_file_directory}/${openstack_compute_keypair_v2.compute_keypair.name}-rsa.pem" file_permission = "0600" } resource "local_file" "public_key" { count = local.is_using_existing_ssh_keypair ? 0 : 1 content = openstack_compute_keypair_v2.compute_keypair.public_key - filename = "${path.root}/.build/${openstack_compute_keypair_v2.compute_keypair.name}-rsa.pub" + filename = "${local.output_file_directory}/${openstack_compute_keypair_v2.compute_keypair.name}-rsa.pub" file_permission = "0600" } \ No newline at end of file diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/shared-locals.tf b/deployment/terraform/modules/openstack-kubernetes-infra/shared-locals.tf index 53b6458..abef5fd 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/shared-locals.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/shared-locals.tf @@ -10,7 +10,8 @@ locals { } locals { - kubeconfig_file = "${path.module}/.build/downloaded-kubeconfig.yaml" + output_file_directory = var.output_file_directory != null ? var.output_file_directory : "${path.root}/.build" + kubeconfig_file = "${local.output_file_directory}/downloaded-kubeconfig.yaml" } resource "random_id" "server" { diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/variables.tf b/deployment/terraform/modules/openstack-kubernetes-infra/variables.tf index 90732fe..556a44b 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/variables.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/variables.tf @@ -54,4 +54,10 @@ variable "ssh_key_pair" { condition = var.ssh_key_pair == null || fileexists(var.ssh_key_pair.public_key_file) error_message = "No file exists in SSH public key path" } +} + +variable "output_file_directory" { + type = string + default = null + description = "Optional path to write output files to. If directory doesnt exist it will be created" } \ No newline at end of file From 2c72db03d57b1774327c2a80813711d40cc9c0e5 Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Mon, 22 Sep 2025 12:39:11 +0000 Subject: [PATCH 09/12] feat(iac): Fix to include server in nodes output --- .../terraform/modules/openstack-kubernetes-infra/outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf b/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf index a28c7b2..338a454 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf @@ -1,6 +1,6 @@ output "created_hosts" { - value = { for k, value in openstack_compute_instance_v2.kubernetes_nodes : k => { + value = { for k, value in merge(openstack_compute_instance_v2.kubernetes_nodes, [openstack_compute_instance_v2.kubernetes_server]) : k => { ip_address = value.access_ip_v4 unique_name = value.name name = k From 3ef69bf9c5ade4eebaa7438612da1fb376e46bd6 Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Mon, 22 Sep 2025 12:53:42 +0000 Subject: [PATCH 10/12] feat(iac): Fix to include server in nodes output --- .../openstack-kubernetes-infra/networking.tf | 2 +- .../modules/openstack-kubernetes-infra/outputs.tf | 14 ++++++-------- .../openstack-kubernetes-infra/shared-locals.tf | 7 ++++++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/networking.tf b/deployment/terraform/modules/openstack-kubernetes-infra/networking.tf index a646c9d..2b1c073 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/networking.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/networking.tf @@ -1,7 +1,7 @@ locals { - devops_controller_cidr = "${local.controller_host_instance.access_ip_v4}/32" + devops_controller_cidr = "${local.controller_host_instance.ip_address}/32" cogstack_apps_ingress_rules = [ { port = 22, cidr = var.allowed_ingress_ips_cidr, description = "Expose SSH" }, diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf b/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf index 338a454..2ad485e 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/outputs.tf @@ -1,21 +1,19 @@ output "created_hosts" { - value = { for k, value in merge(openstack_compute_instance_v2.kubernetes_nodes, [openstack_compute_instance_v2.kubernetes_server]) : k => { + value = merge({ for k, value in openstack_compute_instance_v2.kubernetes_nodes : k => { ip_address = value.access_ip_v4 unique_name = value.name name = k - } } + } }, + { + (local.controller_host.name) : local.controller_host_instance + }) description = "Created Hosts: A map of { hostname: { data } }" } output "created_controller_host" { - value = { - name = (local.controller_host.name) - ip_address = local.controller_host_instance.access_ip_v4 - unique_name = local.controller_host_instance.name - } - + value = local.controller_host_instance description = "Created Controller Host: A map of { hostname: { data } }" } diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/shared-locals.tf b/deployment/terraform/modules/openstack-kubernetes-infra/shared-locals.tf index abef5fd..f510522 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/shared-locals.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/shared-locals.tf @@ -6,7 +6,12 @@ locals { locals { controller_host = one([for host in var.host_instances : host if host.is_controller]) - controller_host_instance = openstack_compute_instance_v2.kubernetes_server + created_controller_host = openstack_compute_instance_v2.kubernetes_server + controller_host_instance = { + name = local.controller_host.name + ip_address = local.created_controller_host.access_ip_v4 + unique_name = local.created_controller_host.name + } } locals { From 85c1b9e27244765a822b4bf9b8c494e075d0531f Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Mon, 22 Sep 2025 13:54:37 +0000 Subject: [PATCH 11/12] feat(iac): Fix for kubeconfig --- .../openstack-kubernetes-infra/kubeconfig-extraction.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf index fa1c34e..1a7fc1b 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf @@ -17,10 +17,10 @@ EOT } } -# data "local_file" "kube_config_raw_file" { -# filename = local.kubeconfig_file -# depends_on = [ null_resource.copy_kubeconfig ] -# } +data "local_file" "kube_config_raw_file" { + filename = local.kubeconfig_file + depends_on = [ null_resource.copy_kubeconfig ] +} # output "kube_config_raw" { # value = data.local_file.kube_config_raw_file From 212c21ec0380f7b4238cbb8a700ae54252983083 Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Mon, 22 Sep 2025 14:08:14 +0000 Subject: [PATCH 12/12] feat(iac): Fix for kubeconfig ssh --- .../openstack-kubernetes-infra/kubeconfig-extraction.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf index 1a7fc1b..4e381a8 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/kubeconfig-extraction.tf @@ -8,10 +8,10 @@ resource "null_resource" "copy_kubeconfig" { command = <> ${path.root}/.build/.known_hosts_cogstack && \ -scp -o UserKnownHostsFile=${path.root}/.build/.known_hosts_cogstack -o StrictHostKeyChecking=yes \ +ssh -o UserKnownHostsFile=${path.root}/.build/.known_hosts_cogstack -o StrictHostKeyChecking=yes \ -i ${local.ssh_keys.private_key_file} \ - ubuntu@${openstack_compute_instance_v2.kubernetes_server.access_ip_v4}:/etc/rancher/k3s/k3s.yaml \ - ${local.kubeconfig_file} && \ + ubuntu@${openstack_compute_instance_v2.kubernetes_server.access_ip_v4} \ + "sudo cat /etc/rancher/k3s/k3s.yaml" > ${local.kubeconfig_file} && \ sed -i "s/127.0.0.1/${openstack_compute_instance_v2.kubernetes_server.access_ip_v4}/" ${local.kubeconfig_file} EOT }