ahrtr / etcd-defrag

An easier to use and smarter etcd defragmentation tool
MIT License
85 stars 9 forks source link

deduplicate client urls #11

Closed svenwiltink closed 1 year ago

svenwiltink commented 1 year ago

When providing a list of endpoints the defrag program lists all the client urls to perform a healthcheck. In some deployments every etcd instance exposes the same cluster wide endpoints in combination with its pod hostname:

etcdctl --cert etcd.pem --key etcd-key.pem --cacert ca.pem --endpoints https://etcd-0:2379 member list -w table
    +------------------+---------+--------+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------+------------+
    |        ID        | STATUS  |  NAME  |                            PEER ADDRS                             |                                                    CLIENT ADDRS                                   | IS LEARNER |
    +------------------+---------+--------+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------+------------+
    | 4e5e63301fb04046 | started | etcd-2 | https://etcd-2.etcd-headless.cluster.svc.cluster.local:2380 | https://etcd-2.etcd-headless.cluster.svc.cluster.local:2379,https://etcd.cluster.svc.cluster.local:2379 |      false |
    | 57c4758cb4693082 | started | etcd-1 | https://etcd-1.etcd-headless.cluster.svc.cluster.local:2380 | https://etcd-1.etcd-headless.cluster.svc.cluster.local:2379,https://etcd.cluster.svc.cluster.local:2379 |      false |
    | 5a2b185c02a1587e | started | etcd-0 | https://etcd-0.etcd-headless.cluster.svc.cluster.local:2380 | https://etcd-0.etcd-headless.cluster.svc.cluster.local:2379,https://etcd.cluster.svc.cluster.local:2379 |      false |
    +------------------+---------+--------+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------+------------+

Only 1 healthcheck (if any) needs to be performed for this endpoint.

svenwiltink commented 1 year ago

Thanks for the quick review! I've applied the feedback :)

ahrtr commented 1 year ago

Overall looks good, could you squash the commits?