l7mp / stunner

A Kubernetes media gateway for WebRTC. Contact: info@l7mp.io
https://l7mp.io
MIT License
751 stars 58 forks source link

`stunnerctl config` does not fall back to the default namespace #139

Closed rg0now closed 6 months ago

rg0now commented 7 months ago

Description

If no namespace is given, stunnerctl config should automatically use the default namespace.

Steps to Reproduce

  1. Deploy the UDP greeter example into the default namesapce:

    apiVersion: gateway.networking.k8s.io/v1
    kind: GatewayClass
    metadata:
     name: stunner-gatewayclass
    spec:
     controllerName: "stunner.l7mp.io/gateway-operator"
     parametersRef:
       group: "stunner.l7mp.io"
       kind: GatewayConfig
       name: stunner-gatewayconfig
       namespace: default
     description: "STUNner is a WebRTC ingress gateway for Kubernetes"
    ---
    
    apiVersion: stunner.l7mp.io/v1
    kind: GatewayConfig
    metadata:
     name: stunner-gatewayconfig
    spec:
     realm: stunner.l7mp.io
     authType: plaintext
     userName: "user-1"
     password: "pass-1"
    
    ---
    apiVersion: gateway.networking.k8s.io/v1
    kind: Gateway
    metadata:
     name: udp-gateway
    spec:
     gatewayClassName: stunner-gatewayclass
     listeners:
       - name: udp-listener
         port: 3478
         protocol: TURN-UDP
    ---
    apiVersion: gateway.networking.k8s.io/v1
    kind: Gateway
    metadata:
     name: tcp-gateway
    spec:
     gatewayClassName: stunner-gatewayclass
     listeners:
       - name: tcp-listener
         port: 3478
         protocol: TURN-TCP
    ---
    apiVersion: stunner.l7mp.io/v1
    kind: UDPRoute
    metadata:
     name: media-plane
    spec:
     parentRefs:
       - name: udp-gateway
       - name: tcp-gateway
     rules:
       - backendRefs:
           - name: media-plane
  2. Query the dataplane config with stunnerctl but do not specify the namespace:

    stunnerctl config udp-gateway

Expected behavior: stunnerctl should use the default namespace.

Actual behavior: It leaves the namespace unspecified and fails to find the gateway. Using an explicit namespace works though:

stunnerctl -n default config udp-gateway 
Gateway: default/udp-gateway (loglevel: "all:INFO")
Authentication type: static, username/password: user-1/pass-1
Listeners:
...

Versions

Regression appeared during the stunnerctl rewrite.