fix: add validations for node IPs and load balancer IPs

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl committed 2022-05-06 12:51:52 -04:00
1 parent 77130aac02
commit e19ba910f5
2 files changed
+18 -1

No files matched your search

+3 -1
View File
@@ -36,10 +36,12 @@ export BOOTSTRAP_AGE_PUBLIC_KEY=""
#
# The network interface on the host kube-vip should attach to
# Look this up on your nodes to verify what NIC to use
# e.g. eno1
export BOOTSTRAP_ANSIBLE_KUBE_VIP_INTERFACE=""
# IP Address to use with KubeVIP
# The IP Address to use with KubeVIP
# Pick a unused IP that is on the same network as your nodes
# and also outside the ${BOOTSTRAP_METALLB_TRAEFIK_ADDR} range
# e.g. 192.168.1.254
export BOOTSTRAP_ANSIBLE_KUBE_VIP_ADDRESS=""
+15
View File
@@ -284,6 +284,21 @@ verify_ansible_hosts() {
_has_envar "${node_control}"
_has_optional_envar "${node_hostname}"
if [[ "${node_addr}" == "${BOOTSTRAP_ANSIBLE_KUBE_VIP_ADDRESS}" ]]; then
_log "ERROR" "The kube-vip IP '${BOOTSTRAP_ANSIBLE_KUBE_VIP_ADDRESS}' should not be the same as the IP for node '${node_addr}'"
exit 1
fi
if [[ "${node_addr}" == "${BOOTSTRAP_METALLB_K8S_GATEWAY_ADDR}" ]]; then
_log "ERROR" "The k8s-gateway load balancer IP '${BOOTSTRAP_METALLB_K8S_GATEWAY_ADDR}' should not be the same as the IP for node '${node_addr}'"
exit 1
fi
if [[ "${node_addr}" == "${BOOTSTRAP_METALLB_TRAEFIK_ADDR}" ]]; then
_log "ERROR" "The traefik load balancer IP '${BOOTSTRAP_METALLB_TRAEFIK_ADDR}' should not be the same as the IP for node '${node_addr}'"
exit 1
fi
if ssh -q -o BatchMode=yes -o ConnectTimeout=5 "${!node_username}"@"${!var}" "true"; then
_log "INFO" "Successfully SSH'ed into host '${!var}' with username '${!node_username}'"
else