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

Define WireGuard PersistentKeepAlive via Annotation #31

Merged
merged 5 commits into from
Feb 13, 2020

Conversation

frbncis
Copy link
Contributor

@frbncis frbncis commented Feb 12, 2020

This PR enables setting the WireGuard setting PersistentKeepalive through the annotation kilo.squat.ai/persistent-keepalive for a given node A.

kilo will then set the PersistentKeepalive value on all other nodes where node A is listed as a peer in the WireGuard configuration.

See #26.

@frbncis frbncis requested a review from squat February 12, 2020 05:16
Copy link
Owner

@squat squat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frbncis this looks great! We are just missing the keep alive field in two functions and then it's all good to go. Specifically we need this in the AsPeer and PeerConf functions. The first is used when kgctl prints the specified node as a peer so you can add it to the WireGuard config of your laptop. The second prints the configuration of the entire cluster so that a peer that has been added to the cluster via a CRD can get the entire configuration it needs.

@frbncis
Copy link
Contributor Author

frbncis commented Feb 13, 2020

Alright! Hopefully those changes cover it.

For reference, here's what I get when running kgctl now:

fnguyen@thiccpad:~/git/kilo$ ./bin/amd64/kgctl showconf --kubeconfig ~/.kube/config peer thiccpad
[Peer]
AllowedIPs = 10.42.0.0/24, 10.20.0.5/32, 10.4.0.1/32
Endpoint = <cloud-node-public-ip>:51820
PersistentKeepalive = 10
PublicKey = KIp5hMoLTayQ9XndUvO4ZkBC9d65jLZoGcMWTg+0jGo=

[Peer]
AllowedIPs = 10.42.1.0/24, 10.160.0.77/32, 10.4.0.2/32
Endpoint = <nat-node-public-ip>:51820
PersistentKeepalive = 0
PublicKey = L769oKuo5GItkx3hC4oDrfFrHaNf/fF+7NDEJLWfFyQ=

Copy link
Owner

@squat squat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! Great work :)

@squat squat merged commit 6de0f98 into squat:master Feb 13, 2020
@frbncis frbncis deleted the node-keepalives branch February 13, 2020 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants