Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: switch from terraform to hetzner-k3s #53

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
"installTerraformDocs": true
},
"ghcr.io/dhoeric/features/trivy:1": {},
"ghcr.io/devcontainers-contrib/features/argo-cd:1": {}
"ghcr.io/devcontainers-contrib/features/argo-cd:1": {},
"ghcr.io/devcontainers-extra/features/gh-release:1": {
"repo": "vitobotta/hetzner-k3s",
"binaryNames": "hetzner-k3s"
}
},
"customizations": {
"vscode": {
Expand All @@ -31,5 +35,8 @@
},
"postAttachCommand": {
"ensureKubeDir": "mkdir -p /home/vscode/.kube"
},
"containerEnv": {
"KUBE_CONFIG_PATH": "~/.kube/config"
}
}
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.

CLUSTER ?= dev
CLUSTER_ROOT = ./clusters
CONFIG_FILE ?= /tmp/config.yaml

cruft-update:
ifeq (,$(wildcard .cruft.json))
@echo "Cruft not configured"
else
@cruft check || cruft update --skip-apply-ask --refresh-private-variables
endif
.PHONY: cruft-update

create:
$(MAKE) generate-config

hetzner-k3s create --config ${CONFIG_FILE}
.PHONY: create

delete:
$(MAKE) generate-config

hetzner-k3s delete --config ${CONFIG_FILE}
.PHONY: delete

generate-config:
@yq '. *= load("${CLUSTER_ROOT}/${CLUSTER}.yaml")' ${CLUSTER_ROOT}/common.yaml > ${CONFIG_FILE}
.PHONY: generate-config
41 changes: 41 additions & 0 deletions clusters/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
kubeconfig_path: "~/.kube/config"
k3s_version: v1.31.3+k3s1

networking:
ssh:
port: 2244
use_agent: false
public_key_path: "~/.ssh/homelab.pub"
private_key_path: "~/.ssh/homelab"
allowed_networks:
ssh:
- 0.0.0.0/0
api:
- 0.0.0.0/0
public_network:
ipv4: true
ipv6: true
private_network:
enabled: true
subnet: 10.0.0.0/16
cni:
enabled: true
encryption: true
mode: cilium

datastore:
mode: etcd

embedded_registry_mirror:
enabled: true

schedule_workloads_on_masters: true

image: ubuntu-24.04

masters_pool:
instance_type: cx32
instance_count: 3
location: nbg1

worker_node_pools: []
4 changes: 4 additions & 0 deletions clusters/dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cluster_name: dev
networking:
private_network:
subnet: 10.2.0.0/16
11 changes: 11 additions & 0 deletions clusters/prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cluster_name: prod

worker_node_pools:
- name: pool1
instance_type: cx32
instance_count: 0
location: nbg1
autoscaling:
enabled: true
min_instances: 0
max_instances: 3
63 changes: 0 additions & 63 deletions modules/hetzner/.terraform.lock.hcl

This file was deleted.

82 changes: 0 additions & 82 deletions modules/hetzner/README.md

This file was deleted.

32 changes: 0 additions & 32 deletions modules/hetzner/files/cloud-config.yaml

This file was deleted.

70 changes: 0 additions & 70 deletions modules/hetzner/k3s.tf

This file was deleted.

Loading
Loading