pkg/k8s/apis: support for preshared keys in peers
This commit adds support for defining preshared keys when declaring a new Peer CRD. This preshared key will be used whenever the nodes in the Kilo mesh communicate with that peer. Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
@@ -299,6 +299,10 @@ func translatePeer(peer *wireguard.Peer) *v1alpha1.Peer {
|
||||
if len(peer.PublicKey) > 0 {
|
||||
key = string(peer.PublicKey)
|
||||
}
|
||||
var psk string
|
||||
if len(peer.PresharedKey) > 0 {
|
||||
psk = string(peer.PresharedKey)
|
||||
}
|
||||
var pka int
|
||||
if peer.PersistentKeepalive > 0 {
|
||||
pka = peer.PersistentKeepalive
|
||||
@@ -311,8 +315,9 @@ func translatePeer(peer *wireguard.Peer) *v1alpha1.Peer {
|
||||
Spec: v1alpha1.PeerSpec{
|
||||
AllowedIPs: aips,
|
||||
Endpoint: endpoint,
|
||||
PublicKey: key,
|
||||
PersistentKeepalive: pka,
|
||||
PresharedKey: psk,
|
||||
PublicKey: key,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user