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

No docs exist for LB #208

Open
haardikdharma10 opened this issue Mar 15, 2022 · 4 comments
Open

No docs exist for LB #208

haardikdharma10 opened this issue Mar 15, 2022 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@haardikdharma10
Copy link
Contributor

Currently, in CLI repo's README, no docs are mentioned for load balancers and hence https://github.com/civo/cli/blob/master/README.md#load-balancers doesn't redirect to the desired heading as it doesn't exist.

@haardikdharma10 haardikdharma10 added the documentation Improvements or additions to documentation label Mar 15, 2022
@ghost
Copy link

ghost commented Mar 26, 2022

There's also no API documentation yet either, but there is Go client tooling already.

This is pretty much what the documentation would look like right now if it was added. (click to expand)

Load Balancers

Listing Load Balancers

To list all the load balancers you can run civo loadbalancer ls

[protosam@nullhost]$ civo loadbalancer ls
+--------------------------------------+----------------------------------+-------------+--------------+-----------+----------------------------------------------------+
| ID                                   | Name                             | Algorithm   | Public IP    | State     | Backends                                           |
+--------------------------------------+----------------------------------+-------------+--------------+-----------+----------------------------------------------------+
| 30005345-35z1-4f4b-8a4d-3a0691958d4c | clusterName-svcNamespace-svcName | round_robin | XXX.X.XXX.XX | available | 192.168.1.4, 192.168.1.2, 192.168.1.4, 192.168.1.2 |
+--------------------------------------+----------------------------------+-------------+--------------+-----------+----------------------------------------------------+

Running civo loadbalancer show <load-balancer-id> will show you the requested load balancer details.

[protosam@nullhost]$ civo loadbalancer show 30005345-35z1-4f4b-8a4d-3a0691958d4c
+--------------------------------------+----------------------------------+-------------+--------------+-----------+--------------------------------------------------+----------------------------------------------------+
| ID                                   | Name                             | Algorithm   | Public IP    | State     | DNS Entry                                        | Backends                                           |
+--------------------------------------+----------------------------------+-------------+--------------+-----------+--------------------------------------------------+----------------------------------------------------+
| 30005345-35z1-4f4b-8a4d-3a0691958d4c | clusterName-svcNamespace-svcName | round_robin | XXX.X.XXX.XX | available | 30005345-35z1-4f4b-8a4d-3a0691958d4c.lb.civo.com | 192.168.1.4, 192.168.1.2, 192.168.1.4, 192.168.1.2 |
+--------------------------------------+----------------------------------+-------------+--------------+-----------+--------------------------------------------------+----------------------------------------------------+

If you need to know how to use the API in the meantime, here's some curl examples. (click to expand)

## List Load Balancers ```sh [protosam@nullhost]$ curl -s -H "Authorization: bearer " https://api.civo.com/v2/loadbalancers/ | jq ```

Show Load Balancer by ID

[protosam@nullhost]$ curl -s -H "Authorization: bearer <api-key>" https://api.civo.com/v2/loadbalancers/<load-balancer-id> | jq

Create Load Balancer

[protosam@nullhost]$ curl -X POST -H "Authorization: bearer <api-key>" https://api.civo.com/v2/loadbalancers \
  -H 'Content-Type: application/json' \
  -d '{
      "name": "somelb",
      "algorithm": "round_robin",
      "backends":[
          {
            "ip": "192.168.1.4",
            "protocol": "TCP",
            "source_port": 80,
            "target_port": 31961
          }
        ]
  }'
{"id":"403e7bbf-7bb2-43e5-861d-6668f0d955e0","name":"somelb","algorithm":"round_robin","backends":[{"ip":"192.168.1.4","protocol":"TCP","source_port":80,"target_port":31961}],"public_ip":"","private_ip":"","firewall_id":"9668d6a5-39fc-4b61-a8a6-a5c491580ea0","state":""}

[protosam@nullhost]$ civo loadbalancers show 403e7bbf-7bb2-43e5-861d-6668f0d955e0
+--------------------------------------+--------+-------------+---------------+-----------+--------------------------------------------------+-------------+
| ID                                   | Name   | Algorithm   | Public IP     | State     | DNS Entry                                        | Backends    |
+--------------------------------------+--------+-------------+---------------+-----------+--------------------------------------------------+-------------+
| 403e7bbf-7bb2-43e5-861d-6668f0d955e0 | somelb | round_robin | 212.2.247.249 | available | 403e7bbf-7bb2-43e5-861d-6668f0d955e0.lb.civo.com | 192.168.1.4 |
+--------------------------------------+--------+-------------+---------------+-----------+--------------------------------------------------+-------------+

Update a Load Balancer

[protosam@nullhost]$ curl -X PUT -H "Authorization: bearer <api-key>" https://api.civo.com/v2/loadbalancers/403e7bbf-7bb2-43e5-861d-6668f0d955e0 \
  -H 'Content-Type: application/json' \
  -d '{
      "algorithm": "round_robin",
      "backends":[
          {
            "ip": "192.168.1.1",
            "protocol": "TCP",
            "source_port": 80,
            "target_port": 31961
          }
        ]
  }'
{"id":"403e7bbf-7bb2-43e5-861d-6668f0d955e0","name":"somelb","algorithm":"round_robin","backends":[{"ip":"192.168.1.1","protocol":"TCP","source_port":80,"target_port":31961}],"public_ip":"212.2.247.249","private_ip":"192.168.1.3","firewall_id":"9668d6a5-39fc-4b61-a8a6-a5c491580ea0","state":"available"}

[protosam@nullhost]$ civo loadbalancers show 403e7bbf-7bb2-43e5-861d-6668f0d955e0
+--------------------------------------+--------+-------------+---------------+-----------+--------------------------------------------------+-------------+
| ID                                   | Name   | Algorithm   | Public IP     | State     | DNS Entry                                        | Backends    |
+--------------------------------------+--------+-------------+---------------+-----------+--------------------------------------------------+-------------+
| 403e7bbf-7bb2-43e5-861d-6668f0d955e0 | somelb | round_robin | 212.2.247.249 | available | 403e7bbf-7bb2-43e5-861d-6668f0d955e0.lb.civo.com | 192.168.1.1 |
+--------------------------------------+--------+-------------+---------------+-----------+--------------------------------------------------+-------------+

Delete a Load Balancer

[protosam@nullhost]$ curl -X DELETE -H "Authorization: bearer <api-key>" https://api.civo.com/v2/loadbalancers/403e7bbf-7bb2-43e5-861d-6668f0d955e0
{"result":"success"}

Edit:
Turns out there are source files for the create, update, and remove features.

@haardikdharma10
Copy link
Contributor Author

Thanks for the feedback @protosam! Will raise this with the team and the docs should be updated soon 😄

@Ujjwal2421
Copy link

Ujjwal2421 commented Apr 16, 2022

@haardikdharma10 I made a PR adding the docs file for Load Balancer #222.

@haardikdharma10
Copy link
Contributor Author

Thanks @Ujjwal2421. Commented 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants