Skip to content

Commit

Permalink
issue 75 - add optional swap partition for agents
Browse files Browse the repository at this point in the history
  • Loading branch information
rayui committed Nov 20, 2023
1 parent 01f963b commit 3cf49a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ For each agent, you will need to provide:
- the agent node's hardware address
- its IPv4 address
- a UUID for a partition containing an ext4 filesystem for `K3S` persistent local storage
- an optional UUID for a swap partition
- its PXE client ID
- any extra args for K3s that the agent might need (optional)

Expand Down
1 change: 1 addition & 0 deletions agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Example agent description file:
AGENT_ETHERNET=b8:27:eb:81:1a:52
AGENT_IP=192.168.64.65
AGENT_RANCHER_PART_UUID=d5f9e6c2-493c-48da-baf2-0c63dd7a36b1
AGENT_SWAP_PART_UUID=e5f9e6c2-493c-48da-baf2-0c63dd7a36b2
AGENT_PXE_ID=c6811a52
AGENT_K3S_ARGS="--node-label 'smarter-device-manager=enabled'"
```
7 changes: 7 additions & 0 deletions scripts/configure-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ ${LC_INTERNAL_IP}:${MOUNT_DIR}/${AGENT} / nfs defaults 0 0
UUID="${AGENT_RANCHER_PART_UUID}" ${RANCHERSTORAGEPATH} ext4 defaults 0 0
EOF

if [ ! -z ${AGENT_SWAP_PART_UUID} ]; then
cat - >> ${AGENT_ROOT}/etc/fstab << EOF
UUID="${AGENT_SWAP_PART_UUID}" none swap sw 0 0
EOF
fi

### CREATE AGENT DNSMASQ ENTRY
cat - > ${ROOT_MNT}/etc/dnsmasq.d/20-scooby-agent-${AGENT} << EOF
dhcp-host=net:${AGENT},${AGENT_ETHERNET},${AGENT},${AGENT_IP},24h
Expand Down Expand Up @@ -148,6 +154,7 @@ configureAgents() {
FSID=1
for FILE in $(cd ${AGENT_DIR}; ls *.agent)
do
AGENT_SWAP_PART_UUID=""
. ${AGENT_DIR}/${FILE}
configureAgent $(printf "${FILE}" | grep -oE "^[a-z0-9\-]+")
FSID=$((FSID+1))
Expand Down

0 comments on commit 3cf49a0

Please sign in to comment.