pkg/k8s: enable peers to use DNS names
This commit enables peers defined using the Peer CRD to declare their endpoints using DNS names. Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
@@ -240,17 +240,30 @@ func TestTranslatePeer(t *testing.T) {
|
||||
name: "invalid endpoint ip",
|
||||
spec: v1alpha1.PeerSpec{
|
||||
Endpoint: &v1alpha1.PeerEndpoint{
|
||||
IP: "foo",
|
||||
DNSOrIP: v1alpha1.DNSOrIP{
|
||||
IP: "foo",
|
||||
},
|
||||
Port: mesh.DefaultKiloPort,
|
||||
},
|
||||
},
|
||||
out: &mesh.Peer{},
|
||||
},
|
||||
{
|
||||
name: "valid endpoint",
|
||||
name: "only endpoint port",
|
||||
spec: v1alpha1.PeerSpec{
|
||||
Endpoint: &v1alpha1.PeerEndpoint{
|
||||
IP: "10.0.0.1",
|
||||
Port: mesh.DefaultKiloPort,
|
||||
},
|
||||
},
|
||||
out: &mesh.Peer{},
|
||||
},
|
||||
{
|
||||
name: "valid endpoint ip",
|
||||
spec: v1alpha1.PeerSpec{
|
||||
Endpoint: &v1alpha1.PeerEndpoint{
|
||||
DNSOrIP: v1alpha1.DNSOrIP{
|
||||
IP: "10.0.0.1",
|
||||
},
|
||||
Port: mesh.DefaultKiloPort,
|
||||
},
|
||||
},
|
||||
@@ -263,6 +276,25 @@ func TestTranslatePeer(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "valid endpoint DNS",
|
||||
spec: v1alpha1.PeerSpec{
|
||||
Endpoint: &v1alpha1.PeerEndpoint{
|
||||
DNSOrIP: v1alpha1.DNSOrIP{
|
||||
DNS: "example.com",
|
||||
},
|
||||
Port: mesh.DefaultKiloPort,
|
||||
},
|
||||
},
|
||||
out: &mesh.Peer{
|
||||
Peer: wireguard.Peer{
|
||||
Endpoint: &wireguard.Endpoint{
|
||||
DNSOrIP: wireguard.DNSOrIP{DNS: "example.com"},
|
||||
Port: mesh.DefaultKiloPort,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "empty key",
|
||||
spec: v1alpha1.PeerSpec{
|
||||
|
Reference in New Issue
Block a user