Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation about adding instances automatically from a tag in a load balancer backend #1530

Closed
remyleone opened this issue Nov 16, 2020 · 2 comments · Fixed by #2683
Closed
Assignees
Labels
documentation enhancement instance Instance issues, bugs and feature requests load-balancer Load-balancer issues, bugs and feature requests

Comments

@remyleone
Copy link
Member

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

How I imagine scw could expose this functionality

References

@willoucom
Copy link

Here is a small script to replace backend ip by any instance by tag

#!/bin/bash

set -e

LB_NAME=$1
TAG=$2

cmd_f_help () {
  cat << _HELP_
Add Instance private IP to LB of your choice

  Usage :
    First parameter: Name of the load balancer
    Second parameter: Tag of your VM
_HELP_
}

if [ $# -lt 2 ]
then
    cmd_f_help
    exit 1
fi

LB_ID=$(scw lb lb list name="${LB_NAME}" -o template="{{ .ID }}")
LB_BACKEND=$(scw lb backend list lb-id="${LB_ID}" -o template="{{ .ID }}")
INSTANCE_IP=$(scw instance server list tags.0="${TAG}"  -o template="{{ .PrivateIP }}")

i=0
IPS=""
for variable in $INSTANCE_IP
do
    IPS="${IPS} server-ip.$i=$variable"
    ((i=i+1))
done

for BACKEND in $LB_BACKEND
do
    scw lb backend set-servers $BACKEND $IPS
done

@remyleone remyleone added the load-balancer Load-balancer issues, bugs and feature requests label Nov 16, 2020
@remyleone
Copy link
Member Author

This could also be a feature of a backend spécific command

@remyleone remyleone added the instance Instance issues, bugs and feature requests label Jul 28, 2022
@yfodil yfodil linked a pull request Dec 19, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation enhancement instance Instance issues, bugs and feature requests load-balancer Load-balancer issues, bugs and feature requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants