Fix casing on keepalive
This commit is contained in:
@@ -56,7 +56,7 @@ const (
|
||||
lastSeenAnnotationKey = "kilo.squat.ai/last-seen"
|
||||
leaderAnnotationKey = "kilo.squat.ai/leader"
|
||||
locationAnnotationKey = "kilo.squat.ai/location"
|
||||
persistentKeepAliveKey = "kilo.squat.ai/persistent-keepalive"
|
||||
persistentKeepaliveKey = "kilo.squat.ai/persistent-keepalive"
|
||||
wireGuardIPAnnotationKey = "kilo.squat.ai/wireguard-ip"
|
||||
|
||||
regionLabelKey = "topology.kubernetes.io/region"
|
||||
@@ -263,13 +263,13 @@ func translateNode(node *v1.Node) *mesh.Node {
|
||||
if !ok {
|
||||
internalIP = node.ObjectMeta.Annotations[internalIPAnnotationKey]
|
||||
}
|
||||
// Set Wireguard PersistentKeepAlive setting for the node.
|
||||
var persistentKeepAlive int64
|
||||
if keepAlive, ok := node.ObjectMeta.Annotations[persistentKeepAliveKey]; !ok {
|
||||
persistentKeepAlive = 0
|
||||
// Set Wireguard PersistentKeepalive setting for the node.
|
||||
var persistentKeepalive int64
|
||||
if keepAlive, ok := node.ObjectMeta.Annotations[persistentKeepaliveKey]; !ok {
|
||||
persistentKeepalive = 0
|
||||
} else {
|
||||
if persistentKeepAlive, err = strconv.ParseInt(keepAlive, 10, 64); err != nil {
|
||||
persistentKeepAlive = 0
|
||||
if persistentKeepalive, err = strconv.ParseInt(keepAlive, 10, 64); err != nil {
|
||||
persistentKeepalive = 0
|
||||
}
|
||||
}
|
||||
var lastSeen int64
|
||||
@@ -292,7 +292,7 @@ func translateNode(node *v1.Node) *mesh.Node {
|
||||
Leader: leader,
|
||||
Location: location,
|
||||
Name: node.Name,
|
||||
PersistentKeepAlive: int(persistentKeepAlive),
|
||||
PersistentKeepalive: int(persistentKeepalive),
|
||||
Subnet: subnet,
|
||||
// WireGuardIP can fail to parse if the node is not a leader or if
|
||||
// the node's agent has not yet reconciled. In either case, the IP
|
||||
|
||||
@@ -114,10 +114,10 @@ func TestTranslateNode(t *testing.T) {
|
||||
{
|
||||
name: "wireguard persistent keepalive override",
|
||||
annotations: map[string]string{
|
||||
persistentKeepAliveKey: "25",
|
||||
persistentKeepaliveKey: "25",
|
||||
},
|
||||
out: &mesh.Node{
|
||||
PersistentKeepAlive: 25,
|
||||
PersistentKeepalive: 25,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -148,7 +148,7 @@ func TestTranslateNode(t *testing.T) {
|
||||
lastSeenAnnotationKey: "1000000000",
|
||||
leaderAnnotationKey: "",
|
||||
locationAnnotationKey: "b",
|
||||
persistentKeepAliveKey: "25",
|
||||
persistentKeepaliveKey: "25",
|
||||
wireGuardIPAnnotationKey: "10.4.0.1/16",
|
||||
},
|
||||
labels: map[string]string{
|
||||
@@ -161,7 +161,7 @@ func TestTranslateNode(t *testing.T) {
|
||||
LastSeen: 1000000000,
|
||||
Leader: true,
|
||||
Location: "b",
|
||||
PersistentKeepAlive: 25,
|
||||
PersistentKeepalive: 25,
|
||||
Subnet: &net.IPNet{IP: net.ParseIP("10.2.1.0"), Mask: net.CIDRMask(24, 32)},
|
||||
WireGuardIP: &net.IPNet{IP: net.ParseIP("10.4.0.1"), Mask: net.CIDRMask(16, 32)},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user