Compare commits
2 Commits
2b7434c0e7
...
8b806b7a38
| Author | SHA1 | Date | |
|---|---|---|---|
|
8b806b7a38
|
|||
|
20e96b33df
|
@@ -25,5 +25,5 @@ patches:
|
|||||||
- !patch install-disk
|
- !patch install-disk
|
||||||
- !patch network
|
- !patch network
|
||||||
- !patch vip
|
- !patch vip
|
||||||
patchesControlplane:
|
patchesControlPlane:
|
||||||
- !patch allow-controlplane-workloads
|
- !patch allow-control-plane-workloads
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
netmask: 255.255.252.0
|
netmask: 255.255.252.0
|
||||||
gateway: 10.0.0.1
|
gateway: 10.0.0.1
|
||||||
clusterName: hellas
|
|
||||||
controlplaneIp: 10.0.2.1
|
|
||||||
installDisk: /dev/sda
|
installDisk: /dev/sda
|
||||||
|
cluster:
|
||||||
|
name: hellas
|
||||||
|
controlPlaneIp: 10.0.2.1
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
netmask: 255.255.255.0
|
netmask: 255.255.255.0
|
||||||
gateway: 192.168.1.1
|
gateway: 192.168.1.1
|
||||||
clusterName: testing
|
|
||||||
controlplaneIp: 192.168.1.100
|
|
||||||
installDisk: /dev/vda
|
installDisk: /dev/vda
|
||||||
|
cluster:
|
||||||
|
name: testing
|
||||||
|
controlPlaneIp: 192.168.1.100
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ machine:
|
|||||||
interfaces:
|
interfaces:
|
||||||
- interface: {{interface}}
|
- interface: {{interface}}
|
||||||
vip:
|
vip:
|
||||||
ip: {{controlplaneIp}}
|
ip: {{cluster.controlPlaneIp}}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ CONFIGS=${ROOT}/configs
|
|||||||
|
|
||||||
# Generate the configuration for each node
|
# Generate the configuration for each node
|
||||||
{% for node in nodes -%}
|
{% for node in nodes -%}
|
||||||
talosctl gen config {{ node.clusterName }} https://{{ node.controlplaneIp }}:6443 -f \
|
talosctl gen config {{ node.cluster.name }} https://{{ node.cluster.controlPlaneIp }}:6443 -f \
|
||||||
--with-secrets ${ROOT}/secrets.yaml \
|
--with-secrets ${ROOT}/secrets.yaml \
|
||||||
--talos-version {{ node.talosVersion }} \
|
--talos-version {{ node.talosVersion }} \
|
||||||
--kubernetes-version {{ node.kubernesVersion }} \
|
--kubernetes-version {{ node.kubernesVersion }} \
|
||||||
@@ -15,7 +15,7 @@ talosctl gen config {{ node.clusterName }} https://{{ node.controlplaneIp }}:644
|
|||||||
{# The double call to tojson is needed to properly escape the patch (object -> json -> string) -#}
|
{# The double call to tojson is needed to properly escape the patch (object -> json -> string) -#}
|
||||||
--config-patch {{ patch|tojson|tojson }} \
|
--config-patch {{ patch|tojson|tojson }} \
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
{% for patch in node.patchesControlplane -%}
|
{% for patch in node.patchesControlPlane -%}
|
||||||
--config-patch-control-plane {{ patch|tojson|tojson }} \
|
--config-patch-control-plane {{ patch|tojson|tojson }} \
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
--with-docs=false \
|
--with-docs=false \
|
||||||
@@ -24,9 +24,8 @@ talosctl gen config {{ node.clusterName }} https://{{ node.controlplaneIp }}:644
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
# Generate the talosconfig file for each cluster
|
# Generate the talosconfig file for each cluster
|
||||||
{# NOTE: This assumes that each node in a cluster specifies the same controlplane IP -#}
|
|
||||||
{% for cluster in clusters -%}
|
{% for cluster in clusters -%}
|
||||||
talosctl gen config {{ cluster.name }} https://{{ cluster.controlplaneIp }}:6443 -f \
|
talosctl gen config {{ cluster.name }} https://{{ cluster.controlPlaneIp }}:6443 -f \
|
||||||
--with-secrets ${ROOT}/secrets.yaml \
|
--with-secrets ${ROOT}/secrets.yaml \
|
||||||
--output-types talosconfig \
|
--output-types talosconfig \
|
||||||
-o ${CONFIGS}/{{ cluster.name }}/talosconfig
|
-o ${CONFIGS}/{{ cluster.name }}/talosconfig
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export TALOSCONFIG={{ root }}/configs/talosconfig
|
export TALOSCONFIG={{ root }}/configs/talosconfig
|
||||||
{% set paths = [] %}
|
{% set paths = [] %}
|
||||||
{%- for cluster_name in nodes|map(attribute="clusterName")|unique -%}
|
{%- for cluster in clusters -%}
|
||||||
{%- do paths.append(root ~ "/configs/" ~ cluster_name ~ "/kubeconfig") -%}
|
{%- do paths.append(root ~ "/configs/" ~ cluster.name ~ "/kubeconfig") -%}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
export KUBECONFIG={{ paths|join(":") }}
|
export KUBECONFIG={{ paths|join(":") }}
|
||||||
|
|||||||
14
tools/render
14
tools/render
@@ -135,15 +135,11 @@ def main():
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get all clusterName & controlplaneIp pairs
|
# Get all clusters
|
||||||
clusters = map(
|
# NOTE: This assumes that all nodes in the cluster use the same definition for the cluster
|
||||||
lambda node: {
|
clusters = [
|
||||||
"name": node["clusterName"],
|
dict(s) for s in set(frozenset(node["cluster"].items()) for node in nodes)
|
||||||
"controlplaneIp": node["controlplaneIp"],
|
]
|
||||||
},
|
|
||||||
nodes,
|
|
||||||
)
|
|
||||||
clusters = [dict(s) for s in set(frozenset(d.items()) for d in clusters)]
|
|
||||||
|
|
||||||
with open(ROOT.joinpath("config.yaml")) as fyaml:
|
with open(ROOT.joinpath("config.yaml")) as fyaml:
|
||||||
config = yaml.safe_load(fyaml)
|
config = yaml.safe_load(fyaml)
|
||||||
|
|||||||
Reference in New Issue
Block a user