Skip to content

Commit

Permalink
ci: output the kubeconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimonemms committed Nov 10, 2024
1 parent 861a21d commit 21f1a2f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -111,5 +113,13 @@ jobs:
tg_dir: ${{ env.WORKING_DIR }}
tg_command: run-all apply

- name: debug
run: |
whoami
sudo chown $(whoami):$(whoami) $KUBECONFIG
ls -la $KUBECONFIG
kubectl get nodes
- name: ArgoCD registry
run: kubectl apply -f registry/clusters/prod/registry.yaml
1 change: 1 addition & 0 deletions modules/hetzner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
| <a name="input_k3s_manager_load_balancer_type"></a> [k3s\_manager\_load\_balancer\_type](#input\_k3s\_manager\_load\_balancer\_type) | Load balancer type for the k3s manager nodes | `string` | `"lb11"` | no |
| <a name="input_k3s_manager_pool"></a> [k3s\_manager\_pool](#input\_k3s\_manager\_pool) | Manager pool configuration | <pre>object({<br> name = optional(string, "manager")<br> server_type = optional(string, "cx22")<br> count = optional(number, 1)<br> image = optional(string, "ubuntu-24.04")<br> })</pre> | `{}` | no |
| <a name="input_k3s_worker_pools"></a> [k3s\_worker\_pools](#input\_k3s\_worker\_pools) | Worker pools configuration | <pre>list(object({<br> name = string<br> server_type = optional(string, "cx22")<br> count = optional(number, 1)<br> image = optional(string, "ubuntu-24.04")<br> location = optional(string) # Defaults to var.location if not set<br> }))</pre> | `[]` | no |
| <a name="input_kubeconfig_output_path"></a> [kubeconfig\_output\_path](#input\_kubeconfig\_output\_path) | Output path for the Kubeconfig | `string` | `"~/.kube/config"` | no |
| <a name="input_location"></a> [location](#input\_location) | Location to use. This is a single datacentre. | `string` | `"nbg1"` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of project | `string` | `"k3s"` | no |
| <a name="input_network_subnet"></a> [network\_subnet](#input\_network\_subnet) | Subnet of the main network | `string` | `"10.0.0.0/16"` | no |
Expand Down
2 changes: 1 addition & 1 deletion modules/hetzner/k3s.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
6 changes: 6 additions & 0 deletions modules/hetzner/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 21f1a2f

Please sign in to comment.