diff --git a/terraform/hetzner.tf b/terraform/hetzner.tf index 9951217..9df275d 100644 --- a/terraform/hetzner.tf +++ b/terraform/hetzner.tf @@ -178,31 +178,36 @@ resource "hcloud_server" "server_k8s_test" { } firewall_ids = [hcloud_firewall.basic-firewall.id, hcloud_firewall.k8s-firewall.id] ssh_keys = [data.hcloud_ssh_key.macos.id] - user_data = templatefile("${path.module}/modules/k8s-cluster/templates/cloud-init-k8s.tftpl", { + user_data = templatefile("${path.module}/modules/k8s-cluster/templates/cloud-init-k8s-manager.tftpl", { admin_public_ssh_key : format("%s %s", data.hcloud_ssh_key.macos.public_key, data.hcloud_ssh_key.macos.name) admin_user : "2martensAdmin" terraform_public_ssh_key : var.terraform_public_ssh_key main_node : true - microk8s_config : base64encode(templatefile("${path.module}/templates/microk8s-config.tftpl", { + microk8s_config : base64encode(templatefile("${path.module}/modules/k8s-cluster/templates/microk8s-config-manager.tftpl", { node_ip : "10.0.0.2" api_server_domain : "" + api_server_ip : hcloud_primary_ip.primary_ipv4_k8s_test.ip_address + main_node : true + main_node_ip : "10.0.0.2" + cluster_token : "" })) - packages_setup : base64encode(file("${path.module}/templates/install-packages.sh")) - firewall_setup : base64encode(templatefile("${path.module}/templates/firewall-setup.sh", { + packages_setup : base64encode(file("${path.module}/modules/k8s-cluster/templates/install-packages.sh")) + firewall_setup : base64encode(templatefile("${path.module}/modules/k8s-cluster/templates/firewall-setup.sh", { node_ip : "10.0.0.2" })) - ssh_setup : base64encode(templatefile("${path.module}/templates/ssh-setup.sh", { + ssh_setup : base64encode(templatefile("${path.module}/modules/k8s-cluster/templates/ssh-setup.sh", { admin_user : "2martensAdmin" })) - microk8s_setup : base64encode(templatefile("${path.module}/templates/microk8s-setup.sh", { + microk8s_setup : base64encode(templatefile("${path.module}/modules/k8s-cluster/templates/microk8s-setup.sh", { microk8s_channel : "1.28-strict/stable" + main_node : true })) - cluster_setup_values : base64encode(templatefile("${path.module}/templates/cluster-setup-values.yaml", { + cluster_setup_values : base64encode(templatefile("${path.module}/modules/k8s-cluster/templates/cluster-setup-values.yaml", { client_id : var.vault_client_id client_secret : var.vault_client_secret })) - cluster_setup_values : base64encode(file("${path.module}/templates/argocd-values-ha.yaml")) - cluster_setup : base64encode(templatefile("${path.module}/templates/cluster-setup.sh", { + argocd_ha_values : base64encode(file("${path.module}/modules/k8s-cluster/templates/argocd-values-ha.yaml")) + cluster_setup : base64encode(templatefile("${path.module}/modules/k8s-cluster/templates/cluster-setup.sh", { argocd_environment : "test" high_availability : false })) diff --git a/terraform/modules/k8s-cluster/manager-node.tf b/terraform/modules/k8s-cluster/manager-node.tf index c0552b3..336124f 100644 --- a/terraform/modules/k8s-cluster/manager-node.tf +++ b/terraform/modules/k8s-cluster/manager-node.tf @@ -108,7 +108,7 @@ resource "hcloud_server" "manager" { client_id : var.vault_service_principal.client_id client_secret : var.vault_service_principal.client_secret })) - cluster_setup_values : base64encode(file("${path.module}/templates/argocd-values-ha.yaml")) + argocd_ha_values : base64encode(file("${path.module}/templates/argocd-values-ha.yaml")) cluster_setup : base64encode(templatefile("${path.module}/templates/cluster-setup.sh", { argocd_environment : var.argocd_environment high_availability : var.number_nodes > 2 diff --git a/terraform/modules/k8s-cluster/worker-node.tf b/terraform/modules/k8s-cluster/worker-node.tf index b5f83d2..e93743a 100644 --- a/terraform/modules/k8s-cluster/worker-node.tf +++ b/terraform/modules/k8s-cluster/worker-node.tf @@ -87,7 +87,7 @@ resource "hcloud_server" "worker" { client_id : var.vault_service_principal.client_id client_secret : var.vault_service_principal.client_secret })) - cluster_setup_values : base64encode(file("${path.module}/templates/argocd-values-ha.yaml")) + argocd_ha_values : base64encode(file("${path.module}/templates/argocd-values-ha.yaml")) cluster_setup : base64encode(templatefile("${path.module}/templates/cluster-setup.sh", { argocd_environment : var.argocd_environment high_availability : var.number_nodes > 2