diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 917580e..2058775 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,8 +12,10 @@ permissions: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }} + KUBECONFIG: ${{ github.workspace }}/.kubeconfig TF_TOKEN_app_terraform_io: ${{ secrets.TERRAFORM_CLOUD_SECRET }} TF_VAR_hcloud_token: ${{ secrets.HCLOUD_TOKEN }} + TF_VAR_kubeconfig_output_path: ${{ github.workspace }}/.kubeconfig TF_VAR_infisical_client_id: ${{ secrets.INFISICAL_CLIENT_ID }} TF_VAR_infisical_client_secret: ${{ secrets.INFISICAL_CLIENT_SECRET }} TF_VAR_ssh_key: ${{ secrets.SSH_KEY_PRIVATE }} @@ -111,5 +113,11 @@ jobs: tg_dir: ${{ env.WORKING_DIR }} tg_command: run-all apply + - name: debug + run: | + ls $KUBECONFIG + + kubectl get nodes + - name: ArgoCD registry run: kubectl apply -f registry/clusters/prod/registry.yaml diff --git a/modules/hetzner/README.md b/modules/hetzner/README.md index d73943d..d3f2da4 100644 --- a/modules/hetzner/README.md +++ b/modules/hetzner/README.md @@ -54,6 +54,7 @@ | [k3s\_manager\_load\_balancer\_type](#input\_k3s\_manager\_load\_balancer\_type) | Load balancer type for the k3s manager nodes | `string` | `"lb11"` | no | | [k3s\_manager\_pool](#input\_k3s\_manager\_pool) | Manager pool configuration |
object({| `{}` | no | | [k3s\_worker\_pools](#input\_k3s\_worker\_pools) | Worker pools configuration |
name = optional(string, "manager")
server_type = optional(string, "cx22")
count = optional(number, 1)
image = optional(string, "ubuntu-24.04")
})
list(object({| `[]` | no | +| [kubeconfig\_output\_path](#input\_kubeconfig\_output\_path) | Output path for the Kubeconfig | `string` | `"~/.kube/config"` | no | | [location](#input\_location) | Location to use. This is a single datacentre. | `string` | `"nbg1"` | no | | [name](#input\_name) | Name of project | `string` | `"k3s"` | no | | [network\_subnet](#input\_network\_subnet) | Subnet of the main network | `string` | `"10.0.0.0/16"` | no | diff --git a/modules/hetzner/k3s.tf b/modules/hetzner/k3s.tf index 4686276..109f634 100644 --- a/modules/hetzner/k3s.tf +++ b/modules/hetzner/k3s.tf @@ -65,7 +65,7 @@ module "k3s" { resource "local_sensitive_file" "kubeconfig" { content = module.k3s.kubeconfig - filename = pathexpand("~/.kube/config") + filename = pathexpand(var.kubeconfig_output_path) file_permission = "0600" directory_permission = "0755" } diff --git a/modules/hetzner/variables.tf b/modules/hetzner/variables.tf index d76db96..3627fe8 100644 --- a/modules/hetzner/variables.tf +++ b/modules/hetzner/variables.tf @@ -71,6 +71,12 @@ variable "k3s_worker_pools" { default = [] } +variable "kubeconfig_output_path" { + type = string + description = "Output path for the Kubeconfig" + default = "~/.kube/config" +} + variable "location" { type = string description = "Location to use. This is a single datacentre."
name = string
server_type = optional(string, "cx22")
count = optional(number, 1)
image = optional(string, "ubuntu-24.04")
location = optional(string) # Defaults to var.location if not set
}))