diff --git a/.config.sample.env b/.config.sample.env index a43eef21..012a3d31 100644 --- a/.config.sample.env +++ b/.config.sample.env @@ -6,9 +6,9 @@ # e.g. https://github.com/k8s-at-home/home-cluster export BOOTSTRAP_GIT_REPOSITORY="" -# To enable Flux to update your cluster on `git push` set the following to one of: -# `ignored` - this feature will be disabled -# `generated` - this will generate a token and print it in the logs +# Optional: Enable GitHub to send a webhook to update Flux, set the following to one of: +# ignored - this feature will be disabled +# generated - this will generate a token and print it in the logs # Set this to any other string and it will be used for the secret export BOOTSTRAP_FLUX_GITHUB_WEBHOOK_SECRET="ignored" @@ -76,7 +76,7 @@ export BOOTSTRAP_ANSIBLE_SSH_USERNAME_0="" export BOOTSTRAP_ANSIBLE_SUDO_PASSWORD_0="" # Set this node as a control node (true/false) export BOOTSTRAP_ANSIBLE_CONTROL_NODE_0="" -# Optionally set the hostname of the node, if set this will override the *_HOSTNAME_PREFIX vars above +# Optional: Set the hostname of the node, if set this will override the *_HOSTNAME_PREFIX vars above export BOOTSTRAP_ANSIBLE_HOSTNAME_0="" # export BOOTSTRAP_ANSIBLE_HOST_ADDR_1="" diff --git a/configure.sh b/configure.sh index b28bed8e..51439bbc 100755 --- a/configure.sh +++ b/configure.sh @@ -146,34 +146,34 @@ verify_addressing() { local found_traefik="false" # Verify the metallb min and metallb ceiling are in the same network - metallb_ip_subnet_min=$(echo "${BOOTSTRAP_METALLB_LB_RANGE}" | cut -d- -f1 | cut -d. -f1,2,3) - metallb_ip_subnet_ceil=$(echo "${BOOTSTRAP_METALLB_LB_RANGE}" | cut -d- -f2 | cut -d. -f1,2,3) - if [[ "${metallb_ip_subnet_min}" != "${metallb_ip_subnet_ceil}" ]]; then + metallb_subnet_min=$(echo "${BOOTSTRAP_METALLB_LB_RANGE}" | cut -d- -f1 | cut -d. -f1,2,3) + metallb_subnet_ceil=$(echo "${BOOTSTRAP_METALLB_LB_RANGE}" | cut -d- -f2 | cut -d. -f1,2,3) + if [[ "${metallb_subnet_min}" != "${metallb_subnet_ceil}" ]]; then _log "ERROR" "The provided MetalLB IP range '${BOOTSTRAP_METALLB_LB_RANGE}' is not in the same subnet" exit 1 fi # Verify the node IP addresses are on the same network as the metallb range for var in "${!BOOTSTRAP_ANSIBLE_HOST_ADDR_@}"; do - node_ip_subnet=$(echo "${!var}" | cut -d. -f1,2,3) - if [[ "${node_ip_subnet}" != "${metallb_ip_subnet_min}" ]]; then + node_subnet=$(echo "${!var}" | cut -d. -f1,2,3) + if [[ "${node_subnet}" != "${metallb_subnet_min}" ]]; then _log "ERROR" "The subnet for node '${!var}' is not in the same subnet as the provided metallb range '${BOOTSTRAP_METALLB_LB_RANGE}'" exit 1 fi done # Verify the kube-vip IP is in the same network as the metallb range - kubevip_ip_subnet=$(echo "${BOOTSTRAP_KUBE_VIP_ADDR}" | cut -d. -f1,2,3) - if [[ "${kubevip_ip_subnet}" != "${metallb_ip_subnet_min}" ]]; then + kubevip_subnet=$(echo "${BOOTSTRAP_KUBE_VIP_ADDR}" | cut -d. -f1,2,3) + if [[ "${kubevip_subnet}" != "${metallb_subnet_min}" ]]; then _log "ERROR" "The subnet for kupe-vip '${BOOTSTRAP_KUBE_VIP_ADDR}' is not the same subnet as the provided metallb range '${BOOTSTRAP_METALLB_LB_RANGE}'" exit 1 fi # Depending on the IP address, verify if it should be in the metallb range or not - metallb_ip_octet_min=$(echo "${BOOTSTRAP_METALLB_LB_RANGE}" | cut -d- -f1 | cut -d. -f4) - metallb_ip_octet_ceil=$(echo "${BOOTSTRAP_METALLB_LB_RANGE}" | cut -d- -f2 | cut -d. -f4) - for (( octet=metallb_ip_octet_min; octet<=metallb_ip_octet_ceil; octet++ )); do - addr="${metallb_ip_subnet_min}.${octet}" + metallb_octet_min=$(echo "${BOOTSTRAP_METALLB_LB_RANGE}" | cut -d- -f1 | cut -d. -f4) + metallb_octet_ceil=$(echo "${BOOTSTRAP_METALLB_LB_RANGE}" | cut -d- -f2 | cut -d. -f4) + for (( octet=metallb_octet_min; octet<=metallb_octet_ceil; octet++ )); do + addr="${metallb_subnet_min}.${octet}" if [[ "${addr}" == "${BOOTSTRAP_KUBE_VIP_ADDR}" ]]; then found_kube_vip="true" fi