-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCTOPUS-466: add the new intel nodes to the loadbalancers
Signed-off-by: Paul Bastide <[email protected]>
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
################################################################ | ||
# Copyright 2023 - IBM Corporation. All rights reserved | ||
# SPDX-License-Identifier: Apache-2.0 | ||
################################################################ | ||
|
||
# The script updates the haproxy entries for the new intel nodes. | ||
|
||
## Example | ||
# backend ingress-http | ||
# balance source | ||
# server ZYZ-worker-0-http-router0 192.168.200.254:80 check | ||
# server ZYZ-worker-1-http-router1 192.168.200.79:80 check | ||
# server ZYZ-x86-worker-0-http-router2 10.245.0.45:80 check | ||
|
||
# backend ingress-https | ||
# balance source | ||
# server ZYZ-worker-0-https-router0 192.168.200.254:443 check | ||
# server ZYZ-worker-1-https-router1 192.168.200.79:443 check | ||
# server ZYZ-x86-worker-0-http-router2 10.245.0.45:443 check | ||
|
||
for INTEL_WORKER in $(oc get nodes -lkubernetes.io/arch=amd64 --no-headers=true -ojson | jq -c '.items[].status.addresses') | ||
do | ||
T_IP=$(echo "${INTEL_WORKER}" | jq -r '.[] | select(.type == "InternalIP").address') | ||
T_HOSTNAME=$(echo "${INTEL_WORKER}" | jq -r '.[] | select(.type == "Hostname").address') | ||
echo "FOUND: ${T_IP} ${T_HOSTNAME}" | ||
HTTP_LN=$(grep -Rn -A3 'backend ingress-http$' /etc/haproxy/haproxy.cfg | grep 'server ' | head -n 1 | sed 's|-| |' | awk '{print $1}') | ||
sed -i.bak "${HTTP_LN}i\ | ||
server ${T_HOSTNAME}-http-router0 ${T_IP}:80 check | ||
" /etc/haproxy/haproxy.cfg | ||
HTTPS_LN=$(grep -Rn -A3 'backend ingress-https$' /etc/haproxy/haproxy.cfg | grep 'server ' | head -n 1 | sed 's|-| |' | awk '{print $1}') | ||
sed -i.bak "${HTTPS_LN}i\ | ||
server ${T_HOSTNAME}-https-router0 ${T_IP}:443 check | ||
" /etc/haproxy/haproxy.cfg | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters