solo-io / gloo-portal-issues

Public tracker for issues related to Gloo Portal
https://docs.solo.io/gloo-portal/latest/
1 stars 3 forks source link

Gloo portal gives 404 #61

Closed arjunkrishnasb closed 3 years ago

arjunkrishnasb commented 3 years ago

Hi,

I deployed Gloo enterprise with trial license and doing a POC on Gloo portal now. After i create all the resources to create the portal following the official docs, when i go to the portal it is giving me a 404 after loading the page for few seconds.

Kuberetes version:

(base) ARJSRIRA-M-L0XP:kubespray arjsrira$ kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-16T00:04:31Z", GoVersion:"go1.14.4", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.9", GitCommit:"94f372e501c973a7fa9eb40ec9ebd2fe7ca69848", GitTreeState:"clean", BuildDate:"2020-09-16T13:47:43Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

In our environment we deployed Gloo using NodePort:

(base) ARJSRIRA-M-L0XP:kubespray arjsrira$ kubectl get svc -n gloo-system -o wide
NAME                                  TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                               AGE   SELECTOR
extauth                               ClusterIP   10.1.141.54    <none>        8083/TCP                              21d   gloo=extauth
gateway                               ClusterIP   10.1.129.116   <none>        443/TCP                               21d   gloo=gateway
gateway-proxy                         NodePort    10.1.130.222   <none>        80:30001/TCP,443:30002/TCP            21d   gateway-proxy-id=gateway-proxy,gateway-proxy=live
gloo                                  ClusterIP   10.1.191.208   <none>        9977/TCP,9976/TCP,9988/TCP,9979/TCP   21d   gloo=gloo
glooe-grafana                         ClusterIP   10.1.172.23    <none>        80/TCP                                21d   app.kubernetes.io/instance=gloo,app.kubernetes.io/name=glooe-grafana
glooe-prometheus-kube-state-metrics   ClusterIP   10.1.184.42    <none>        8080/TCP                              21d   app.kubernetes.io/instance=gloo,app.kubernetes.io/name=kube-state-metrics
glooe-prometheus-server               ClusterIP   10.1.162.108   <none>        80/TCP                                21d   app=glooe-prometheus,component=server,release=gloo
rate-limit                            ClusterIP   10.1.184.68    <none>        18081/TCP                             21d   gloo=rate-limit
redis                                 ClusterIP   10.1.183.220   <none>        6379/TCP                              21d   gloo=redis

DevPortal is deployed:

(base) ARJSRIRA-M-L0XP:kubespray arjsrira$ kubectl get all -o wide -n dev-portal
NAME                               READY   STATUS    RESTARTS   AGE     IP             NODE                      NOMINATED NODE   READINESS GATES
pod/admin-server-b46f87b6b-7b67g   3/3     Running   0          5d22h   10.1.222.184   dev-fab3-k8s-worker-003   <none>           <none>
pod/dev-portal-5c5c4c6c97-t94hg    1/1     Running   0          5d22h   10.1.244.9     dev-fab3-k8s-worker-002   <none>           <none>

NAME                   TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE     SELECTOR
service/admin-server   ClusterIP   10.1.182.21    <none>        8080/TCP   5d22h   app=admin-server
service/dev-portal     ClusterIP   10.1.184.155   <none>        8080/TCP   5d22h   app=dev-portal

NAME                           READY   UP-TO-DATE   AVAILABLE   AGE     CONTAINERS        IMAGES                                                                                                      SELECTOR
deployment.apps/admin-server   1/1     1            1           5d22h   envoy,server,ui   soloio/dev-portal-admin-envoy:0.7.4,soloio/dev-portal-admin-server:0.7.4,soloio/dev-portal-admin-ui:0.7.4   app=admin-server
deployment.apps/dev-portal     1/1     1            1           5d22h   dev-portal        soloio/dev-portal:0.7.4                                                 

Portal resource deployed and in succeeded state:

(base) ARJSRIRA-M-L0XP:kubespray arjsrira$ kubectl describe portal
Name:         petstore-portal
Namespace:    default
Labels:       <none>
Annotations:  API Version:  devportal.solo.io/v1alpha1
Kind:         Portal
Metadata:
  Creation Timestamp:  2021-05-26T05:25:10Z
  Generation:          1
  Managed Fields:
    API Version:  devportal.solo.io/v1alpha1
   ...
   ...
   .....
   ........
Spec:
  Banner:
    Fetch URL:  https://i.imgur.com/EXbBN1a.jpg
  Custom Styling:
  Description:   The Gloo Portal for the Petstore API
  Display Name:  Petstore Portal
  Domains:
    portal.petstore.com:30001
  Favicon:
    Fetch URL:  https://i.imgur.com/QQwlQG3.png
  Primary Logo:
    Fetch URL:  https://i.imgur.com/hjgPMNP.png
  Published Environments:
    Name:       dev
    Namespace:  default
  Static Pages:
Status:
  Observed Generation:  1
  Published Environments:
    API Products:
      Name:       petstore-product
      Namespace:  default
    Name:         dev
    Namespace:    default
  State:          Succeeded
Events:           <none>

In logs:

{"level":"error","ts":1621940350.7958543,"msg":"portal domain match not found","domain":"portal.petstore.com:30001","portals":{},"portalsError":"got runtime.Object without object metadata: &{{ } {   <nil>} [{{Portal devportal.solo.io/v1alpha1} {petstore-portal  default /apis/devportal.solo.io/v1alpha1/namespaces/default/portals/petstore-portal 8d7cf877-e07e-40a3-974f-dc9f5ce6f72d 50397761 1 2021-05-25 10:50:24 +0000 UTC <nil> <nil> map[] map[kubectl.kubernetes.io/last-applied-configuration:{\"apiVersion\":\"devportal.solo.io/v1alpha1\",\"kind\":\"Portal\",\"metadata\":{\"annotations\":{},\"name\":\"petstore-portal\",\"namespace\":\"default\"},\"spec\":{\"banner\":{\"fetchUrl\":\"https://i.imgur.com/EXbBN1a.jpg\"},\"customStyling\":{},\"description\":\"The Gloo Portal for the Petstore API\",\"displayName\":\"Petstore Portal\",\"domains\":[\"portal.petstore.com:30001\"],\"favicon\":{\"fetchUrl\":\"https://i.imgur.com/QQwlQG3.png\"},\"primaryLogo\":{\"fetchUrl\":\"https://i.imgur.com/hjgPMNP.png\"},\"publishedEnvironments\":[{\"name\":\"dev\",\"namespace\":\"default\"}],\"staticPages\":[]}}\n] [] []  [{kubectl Update devportal.solo.io/v1alpha1 2021-05-25 10:50:24 +0000 UTC FieldsV1 {\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubectl.kubernetes.io/last-applied-configuration\":{}}},\"f:spec\":{\".\":{},\"f:banner\":{\".\":{},\"f:fetchUrl\":{}},\"f:customStyling\":{},\"f:description\":{},\"f:displayName\":{},\"f:domains\":{},\"f:favicon\":{\".\":{},\"f:fetchUrl\":{}},\"f:primaryLogo\":{\".\":{},\"f:fetchUrl\":{}},\"f:publishedEnvironments\":{}}}} {dev-portal Update devportal.solo.io/v1alpha1 2021-05-25 10:50:27 +0000 UTC FieldsV1 {\"f:status\":{\".\":{},\"f:observedGeneration\":{},\"f:publishedEnvironments\":{},\"f:state\":{}}}}]} {{{} [] [] <nil>} 0 [] Petstore Portal The Gloo Portal for the Petstore API [portal.petstore.com:30001] fetch_url:\"https://i.imgur.com/hjgPMNP.png\" fetch_url:\"https://i.imgur.com/QQwlQG3.png\" fetch_url:\"https://i.imgur.com/EXbBN1a.jpg\"  [] [] <nil> <nil> <nil> [name:\"dev\" namespace:\"default\"] false } {{{} [] [] <nil>} 0 [] 1 Succeeded   [name:\"dev\" namespace:\"default\" api_products:{name:\"petstore-product\" namespace:\"default\"}]}}]}","stacktrace":"github.com/solo-io/dev-portal/pkg/web/server/utils.(*portalContext).getPortalByDomain\n\t/workspace/dev-portal/pkg/web/server/utils/portal_context.go:86\ngithub.com/solo-io/dev-portal/pkg/web/server/utils.(*portalContext).GetPortalByRequest\n\t/workspace/dev-portal/pkg/web/server/utils/portal_context.go:62\ngithub.com/solo-io/dev-portal/pkg/web/server/utils.(*portalContext).GetPortalFromContext\n\t/workspace/dev-portal/pkg/web/server/utils/portal_context.go:54\ngithub.com/solo-io/dev-portal/pkg/web/server/portalgrpc.(*server).GetCustomStyling\n\t/workspace/dev-portal/pkg/web/server/portalgrpc/grpc_server.go:277\ngithub.com/solo-io/dev-portal/pkg/api/grpc/web._WebAppApi_GetCustomStyling_Handler.func1\n\t/workspace/dev-portal/pkg/api/grpc/web/web_app_grpc.pb.go:3325\ngithub.com/grpc-ecosystem/go-grpc-middleware/logging/zap.UnaryServerInterceptor.func1\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.0.1-0.20190118093823-f849b5445de4/logging/zap/server_interceptors.go:32\ngithub.com/solo-io/dev-portal/pkg/api/grpc/web._WebAppApi_GetCustomStyling_Handler\n\t/workspace/dev-portal/pkg/api/grpc/web/web_app_grpc.pb.go:3327\ngoogle.golang.org/grpc.(*Server).processUnaryRPC\n\t/go/pkg/mod/google.golang.org/grpc@v1.30.0/server.go:1171\ngoogle.golang.org/grpc.(*Server).handleStream\n\t/go/pkg/mod/google.golang.org/grpc@v1.30.0/server.go:1494\ngoogle.golang.org/grpc.(*Server).serveStreams.func1.2\n\t/go/pkg/mod/google.golang.org/grpc@v1.30.0/server.go:834"}
{"level":"error","ts":1621940350.7965262,"logger":"gloo_portal","msg":"finished unary call with code Unknown","grpc.start_time":"2021-05-25T10:59:10Z","system":"grpc","span.kind":"server","grpc.service":"app.devportal.solo.io.WebAppApi","grpc.method":"GetCustomStyling","error":"failed to get portal: no portal exists for domain portal.petstore.com:30001","errorVerbose":"failed to get portal\n\tportalgrpc.(*server).GetCustomStyling:/workspace/dev-portal/pkg/web/server/portalgrpc/grpc_server.go:279\nno portal exists for domain portal.petstore.com:30001\n\tgrpc.(*Server).handleStream:/go/pkg/mod/google.golang.org/grpc@v1.30.0/server.go:1494\n\tgrpc.(*Server).processUnaryRPC:/go/pkg/mod/google.golang.org/grpc@v1.30.0/server.go:1171\n\tweb._WebAppApi_GetCustomStyling_Handler:/workspace/dev-portal/pkg/api/grpc/web/web_app_grpc.pb.go:3327\n\tzap.UnaryServerInterceptor.func1:/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.0.1-0.20190118093823-f849b5445de4/logging/zap/server_interceptors.go:32\n\tweb._WebAppApi_GetCustomStyling_Handler.func1:/workspace/dev-portal/pkg/api/grpc/web/web_app_grpc.pb.go:3325\n\tportalgrpc.(*server).GetCustomStyling:/workspace/dev-portal/pkg/web/server/portalgrpc/grpc_server.go:279\n\tportalgrpc.(*server).GetCustomStyling:/workspace/dev-portal/pkg/web/server/portalgrpc/grpc_server.go:277\n\tutils.(*portalContext).GetPortalFromContext:/workspace/dev-portal/pkg/web/server/utils/portal_context.go:54\n\tutils.(*portalContext).GetPortalByRequest:/workspace/dev-portal/pkg/web/server/utils/portal_context.go:62\n\tutils.(*portalContext).getPortalByDomain:/workspace/dev-portal/pkg/web/server/utils/portal_context.go:87\n\tutils.glob..func1:/workspace/dev-portal/pkg/web/server/utils/portal_context.go:37","grpc.code":"Unknown","grpc.time_ms":0.8619999885559082,"stacktrace":"github.com/grpc-ecosystem/go-grpc-middleware/logging/zap.UnaryServerInterceptor.func1\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.0.1-0.20190118093823-f849b5445de4/logging/zap/server_interceptors.go:40\ngithub.com/solo-io/dev-portal/pkg/api/grpc/web._WebAppApi_GetCustomStyling_Handler\n\t/workspace/dev-portal/pkg/api/grpc/web/web_app_grpc.pb.go:3327\ngoogle.golang.org/grpc.(*Server).processUnaryRPC\n\t/go/pkg/mod/google.golang.org/grpc@v1.30.0/server.go:1171\ngoogle.golang.org/grpc.(*Server).handleStream\n\t/go/pkg/mod/google.golang.org/grpc@v1.30.0/server.go:1494\ngoogle.golang.org/grpc.(*Server).serveStreams.func1.2\n\t/go/pkg/mod/google.golang.org/grpc@v1.30.0/server.go:834"}

Kindly help me out if i am doing something wrong here or guide me with better troubleshooting.

marcogschmidt commented 3 years ago

Hi @arjunkrishnasb, I moved the issue to this repository, since this is where we track issues that are specific to Gloo Portal.

This message in the logs jumped out at me:

got runtime.Object without object metadata

Could you share the YAML for your portal (kubectl get portals -A -oyaml)?

arjunkrishnasb commented 3 years ago

Hi @marcogschmidt , Apologies for the delayed reply. Here you go.

(base) ARJSRIRA-M-L0XP:~ arjsrira$ kubectl get portals -A -oyaml
apiVersion: v1
items:
- apiVersion: devportal.solo.io/v1alpha1
  kind: Portal
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"devportal.solo.io/v1alpha1","kind":"Portal","metadata":{"annotations":{},"name":"petstore-portal","namespace":"default"},"spec":{"banner":{"fetchUrl":"https://i.imgur.com/EXbBN1a.jpg"},"customStyling":{},"description":"The Gloo Portal for the Petstore API","displayName":"Petstore Portal","domains":["portal.petstore.com:30001"],"favicon":{"fetchUrl":"https://i.imgur.com/QQwlQG3.png"},"primaryLogo":{"fetchUrl":"https://i.imgur.com/hjgPMNP.png"},"publishedEnvironments":[{"name":"dev","namespace":"default"}],"staticPages":[]}}
    creationTimestamp: "2021-05-26T05:25:10Z"
    generation: 1
    managedFields:
    - apiVersion: devportal.solo.io/v1alpha1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:kubectl.kubernetes.io/last-applied-configuration: {}
        f:spec:
          .: {}
          f:banner:
            .: {}
            f:fetchUrl: {}
          f:customStyling: {}
          f:description: {}
          f:displayName: {}
          f:domains: {}
          f:favicon:
            .: {}
            f:fetchUrl: {}
          f:primaryLogo:
            .: {}
            f:fetchUrl: {}
          f:publishedEnvironments: {}
      manager: kubectl
      operation: Update
      time: "2021-05-26T05:25:10Z"
    - apiVersion: devportal.solo.io/v1alpha1
      fieldsType: FieldsV1
      fieldsV1:
        f:status:
          .: {}
          f:observedGeneration: {}
          f:publishedEnvironments: {}
          f:state: {}
      manager: dev-portal
      operation: Update
      time: "2021-05-30T21:29:24Z"
    name: petstore-portal
    namespace: default
    resourceVersion: "53288865"
    selfLink: /apis/devportal.solo.io/v1alpha1/namespaces/default/portals/petstore-portal
    uid: 08165b42-259e-45a7-be57-7ad4040c34b6
  spec:
    banner:
      fetchUrl: https://i.imgur.com/EXbBN1a.jpg
    customStyling: {}
    description: The Gloo Portal for the Petstore API
    displayName: Petstore Portal
    domains:
    - portal.petstore.com:30001
    favicon:
      fetchUrl: https://i.imgur.com/QQwlQG3.png
    primaryLogo:
      fetchUrl: https://i.imgur.com/hjgPMNP.png
    publishedEnvironments:
    - name: dev
      namespace: default
    staticPages: []
  status:
    observedGeneration: 1
    publishedEnvironments:
    - apiProducts:
      - name: petstore-product
        namespace: default
      name: dev
      namespace: default
    state: Succeeded
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""
marcogschmidt commented 3 years ago

Hi @arjunkrishnasb , sorry for the late reply. I looked into this and figured out what is going on:

  1. That log message is misleading: there was a bug which caused the "portals":{} list to always be empty and the got runtime.Object without object metadata message to be logged.
  2. When we try to match a request to a portal CRD, we strip the port from the host property on the request and then compare the result with the domains on all of the available portals without stripping the port from them. In your case this will cause portal.petstore.com to be compared with portal.petstore.com:30001, which obviously will never be a match.

I just merged a fix for both these issues. It will be included in the next version (0.7.6), which will be released by the end of this week. For now you should be able to work around this by just updating the domains property in your portal to also include portal.petstore.com (no port).

marcogschmidt commented 3 years ago

Fix has been released.