Define kubernetes map

This commit is contained in:
Serge Logvinov
2021-06-04 00:09:55 +03:00
parent de4a4401e7
commit da4c7a0fe9
4 changed files with 17 additions and 4 deletions

1
.gitignore vendored
View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 = ""
}
}