-
-
Save devulrix/84a2ce581662a464f788aa040cd63c41 to your computer and use it in GitHub Desktop.
Enable XFF on NSX-T LB with non NSX-T Ingress for TKGi
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # | |
| usage() { | |
| echo "Usage: $0 [ -n CONTROLLER URL ] [-u ADMIN ] [-p PASSWORD ] [-s SERVER_POOL ]" | |
| } | |
| exit_abnormal() { | |
| usage | |
| exit 1 | |
| } | |
| while getopts n:u:p:s: flag | |
| do | |
| case "${flag}" in | |
| n) NSXT_URL=${OPTARG};; | |
| u) NSXT_ADMIN=${OPTARG};; | |
| p) NSXT_PASSWORD=${OPTARG};; | |
| s) NSXT_SERVERPOOL=${OPTARG};; | |
| *) exit_abnormal;; | |
| esac | |
| done | |
| PAYLOAD=$(curl -k -s -u ${NSXT_ADMIN}:${NSXT_PASSWORD} -X GET "${NSXT_URL}/api/v1/loadbalancer/pools/${NSXT_SERVERPOOL}" | jq -r 'del(.snat_translation)') | |
| curl -k -s -u ${NSXT_ADMIN}:${NSXT_PASSWORD} -H "Content-Type: application/json" -X PUT "${NSXT_URL}/api/v1/loadbalancer/pools/${NSXT_SERVERPOOL}" -d "${PAYLOAD}" -H "X-Allow-Overwrite: true" | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment