summaryrefslogtreecommitdiff
path: root/playbooks.d
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2024-06-24 19:03:37 +0200
committerPatrick Spek <p.spek@tyil.nl>2024-06-24 19:03:37 +0200
commit81bc1fdb032f4a4afacca94275a3948f9cb17722 (patch)
treebb12d101ef3ece073080a43c0e2b15455b622b78 /playbooks.d
parent06a3d034d75d4b210f7e3c23be4c356ef649e882 (diff)
Retry adding a flannel-iface
Diffstat (limited to 'playbooks.d')
-rw-r--r--playbooks.d/k3s-master/playbook.bash12
-rw-r--r--playbooks.d/k3s-node/playbook.bash17
2 files changed, 22 insertions, 7 deletions
diff --git a/playbooks.d/k3s-master/playbook.bash b/playbooks.d/k3s-master/playbook.bash
index cfd0330..f19fe8c 100644
--- a/playbooks.d/k3s-master/playbook.bash
+++ b/playbooks.d/k3s-master/playbook.bash
@@ -10,6 +10,7 @@ playbook_add() {
node-name: "${BASHTARD_PLATFORM[fqdn]}"
node-ip: "$(config "$BASHTARD_PLAYBOOK.internal-ip" "127.0.0.1")"
bind-address: "$(config "$BASHTARD_PLAYBOOK.bind-address" "0.0.0.0")"
+ flannel-backend: wireguard-native
cluster-cidr: "$(config "$BASHTARD_PLAYBOOK.cluster-cidr" "172.19.0.0/16")"
cluster-domain: "$(config "$BASHTARD_PLAYBOOK.cluster-domain" "cluster.local")"
service-cidr: "$(config "$BASHTARD_PLAYBOOK.service-cidr" "172.20.0.0/16")"
@@ -17,17 +18,22 @@ playbook_add() {
- traefik
EOF
+ if [[ -n "$(config "$BASHTARD_PLAYBOOK.flannel-iface" "")" ]]
+ then
+ printf "flannel-iface: \"%s\"\n" "$(config "$BASHTARD_PLAYBOOK.flannel-iface")"
+ fi
+
if [[ -n "$(config "$BASHTARD_PLAYBOOK.external-ip" "")" ]]
then
- printf "%s: \"%s\"\n" "node-external-ip" "$(config "$BASHTARD_PLAYBOOK.external-ip" "")"
+ printf "node-external-ip: \"%s\"\n" "$(config "$BASHTARD_PLAYBOOK.external-ip")"
fi
} > "$(config "fs.etcdir")/rancher/k3s/config.yaml"
info "$BASHTARD_PLAYBOOK/add" "Installing k3s"
curl -sfL https://get.k3s.io | sh -s - server --cluster-init # I hate this
- #notice "$BASHTARD_PLAYBOOK/add" "Creating data directories"
- #mkdir -pv -- "$(playbook_path "data")/manifests.d"
+ notice "$BASHTARD_PLAYBOOK/add" "Creating data directories"
+ mkdir -pv -- "$(playbook_path "data")/manifests.d"
notice "$BASHTARD_PLAYBOOK/add" "Waiting for node to become available"
{ grep -q -m 1 "${BASHTARD_PLATFORM[fqdn]}[[:space:]]\+Ready"; kill $!; } < <(k3s kubectl get node -w)
diff --git a/playbooks.d/k3s-node/playbook.bash b/playbooks.d/k3s-node/playbook.bash
index 361c176..e5eb2a6 100644
--- a/playbooks.d/k3s-node/playbook.bash
+++ b/playbooks.d/k3s-node/playbook.bash
@@ -40,27 +40,36 @@ playbook_add() {
cat <<-EOF
node-name: "${BASHTARD_PLATFORM[fqdn]}"
node-ip: "$(config "$BASHTARD_PLAYBOOK.internal-ip" "127.0.0.1")"
- server: "https://$(config "$BASHTARD_PLAYBOOK.entry.host"):$(config "$BASHTARD_PLAYBOOK.entry.port" "6443")"
- token: "$token"
EOF
+ if [[ -n "$(config "$BASHTARD_PLAYBOOK.flannel-iface" "")" ]]
+ then
+ printf "flannel-iface: \"%s\"\n" "$(config "$BASHTARD_PLAYBOOK.flannel-iface")"
+ fi
+
if [[ -n "$(config "$BASHTARD_PLAYBOOK.external-ip" "")" ]]
then
- printf "%s: \"%s\"\n" "node-external-ip" "$(config "$BASHTARD_PLAYBOOK.external-ip" "")"
+ printf "node-external-ip: \"%s\"\n" "$(config "$BASHTARD_PLAYBOOK.external-ip")"
fi
if [[ "$role" == "server" ]]
then
info "$BASHTARD_PLAYBOOK/add" "Node is a server, adding master configuration"
- cat <<-EOF >> /etc/rancher/k3s/config.yaml
+ cat <<-EOF
+ bind-address: "$(config "$BASHTARD_PLAYBOOK.bind-address" "0.0.0.0")"
cluster-cidr: "$(config "$BASHTARD_PLAYBOOK.cluster-cidr" "172.19.0.0/16")"
cluster-domain: "$(config "$BASHTARD_PLAYBOOK.cluster-domain" "cluster.local")"
+ flannel-backend: wireguard-native
service-cidr: "$(config "$BASHTARD_PLAYBOOK.service-cidr" "172.20.0.0/16")"
service-node-port-range: "$(config "$BASHTARD_PLAYBOOK.service-node-port-min" "30000")-$(config "$BASHTARD_PLAYBOOK.service-node-port-max" "32767")"
disable:
- traefik
EOF
fi
+
+ printf "\n"
+ printf "server: %s\n" "https://$(config "$BASHTARD_PLAYBOOK.entry.host"):$(config "$BASHTARD_PLAYBOOK.entry.port" "6443")"
+ printf "token: %s\n" "$token"
} > "$(config "fs.etcdir")/rancher/k3s/config.yaml"
info "$BASHTARD_PLAYBOOK/add" "Installing k3s"