From 10085831a41ee151add28863854da1efd0bb4811 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Wed, 29 Mar 2023 15:36:24 +0200 Subject: Rename k3s-master to k3s-legacy This should do while I rework my k3s playbook --- playbooks.d/k3s-legacy/playbook.bash | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 playbooks.d/k3s-legacy/playbook.bash (limited to 'playbooks.d/k3s-legacy/playbook.bash') diff --git a/playbooks.d/k3s-legacy/playbook.bash b/playbooks.d/k3s-legacy/playbook.bash new file mode 100644 index 0000000..351064c --- /dev/null +++ b/playbooks.d/k3s-legacy/playbook.bash @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +playbook_add() { + info "$BASHTARD_PLAYBOOK" "Writing config.yaml for k3s" + mkdir -pv -- /etc/rancher/k3s + cat <<-EOF > /etc/rancher/k3s/config.yaml + node-name: ${BASHTARD_PLATFORM[fqdn]} + node-ip: $(config "k3s.network.ip" "$(config "vpn.ipv4" "127.0.0.1")") + bind-address: $(config "k3s.network.bind" "$(config "vpn.ipv4" "0.0.0.0")") + cluster-cidr: $(config "k3s.network.cidr.pods") + service-cidr: $(config "k3s.network.cidr.svcs") + cluster-dns: $(config "k3s.network.service.dns") + cluster-domain: $(config "k3s.domain") + disable: + - traefik + EOF + + info "$BASHTARD_PLAYBOOK" "Installing k3s" + curl -sfL https://get.k3s.io | sh - # I hate this + curl -L https://github.com/fluxcd/flux2/releases/download/v0.31.5/flux_0.31.5_linux_amd64.tar.gz | tar xzf - -C /usr/local/bin + + notice "$BASHTARD_PLAYBOOK" "Waiting for node to become available" + { grep -q -m 1 "${BASHTARD_PLATFORM[fqdn]}[[:space:]]\+Ready"; kill $!; } < <(k3s kubectl get node -w) + + info "$BASHTARD_PLAYBOOK" "Installing flux-system on k3s" + flux bootstrap git \ + --branch="$(config "k3s.flux.repo.branch")" \ + --cluster-domain="$(config "k3s.domain")" \ + --kubeconfig=/etc/rancher/k3s/k3s.yaml \ + --path="$(config "k3s.flux.repo.path" "playbooks.d/$BASHTARD_PLAYBOOK/manifests/clusters/${BASHTARD_PLATFORM[fqdn]}")" \ + --private-key-file="$(config "k3s.flux.repo.privkey" "$HOME/.ssh/id.d/$USER@$(hostname -s)-ed25519")" \ + --silent \ + --url="$(config "k3s.flux.repo.url")" +} + +playbook_sync() { + :; +} + +playbook_del() { + /usr/local/bin/k3s-uninstall.sh +} -- cgit v1.1