set-session-server-address script do not sanitize ip

The set-session-server-address script does not sanitize the ip.

When getting the service ip from the kubeapi, the script does not remove the comma at the end.

working example:

"status": {
    "loadBalancer": {
      "ingress": [
        {
          "ip": "172.30.90.104"
        }
      ]
    }
}

failing example:

"status": {
    "loadBalancer": {
      "ingress": [
        {
          "ip": "172.30.90.104",
          "ipMode": "VIP"
        }
      ]
    }
}

In the first example the script is working perfectly. In the second the ip is "172.30.90.104",, This will not fail until you try to connect using the gitlab terminal.

Potential fix could be to remove the extra comma with tr here and maybe for the aws hostname too (I don't know)

SERVICEIP=$(curl —-silent \
  --cacert ${CACERT} \
  --header "${header}" \
  -X GET ${SERVICEURL} 2>/dev/null \
  | grep '"ip":' | cut -d ":" -f2 | tr -d ',' | xargs) # adding | tr -d ','
Edited by Jean-Loup MONNIER