kube-router icon indicating copy to clipboard operation
kube-router copied to clipboard

Restructure node peer annotations

Open rkojedzinszky opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. For many external peers for a node, it might be difficult to change per-node settings (e.g. password, asn prepends, etc.) because they are stored in different arrays.

Describe the solution you'd like Restructure configuration in a serialized json or yaml format, with elements of peer configurations.

Instead of:

apiVersion: v1
kind: Node
metadata:
  annotations:
...
    kube-router.io/peer.asns: "64640"
    kube-router.io/peer.ips: 192.168.8.254
    kube-router.io/peer.passwords: cGFzc3dvcmQ=
...

We could have:

apiVersion: v1
kind: Node
metadata:
  annotations:
...
    kube-router.io/peers: |
      - remoteip: 192.168.8.254
        remoteasn: 64640
        password: cGFzc3dvcmQ=
...
``

For compatibility, both formats can be supported at the same time.

**Additional context**
If having multiple peers, and for example we want some fields have defaults or not specified (e.g. a password), the list can read confusing. Also, right now there are many settings applicable for a peer, and restructuring them into a real struct would enhance readability, and also would make processing it in code much simpler.

rkojedzinszky avatar Nov 08 '22 05:11 rkojedzinszky

This seems reasonable. We should also probably replace the options --peer-router-passwords-file (https://github.com/cloudnativelabs/kube-router/blob/master/pkg/options/options.go#L195) with an option to instead pass a YAML config file that has the same structure as the annotation.

That would allow the user multiple ways to specify the same data either at runtime via node annotation or via configuration file that is passed to kube-router at startup. The same Go object should be able to decode both.

aauren avatar Nov 15 '22 00:11 aauren