mirror of
https://github.com/optim-enterprises-bv/terraform-talos.git
synced 2025-11-02 11:18:35 +00:00
Can redefine IPv6
This commit is contained in:
@@ -11,8 +11,8 @@ create-config:
|
|||||||
|
|
||||||
create-templates:
|
create-templates:
|
||||||
@yq ea -P '. as $$item ireduce ({}; . * $$item )' _cfgs/controlplane.yaml templates/controlplane.yaml.tpl > templates/controlplane.yaml
|
@yq ea -P '. as $$item ireduce ({}; . * $$item )' _cfgs/controlplane.yaml templates/controlplane.yaml.tpl > templates/controlplane.yaml
|
||||||
@echo 'podSubnets: "10.32.0.0/12"' > _cfgs/tfstate.vars
|
@echo 'podSubnets: "10.32.0.0/12,fd00:10:32::/102"' > _cfgs/tfstate.vars
|
||||||
@echo 'serviceSubnets: "10.200.0.0/22"' >> _cfgs/tfstate.vars
|
@echo 'serviceSubnets: "10.200.0.0/22,fd40:10:200::/112"' >> _cfgs/tfstate.vars
|
||||||
@yq eval '.cluster.network.dnsDomain' _cfgs/init.yaml | awk '{ print "domain: "$$1}' >> _cfgs/tfstate.vars
|
@yq eval '.cluster.network.dnsDomain' _cfgs/init.yaml | awk '{ print "domain: "$$1}' >> _cfgs/tfstate.vars
|
||||||
@yq eval '.cluster.clusterName' _cfgs/init.yaml | awk '{ print "cluster_name: "$$1}' >> _cfgs/tfstate.vars
|
@yq eval '.cluster.clusterName' _cfgs/init.yaml | awk '{ print "cluster_name: "$$1}' >> _cfgs/tfstate.vars
|
||||||
@yq eval '.machine.token' _cfgs/init.yaml | awk '{ print "tokenmachine: "$$1}' >> _cfgs/tfstate.vars
|
@yq eval '.machine.token' _cfgs/init.yaml | awk '{ print "tokenmachine: "$$1}' >> _cfgs/tfstate.vars
|
||||||
@@ -22,9 +22,9 @@ create-templates:
|
|||||||
@yq eval -j '{"kubernetes": .}' _cfgs/tfstate.vars > terraform.tfvars.json
|
@yq eval -j '{"kubernetes": .}' _cfgs/tfstate.vars > terraform.tfvars.json
|
||||||
|
|
||||||
create-controlplane:
|
create-controlplane:
|
||||||
cd modules/worker && terraform init
|
|
||||||
terraform init
|
terraform init
|
||||||
terraform apply -target=null_resource.controlplane_apply
|
terraform apply -target=null_resource.controlplane
|
||||||
|
|
||||||
create-infrastructure:
|
create-infrastructure:
|
||||||
|
cd modules/worker && terraform init
|
||||||
terraform apply
|
terraform apply
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ resource "hcloud_server" "controlplane" {
|
|||||||
|
|
||||||
lifecycle {
|
lifecycle {
|
||||||
ignore_changes = [
|
ignore_changes = [
|
||||||
|
image,
|
||||||
server_type,
|
server_type,
|
||||||
user_data,
|
user_data,
|
||||||
ssh_keys,
|
ssh_keys,
|
||||||
@@ -53,10 +54,10 @@ resource "local_file" "controlplane" {
|
|||||||
depends_on = [hcloud_server.controlplane]
|
depends_on = [hcloud_server.controlplane]
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "null_resource" "controlplane_apply" {
|
resource "null_resource" "controlplane" {
|
||||||
count = lookup(var.controlplane, "count", 0)
|
count = lookup(var.controlplane, "count", 0)
|
||||||
provisioner "local-exec" {
|
provisioner "local-exec" {
|
||||||
command = "sleep 60 && ./talosctl apply-config --insecure --nodes ${hcloud_server.controlplane[count.index].ipv4_address} --file controlplane-${count.index + 1}.yaml"
|
command = "sleep 60 && talosctl apply-config --insecure --nodes ${hcloud_server.controlplane[count.index].ipv4_address} --file controlplane-${count.index + 1}.yaml"
|
||||||
}
|
}
|
||||||
depends_on = [local_file.controlplane]
|
depends_on = [hcloud_load_balancer_target.api, local_file.controlplane]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ resource "hcloud_server" "worker" {
|
|||||||
|
|
||||||
lifecycle {
|
lifecycle {
|
||||||
ignore_changes = [
|
ignore_changes = [
|
||||||
|
image,
|
||||||
|
server_type,
|
||||||
user_data,
|
user_data,
|
||||||
ssh_keys,
|
ssh_keys,
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ resource "hcloud_server" "talos" {
|
|||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
"apt-get install -y wget",
|
"apt-get install -y wget",
|
||||||
"wget -O /tmp/openstack.tar.gz https://github.com/talos-systems/talos/releases/download/v0.11.0-alpha.0/openstack-amd64.tar.gz",
|
"wget -O /tmp/openstack.tar.gz https://github.com/talos-systems/talos/releases/download/${var.talos_version}/openstack-amd64.tar.gz",
|
||||||
"cd /tmp && tar xzf /tmp/openstack.tar.gz && dd if=/tmp/disk.raw of=/dev/sda && sync",
|
"cd /tmp && tar xzf /tmp/openstack.tar.gz && dd if=/tmp/disk.raw of=/dev/sda && sync",
|
||||||
|
"mount /dev/sda3 /mnt && sed -i 's/set timeout=3/set timeout=10/g' /mnt/grub/grub.cfg && umount /mnt",
|
||||||
"shutdown -h now"
|
"shutdown -h now"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,3 +18,9 @@ variable "tags" {
|
|||||||
environment = "Develop"
|
environment = "Develop"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "talos_version" {
|
||||||
|
description = "Talos image version"
|
||||||
|
type = string
|
||||||
|
default = "v0.10.0"
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,15 +30,15 @@ machine:
|
|||||||
cidr: "169.254.2.53/32"
|
cidr: "169.254.2.53/32"
|
||||||
- interface: dummy0
|
- interface: dummy0
|
||||||
cidr: "fd00::169:254:2:53/128"
|
cidr: "fd00::169:254:2:53/128"
|
||||||
|
install:
|
||||||
|
disk: /dev/sda
|
||||||
|
bootloader: true
|
||||||
|
wipe: false
|
||||||
|
extraKernelArgs:
|
||||||
|
- elevator=noop
|
||||||
sysctls:
|
sysctls:
|
||||||
net.core.somaxconn: 65535
|
net.core.somaxconn: 65535
|
||||||
net.core.netdev_max_backlog: 4096
|
net.core.netdev_max_backlog: 4096
|
||||||
install:
|
|
||||||
disk: /dev/sda
|
|
||||||
extraKernelArgs:
|
|
||||||
- elevator=noop
|
|
||||||
bootloader: true
|
|
||||||
wipe: false
|
|
||||||
systemDiskEncryption:
|
systemDiskEncryption:
|
||||||
ephemeral:
|
ephemeral:
|
||||||
provider: luks2
|
provider: luks2
|
||||||
@@ -49,15 +49,13 @@ cluster:
|
|||||||
controlPlane:
|
controlPlane:
|
||||||
endpoint: https://${lbv4}:6443
|
endpoint: https://${lbv4}:6443
|
||||||
network:
|
network:
|
||||||
|
dnsDomain: ${domain}
|
||||||
|
podSubnets: ${format("[%s]",podSubnets)}
|
||||||
|
serviceSubnets: ${format("[%s]",serviceSubnets)}
|
||||||
cni:
|
cni:
|
||||||
name: custom
|
name: custom
|
||||||
urls:
|
urls:
|
||||||
- https://raw.githubusercontent.com/sergelogvinov/terraform-talos/main/hetzner/deployments/cilium_result.yaml
|
- https://raw.githubusercontent.com/sergelogvinov/terraform-talos/main/hetzner/deployments/cilium_result.yaml
|
||||||
dnsDomain: ${domain}
|
|
||||||
podSubnets:
|
|
||||||
- ${podSubnets}
|
|
||||||
serviceSubnets:
|
|
||||||
- ${serviceSubnets}
|
|
||||||
proxy:
|
proxy:
|
||||||
disabled: true
|
disabled: true
|
||||||
mode: ipvs
|
mode: ipvs
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ variable "regions" {
|
|||||||
variable "kubernetes" {
|
variable "kubernetes" {
|
||||||
type = map(string)
|
type = map(string)
|
||||||
default = {
|
default = {
|
||||||
podSubnets = "10.32.0.0/12"
|
podSubnets = "10.32.0.0/12,f00d:10:32::/64"
|
||||||
serviceSubnets = "10.200.0.0/22"
|
serviceSubnets = "10.200.0.0/22,fd40:10:200::/112"
|
||||||
domain = "cluster.local"
|
domain = "cluster.local"
|
||||||
cluster_name = "talos-k8s-hezner"
|
cluster_name = "talos-k8s-hezner"
|
||||||
tokenmachine = ""
|
tokenmachine = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user