mirror of
https://github.com/optim-enterprises-bv/terraform-talos.git
synced 2025-10-29 17:42:47 +00:00
Define kubernetes map
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -17,6 +17,7 @@ crash.log
|
||||
# version control.
|
||||
#
|
||||
terraform.tfvars
|
||||
terraform.tfvars.json
|
||||
|
||||
# Ignore override files as they are usually used to override resources locally and so
|
||||
# are not checked in
|
||||
|
||||
@@ -38,7 +38,7 @@ make prepare-image
|
||||
Generate the default talos config
|
||||
|
||||
```shell
|
||||
make create-config
|
||||
make create-config create-templates
|
||||
```
|
||||
|
||||
open config file **terraform.tfvars** and add params
|
||||
|
||||
@@ -8,9 +8,21 @@ prepare-image:
|
||||
|
||||
create-config:
|
||||
talosctl gen config --output-dir _cfgs --with-docs=false --with-examples=false talos-k8s-hezner https://127.0.0.1:6443
|
||||
yq ea -P '. as $item ireduce ({}; . * $item )' _cfgs/controlplane.yaml templates/controlplane.yaml.tpl > templates/controlplane.yaml
|
||||
|
||||
create-templates:
|
||||
@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 'serviceSubnets: "10.200.0.0/22"' >> _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 '.machine.token' _cfgs/init.yaml | awk '{ print "tokenmachine: "$$1}' >> _cfgs/tfstate.vars
|
||||
@yq eval '.cluster.token' _cfgs/init.yaml | awk '{ print "token: "$$1}' >> _cfgs/tfstate.vars
|
||||
@yq eval '.cluster.ca.crt' _cfgs/init.yaml | awk '{ print "ca: "$$1}' >> _cfgs/tfstate.vars
|
||||
|
||||
@yq eval -j '{"kubernetes": .}' _cfgs/tfstate.vars > terraform.tfvars.json
|
||||
|
||||
create-controlplane:
|
||||
cd modules/worker && terraform init
|
||||
terraform init
|
||||
terraform apply -target=null_resource.controlplane_apply
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ variable "kubernetes" {
|
||||
serviceSubnets = "10.200.0.0/22"
|
||||
domain = "cluster.local"
|
||||
cluster_name = "talos-k8s-hezner"
|
||||
tokenmachine = "4g8t1y.u3xw5r11fzyfuj8y"
|
||||
token = "wq93rz.dsvn0aw5erdwp78f"
|
||||
tokenmachine = ""
|
||||
token = ""
|
||||
ca = ""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user