jodevsa / wireguard-operator

Painless deployment of wireguard on kubernetes
MIT License
611 stars 35 forks source link

Unable to add any new clients in recent versions (2.0+) #148

Open xamindar opened 3 months ago

xamindar commented 3 months ago

Describe the bug New clients fail to install and work. Example client yaml: $ cat client-test.yaml

apiVersion: vpn.example.com/v1alpha1
kind: WireguardPeer
metadata:
  name: test
  namespace: radnimax-vpn
spec:
  wireguardRef: "radnimax-vpn"

To Reproduce Steps to reproduce the behavior:

  1. apply new client yaml: kubectl apply -f client-test.yaml
  2. run command to get peer information: kubectl -n radnimax-vpn get wireguardpeer test --template={{.status.config}} | bash
  3. Note the following error is returned instead of the peer configuration:
    bash: line 1: syntax error near unexpected token `newline'
    bash: line 1: `<no value>'
    Note: without piping to bash, the return is simply "<no value>"

Expected behavior Should receive proper config info, which still happens with the existing clients already set up.

Additional context Existing client configs are able to be retrieved. It is only any new ones that are added now, that are not able to be retrieved.

xamindar commented 2 months ago

This is still a problem on v2.0.26.

jodevsa commented 2 months ago

Hello,

What does kubectl -n radnimax-vpn get wireguardpeer test --template={{.status.config}} return?

xamindar commented 2 months ago

Hello,

What does kubectl -n radnimax-vpn get wireguardpeer test --template={{.status.config}} return?

It just returns no value:

$ kubectl -n radnimax-vpn get wireguardpeer test --template={{.status.config}}

jodevsa commented 2 months ago

what about kubectl -n radnimax-vpn describe wireguardpeer test

xamindar commented 1 month ago

what about kubectl -n radnimax-vpn describe wireguardpeer test

Sorry for the delay, been busy. Here is the result:

[xamindar@hp2530p-xam wireguard-operator]$ kubectl -n radnimax-vpn describe wireguardpeer test Name: test Namespace: radnimax-vpn Labels: <none> Annotations: <none> API Version: vpn.example.com/v1alpha1 Kind: WireguardPeer Metadata: Creation Timestamp: 2024-04-20T06:31:52Z Generation: 1 Resource Version: 381408287 UID: 4f9de045-988d-493c-aad8-a5de4861aae7 Spec: Wireguard Ref: radnimax-vpn Events: <none> [xamindar@hp2530p-xam wireguard-operator]$

I have some time to troubleshoot it now but I think I will just blow it away and redeploy it at this point.

xamindar commented 1 month ago

Alright, so I removed it and my vpn "server/client" configs and redeployed. Now it isn't working at all. Applied release v2.0.30, then my server config in its own namespace just as I originally did. The only difference is updating the apiVersion to vpn.wireguard-operator.io/v1alpha1 as it's now listed on the readme page.

Now when I apply the client config, I just get nothing:

[xamindar@hp2530p-xam wireguard-operator]$ cat client-test.yaml apiVersion: vpn.wireguard-operator.io/v1alpha1 kind: WireguardPeer metadata: name: test namespace: radnimax-vpn spec: wireguardRef: "radnimax-vpn" [xamindar@hp2530p-xam wireguard-operator]$ kubectl apply -f client-test.yaml wireguardpeer.vpn.wireguard-operator.io/test created [xamindar@hp2530p-xam wireguard-operator]$ kubectl -n radnimax-vpn get wireguardpeer test --template={{.status.config}} Error from server (NotFound): the server could not find the requested resource (get wireguardpeers.vpn.example.com test) [xamindar@hp2530p-xam wireguard-operator]$

EDIT: nevermind, it is working now. Just took a little while.

One thing I noticed before I wiped it all out was it appears upgrading versions doesn't remove old CRDs so maybe that was the problem. I took them all out before I reinstalled everything: wireguardpeers.vpn.example.com 2023-01-23T05:05:23Z wireguardpeers.vpn.wireguard-operator.io 2024-05-10T22:41:07Z wireguards.vpn.example.com 2023-01-23T05:05:23Z wireguards.vpn.wireguard-operator.io 2024-05-10T22:41:07Z