solo-io / gloo

The Feature-rich, Kubernetes-native, Next-Generation API Gateway Built on Envoy

Home Page:https://docs.solo.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

glooctl: inconsistency with required arguments when gateway-proxy not in default `gloo-system` namespace

DuncanDoyle opened this issue · comments

Gloo Edge Product

Enterprise

Gloo Edge Version

1.16.6

Kubernetes Version

1.27.8

Describe the bug

When you deploy your gateway proxies in any other namespace than gloo-system, the --name and --namespace parameters required on glooctl proxy commands is inconsistent.

Using the following configuration, in which we only deploy the default gateway in gloo-system and the other 2 gateway-proxies in gloo-external and gloo-internal, the UI will only be able to display the Envoy config of the GW in gloo-system namespace:

gloo:
  settings:
    disableKubernetesDestinations: true
  discovery:
    enabled: true
  gateway:
    persistProxySpec: true
    readGatewaysFromAllNamespaces: true
  gatewayProxies:      
    gatewayProxy:
      disabled: false
      readConfig: true
      readConfigMulticluster: true
      gatewaySettings:
        customHttpGateway:
          virtualServiceSelector:
            gateway-type: default
        customHttpsGateway:
          virtualServiceSelector:
            gateway-type: default
    publicGw:
      namespace: gloo-external
      disabled: false
      readConfig: true
      readConfigMulticluster: true
      kind:
        deployment:
          replicas: 1
      service:
        httpPort: 81
        httpsFirst: true
        httpsPort: 444
        type: LoadBalancer
      tcpKeepaliveTimeSeconds: 5
      gatewaySettings:
        customHttpGateway:
          virtualServiceSelector:
            gateway-type: public
        customHttpsGateway:
          virtualServiceSelector:
            gateway-type: public
    corpGw:
      namespace: gloo-internal
      disabled: false
      readConfig: true
      readConfigMulticluster: true
      kind:
        deployment:
          replicas: 1
      service:
        httpPort: 8080
        httpsFirst: true
        httpsPort: 8443
        type: LoadBalancer
      tcpKeepaliveTimeSeconds: 5
      gatewaySettings:
        customHttpGateway:
          virtualServiceSelector:
            gateway-type: private
        customHttpsGateway:
          virtualServiceSelector:
            gateway-type: private

To read the served-config of the non-default gateway-proxies ... we have to ommit the namespace:

glooctl proxy served-config --name public-gw

However, when we want to get the url or address of the same proxy we do have to specify the namespace for the command to work:

glooctl proxy url --name public-gw --namespace gloo-external

Note

When you change the writeNamespace in your Gloo Edge configuration, for example to gloo-external, the glooctl proxy served-config command will show an empty result, even for the default gw-proxy:

$ glooctl proxy served-config 

#role: gloo-system~gateway-proxy

#clusters

#eds

#listeners

#rds

Specifying the value of the writeNamespace setting a --namespace parameter when using this setup will return errors.

glooctl proxy served-config --namespace gloo-external
{"level":"error","ts":"2024-04-17T11:02:30.937+0200","caller":"xdsinspection/get_last_config.go:90","msg":"connecting to gloo failed with err endpoints err: rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing: dial tcp [::1]:9977: connect: connection refused\"","stacktrace":"github.com/solo-io/gloo/projects/gloo/cli/pkg/xdsinspection.GetGlooXdsDump\n\t/private/tmp/glooctl-20240414-3732-5iv6j3/projects/gloo/cli/pkg/xdsinspection/get_last_config.go:90\ngithub.com/solo-io/gloo/projects/gloo/cli/pkg/cmd/gateway.printGlooXdsDump\n\t/private/tmp/glooctl-20240414-3732-5iv6j3/projects/gloo/cli/pkg/cmd/gateway/served-config.go:31\ngithub.com/solo-io/gloo/projects/gloo/cli/pkg/cmd/gateway.servedConfigCmd.func1\n\t/private/tmp/glooctl-20240414-3732-5iv6j3/projects/gloo/cli/pkg/cmd/gateway/served-config.go:18\ngithub.com/spf13/cobra.(*Command).execute\n\t/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115\ngithub.com/spf13/cobra.(*Command).Execute\n\t/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039\nmain.main\n\t/private/tmp/glooctl-20240414-3732-5iv6j3/projects/gloo/cli/cmd/main.go:11\nruntime.main\n\t/opt/homebrew/Cellar/go/1.22.2/libexec/src/runtime/proc.go:271"}

Expected Behavior

Consistent use of --name and --namespace in glooctl proxy commands when deploying gateway-proxies in non-default namespaces.

Steps to reproduce the bug

See Helm values in description.

Also, see reproducer project here: https://github.com/DuncanDoyle/ge-gloo-9378-9379

Additional Environment Detail

No response

Additional Context

No response