forked from kubernetes/autoscaler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(hetzner): setup kubernetes-dev-setup
- Loading branch information
Showing
8 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.terraform/ | ||
terraform.tfstate* | ||
*.auto.tfvars | ||
|
||
files/ |
114 changes: 114 additions & 0 deletions
114
cluster-autoscaler/cloudprovider/hetzner/dev/.terraform.lock.hcl
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
SHELL = bash | ||
|
||
ENV ?= dev | ||
K3S_CHANNEL ?= stable | ||
|
||
env.auto.tfvars: | ||
@echo 'name = "$(ENV)"' > "$@" | ||
@echo 'hcloud_token = "$(HCLOUD_TOKEN)"' >> "$@" | ||
@echo 'k3s_channel = "$(K3S_CHANNEL)"' >> "$@" | ||
|
||
.terraform: | ||
tofu init | ||
|
||
validate: .terraform | ||
tofu validate | ||
|
||
up: .terraform env.auto.tfvars | ||
tofu apply -auto-approve | ||
$(MAKE) port-forward | ||
|
||
down: .terraform env.auto.tfvars | ||
files/registry-port-forward.sh down | ||
tofu destroy -auto-approve | ||
|
||
port-forward: | ||
source files/env.sh && files/registry-port-forward.sh up | ||
|
||
clean: | ||
rm -Rf files/ .terraform/ terraform.tfstate* env.auto.tfvars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module "dev" { | ||
source = "github.com/hetznercloud/kubernetes-dev-env?ref=v0.6.0" # x-release-please-version | ||
|
||
name = "cas-${replace(var.name, "/[^a-zA-Z0-9-_]/", "-")}" | ||
hcloud_token = var.hcloud_token | ||
|
||
k3s_channel = var.k3s_channel | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
variable "name" { | ||
type = string | ||
} | ||
variable "hcloud_token" { | ||
type = string | ||
sensitive = true | ||
} | ||
variable "k3s_channel" { | ||
type = string | ||
} |
8 changes: 8 additions & 0 deletions
8
cluster-autoscaler/cloudprovider/hetzner/examples/cloud-init.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
export K3S_URL=https://YOUR_IP:6443 | ||
# From /var/lib/rancher/k3s/server/token | ||
export K3S_TOKEN=YOUR_TOKEN | ||
export INSTALL_K3S_CHANNEL=v1.31 | ||
EXTERNAL_IP=$(ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}') | ||
INTERNAL_IP=$(ip -4 addr show enp7s0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}') | ||
curl -sfL https://get.k3s.io | sh -s - --kubelet-arg=cloud-provider=external --node-external-ip $EXTERNAL_IP --node-ip $INTERNAL_IP |
12 changes: 12 additions & 0 deletions
12
cluster-autoscaler/cloudprovider/hetzner/examples/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: kube-system | ||
|
||
resources: | ||
- cluster-autoscaler-run-on-master.yaml | ||
|
||
secretGenerator: | ||
- name: cluster-autoscaler-cloud-init | ||
files: | ||
- cloudinit=cloud-init.sh.b64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: skaffold/v4beta3 | ||
kind: Config | ||
metadata: | ||
name: cluster-autoscaler-hetzner | ||
build: | ||
artifacts: | ||
- image: registry.k8s.io/autoscaling/cluster-autoscaler | ||
context: ../../ | ||
ko: | ||
flags: | ||
- -tags=hetzner | ||
|
||
local: | ||
useBuildkit: true | ||
insecureRegistries: | ||
- localhost:30666 | ||
manifests: | ||
kustomize: | ||
paths: | ||
- examples/ |