Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Cannot load the graph: json: cannot unmarshal object into Go value of type []*kubernetes.RegistryEndpoint" #6510

Closed
howardjohn opened this issue Aug 22, 2023 · 25 comments · Fixed by #6673
Assignees
Labels
backlog Triaged Issue added to backlog bug Something isn't working

Comments

@howardjohn
Copy link

UI fails to load with this error: Cannot load the graph: json: cannot unmarshal object into Go value of type []*kubernetes.RegistryEndpoint

Image quay.io/kiali/kiali:v1.72

Cluster is GKE 1.27

Running OSS Istio from master with ambient enabled

2023-08-22T23:34:46Z ERR json: cannot unmarshal object into Go value of type []*kubernetes.RegistryEndpoint: goroutine 6341 [running]:
runtime/debug.Stack()
        /opt/hostedtoolcache/go/1.20.5/x64/src/runtime/debug/stack.go:24 +0x65
github.com/kiali/kiali/handlers.handlePanic({0x232aee0, 0xc000cb3b90})
        /home/runner/work/kiali/kiali/handlers/graph.go:86 +0x219
panic({0x1c286e0, 0xc0003ad8f0})
        /opt/hostedtoolcache/go/1.20.5/x64/src/runtime/panic.go:884 +0x213
github.com/kiali/kiali/graph.CheckError(...)
        /home/runner/work/kiali/kiali/graph/util.go:38
github.com/kiali/kiali/graph/telemetry/istio/appender.getServiceList({0xc000f35986, 0xa}, {0xc000540c10, 0x6}, 0xc00154bda0)
        /home/runner/work/kiali/kiali/graph/telemetry/istio/appender/appender.go:291 +0x314
github.com/kiali/kiali/graph/telemetry/istio/appender.getServiceLists(0x8?, {0xc000540c10, 0x6}, 0xc00079d050?)
        /home/runner/work/kiali/kiali/graph/telemetry/istio/appender/appender.go:264 +0xac
github.com/kiali/kiali/graph/telemetry/istio/appender.IstioAppender.AppendGraph({0x202afe8?}, 0xc00154be00, 0xc00059c240?, 0xc000c85908)
        /home/runner/work/kiali/kiali/graph/telemetry/istio/appender/istio_details.go:47 +0x65
github.com/kiali/kiali/graph/telemetry/istio.BuildNamespacesTrafficMap({_, _}, {0xc00154bc50, {0x0, {0xc00150b440, 0x6, 0x6}}, 0x0, 0x1, 0xc00154bb90, ...}, ...)
        /home/runner/work/kiali/kiali/graph/telemetry/istio/istio.go:80 +0x6a3
github.com/kiali/kiali/graph/api.graphNamespacesIstio({_, _}, _, _, {{0x203097d, 0x9}, {0x202afe8, 0x5}, {{0xc000540b79, 0x15}, ...}, ...})
        /home/runner/work/kiali/kiali/graph/api/api.go:52 +0x126
github.com/kiali/kiali/graph/api.GraphNamespaces({_, _}, _, {{0x203097d, 0x9}, {0x202afe8, 0x5}, {{0xc000540b79, 0x15}, {0xdf8475800, ...}}, ...})
        /home/runner/work/kiali/kiali/graph/api/api.go:33 +0x2fb
github.com/kiali/kiali/handlers.GraphNamespaces({0x232aee0, 0xc000cb3b90}, 0xc000f25400)
        /home/runner/work/kiali/kiali/handlers/graph.go:51 +0x165
net/http.HandlerFunc.ServeHTTP(0x2038cfd?, {0x232aee0?, 0xc000cb3b90?}, 0x7aa179d53840?)
        /opt/hostedtoolcache/go/1.20.5/x64/src/net/http/server.go:2122 +0x2f
github.com/kiali/kiali/routing.metricHandler.func1({0x2339a90?, 0xc00044c930}, 0xc00082b901?)
        /home/runner/work/kiali/kiali/routing/router.go:145 +0x13b
net/http.HandlerFunc.ServeHTTP(0x233aec8?, {0x2339a90?, 0xc00044c930?}, 0xc00082b910?)
        /opt/hostedtoolcache/go/1.20.5/x64/src/net/http/server.go:2122 +0x2f
github.com/kiali/kiali/handlers.AuthenticationHandler.Handle.func1({0x2339a90, 0xc00044c930}, 0xc000f25200)
        /home/runner/work/kiali/kiali/handlers/authentication.go:79 +0x3fd
net/http.HandlerFunc.ServeHTTP(0x233aec8?, {0x2339a90?, 0xc00044c930?}, 0x230f150?)
        /opt/hostedtoolcache/go/1.20.5/x64/src/net/http/server.go:2122 +0x2f
github.com/kiali/kiali/server.plainHttpMiddleware.func1({0x2339a90?, 0xc00044c930?}, 0xc00154ba70?)
        /home/runner/work/kiali/kiali/server/server.go:157 +0x65
net/http.HandlerFunc.ServeHTTP(0xc000f25100?, {0x2339a90?, 0xc00044c930?}, 0x2?)
        /opt/hostedtoolcache/go/1.20.5/x64/src/net/http/server.go:2122 +0x2f
github.com/gorilla/mux.(*Router).ServeHTTP(0xc000000f00, {0x2339a90, 0xc00044c930}, 0xc0001b4400)
        /home/runner/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x1cf
github.com/NYTimes/gziphandler.GzipHandlerWithOpts.func1.1({0x2339940, 0xc000ee01c0}, 0x0?)
        /home/runner/go/pkg/mod/github.com/!n!y!times/gziphandler@v1.1.1/gzip.go:336 +0x24e
net/http.HandlerFunc.ServeHTTP(0xc0005e8700?, {0x2339940?, 0xc000ee01c0?}, 0x40d92a?)
        /opt/hostedtoolcache/go/1.20.5/x64/src/net/http/server.go:2122 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc000540b20?, {0x2339940, 0xc000ee01c0}, 0xc0001b4400)
        /opt/hostedtoolcache/go/1.20.5/x64/src/net/http/server.go:2500 +0x149
net/http.serverHandler.ServeHTTP({0xc000d99620?}, {0x2339940, 0xc000ee01c0}, 0xc0001b4400)
        /opt/hostedtoolcache/go/1.20.5/x64/src/net/http/server.go:2936 +0x316
net/http.(*conn).serve(0xc000b36a20, {0x233aec8, 0xc000cb1ad0})
        /opt/hostedtoolcache/go/1.20.5/x64/src/net/http/server.go:1995 +0x612
created by net/http.(*Server).Serve
        /opt/hostedtoolcache/go/1.20.5/x64/src/net/http/server.go:3089 +0x5ed
@howardjohn howardjohn added the bug Something isn't working label Aug 22, 2023
@howardjohn
Copy link
Author

Ha funny I found this, since I think I also broke it! istio/istio#46329

Looks like we depended on the internal implementation details of /debug/endpointz which isn't a stable interface

@lucamaf
Copy link

lucamaf commented Aug 24, 2023

same happening for me with maistra v 3.0 and openshift 4.13

@jmazzitelli
Copy link
Collaborator

This is going to affect the Kiali addon that ships with the upcoming Istio 1.19 release. It sounds like Kiali will need to update its usage of the /debug/endpointz, release Kiali with that change and peg Istio 1.19 support to at minimum that new Kiali version.

@howardjohn if we update Kiali to fix this, it will be required that we update the Kiali addon (right now its at 1.72).

@howardjohn
Copy link
Author

howardjohn commented Aug 24, 2023 via email

@jmazzitelli
Copy link
Collaborator

Ah. ok.. I see you are saying this was in master.. I was thinking that's 1.19 but its for 1.20 now.

That will give us some time to figure out what to do.

@jmazzitelli
Copy link
Collaborator

jmazzitelli commented Aug 24, 2023

We are going to need to tweek this to take into account the changes:

https://github.com/kiali/kiali/blob/v1.72.0/kubernetes/types.go#L283-L287

We need to track the changes here: https://github.com/istio/istio/blob/master/pilot/pkg/model/service.go

@jshaughn jshaughn added the backlog Triaged Issue added to backlog label Aug 29, 2023
@jshaughn
Copy link
Collaborator

Can we make the change and not break 1.19 and earlier?

@jmazzitelli
Copy link
Collaborator

Some reported this same issue in Istio 1.19 - see #6591

@howardjohn
Copy link
Author

hmm, istio/istio#46329 is definitely not in 1.19.

Its possible the user just was running :latest without knowing it?

@jmazzitelli
Copy link
Collaborator

@snahil was the one that reported this... I assume he really wasn't running 1.19 even though that was the version he reported. @snahil - you might want to confirm the version of Istio you installed when you saw this error.

@snahil
Copy link

snahil commented Sep 10, 2023

image

@snahil
Copy link

snahil commented Sep 10, 2023

image

@jmazzitelli
Copy link
Collaborator

@snahil But what is the version of the images that are used? What you posted just shows the version of the helm chart used (which may or may not have been configured to load different version of binaries, such as :latest).

Run this and see what the container image is for istiod:

kubectl get pods -n istio-system -l app=istiod -o jsonpath='{.items..spec.containers[*].image}{"\n"}'

Also, go into the Kiali "About" box and tell us what version of Istio it says it is talking to.. you get the About box from the top-right drop down menu:

image

@snahil
Copy link

snahil commented Sep 10, 2023

@jmazzitelli image
image

@jmazzitelli
Copy link
Collaborator

jmazzitelli commented Sep 10, 2023

@snahil OK, there you go. You think you are using Istio 1.19, but you are not - notice :latest in the image name? You are using a developer's build of 1.20, which goes to what @howardjohn was saying - the issue you are seeing is not found in 1.19, only in the master build (which is currently for 1.20).

image

So, your issue is not an issue today - it will be addressed before 1.20 is released.

@snahil
Copy link

snahil commented Sep 10, 2023

@jmazzitelli ok!. But I am using Helm chart version 1.19 looks like it does not have the same istio version, Kindly provide the Helm chart version that can be used as i have tested few of them and they had the same issue.

@jmazzitelli
Copy link
Collaborator

jmazzitelli commented Sep 10, 2023

I never install Istio with helm - I do not know where they are.
I install using the istioctl and the istio tarball downloaded from the github release pages.

Install Istio following the instructions here and you should be able to get Istio 1.19 installed properly: https://istio.io/latest/docs/setup/getting-started/

@jmazzitelli
Copy link
Collaborator

BTW: we have now veered away from the purpose of this issue. This is a question for the Istio team for "How do I install Istio 1.19 via helm"... please go to the general Istio slack channel or other Istio support channels for details on that.

@snahil
Copy link

snahil commented Sep 10, 2023

Cool!. Looks like that's the issue, the helm chart is not working in my case.
Ref:- https://istio.io/latest/docs/setup/install/helm/

@jshaughn
Copy link
Collaborator

Closing as this seems resolved!

@jmazzitelli
Copy link
Collaborator

Only that off-track issue about the helm chart is resolved, not the original issue which was written up (FWIW, this is why I like to avoid hi-jacking issues with other unrelated issues).

The original issue is still going to be a problem that we need to address before istio 1.20 is released

@jmazzitelli jmazzitelli reopened this Sep 11, 2023
@jmazzitelli jmazzitelli self-assigned this Sep 14, 2023
@jmazzitelli
Copy link
Collaborator

jmazzitelli commented Sep 14, 2023

Just documenting what the latest json looks like (I ran the latest 1.20 dev build and printed out the /debug/endpointz results from istiod that Kiali gets back - this was running a simple istio install on KinD):

Istio 1.20 Registry Endpointz JSON
Istio 1.19 Registry Enpointz JSON

Here's the currently expected type definition (for Kiali 1.73): https://github.com/kiali/kiali/blob/v1.73.0/kubernetes/types.go#L247-L282

JSON is much different. This is likely not going to be trivial to refactor.

Also, we may not be able to support pre-1.20 and post.120 with the same Kiali server, though I am not sure (that is probably less of an issue to worry about - we just require an upgrade if going to 1.20+).

I do not know why Kiali maintains its own type here, as opposed to using a type that comes with an istio client library.

@howardjohn do you know if some istio Go library exists that clients can use that contain the debug/endpointz type?

Here's a snippet from the start of the 1.19 json:

[
  {
    "svc": "grafana.istio-system.svc.cluster.local:service",
    "ep": [
      {
        "service": {
          "Attributes": {
            "ServiceRegistry": "Kubernetes",
            "Name": "grafana",
            "Namespace": "istio-system",
            "Labels": {
              "app.kubernetes.io/instance": "grafana",
              "app.kubernetes.io/managed-by": "Helm",
              "app.kubernetes.io/name": "grafana",
              "app.kubernetes.io/version": "9.5.5",
              "helm.sh/chart": "grafana-6.57.4"
            },
            "ExportTo": null,
            "LabelSelectors": {
              "app.kubernetes.io/instance": "grafana",
              "app.kubernetes.io/name": "grafana"
            },
            "ClusterExternalAddresses": null,
            "ClusterExternalPorts": null,
            "Type": "ClusterIP",
            "ExternalName": "",
            "NodeLocal": false
          },
          "ports": [
            {
              "name": "service",
              "port": 3000,
              "protocol": "UnsupportedProtocol"
            }
          ],
          "creationTime": "2023-09-14T16:09:00Z",
          "hostname": "grafana.istio-system.svc.cluster.local",
          "clusterVIPs": {
            "Addresses": {
              "Kubernetes": [
                "10.96.111.173"
              ]
            }
          },
          "defaultAddress": "10.96.111.173",
          "Resolution": 0,
          "MeshExternal": false,
          "ResourceVersion": "11196"
        },
        "servicePort": {
          "name": "service",
          "port": 3000,
          "protocol": "UnsupportedProtocol"
        },
        "endpoint": {
          "Labels": {
            "app": "grafana",
            "app.kubernetes.io/instance": "grafana",
            "app.kubernetes.io/name": "grafana",
            "kubernetes.io/hostname": "kind-control-plane",
            "pod-template-hash": "5f9b8c6c5d",
            "sidecar.istio.io/inject": "false",
            "topology.istio.io/cluster": "Kubernetes",
            "topology.istio.io/network": ""
          },
          "Address": "10.244.0.24",
          "ServicePortName": "service",
          "ServiceAccount": "spiffe://cluster.local/ns/istio-system/sa/grafana",
          "Network": "",
          "Locality": {
            "Label": "",
            "ClusterID": "Kubernetes"
          },
          "EndpointPort": 3000,
          "LbWeight": 0,
          "TLSMode": "disabled",
          "Namespace": "istio-system",
          "WorkloadName": "grafana",
          "HostName": "",
          "SubDomain": "",
          "HealthStatus": 1,
          "NodeName": "kind-control-plane"
        }
      }
    ]
  },
  {
    "svc": "istio-egressgateway.istio-system.svc.cluster.local:http2",
...

And here's 1.20:

{
  "grafana.istio-system.svc.cluster.local": {
    "istio-system": {
      "Shards": {
        "Kubernetes/Kubernetes": [
          {
            "Labels": {
              "app": "grafana",
              "app.kubernetes.io/instance": "grafana",
              "app.kubernetes.io/name": "grafana",
              "kubernetes.io/hostname": "kind-control-plane",
              "pod-template-hash": "5f9b8c6c5d",
              "sidecar.istio.io/inject": "false",
              "topology.istio.io/cluster": "Kubernetes",
              "topology.istio.io/network": ""
            },
            "Address": "10.244.0.16",
            "ServicePortName": "service",
            "ServiceAccount": "spiffe://cluster.local/ns/istio-system/sa/grafana",
            "Network": "",
            "Locality": {
              "Label": "",
              "ClusterID": "Kubernetes"
            },
            "EndpointPort": 3000,
            "LbWeight": 0,
            "TLSMode": "disabled",
            "Namespace": "istio-system",
            "WorkloadName": "grafana",
            "HostName": "",
            "SubDomain": "",
            "HealthStatus": 1,
            "NodeName": "kind-control-plane"
          }
        ]
      },
      "ServiceAccounts": {
        "spiffe://cluster.local/ns/istio-system/sa/grafana": {}
      }
    }
  },
  "istio-egressgateway.istio-system.svc.cluster.local": {
...

@jshaughn
Copy link
Collaborator

It's understood that we depend on an unstable interface, but it should be noted that to do a lot of valuable things from the observability and mgmt side, this interface is very important. It would be great if there were a stable mgmt interface.

@jmazzitelli
Copy link
Collaborator

One thing that scares me with this change is the /debug/endpointz no longer contain information about the services that it did before -- this is missing now:

https://github.com/kiali/kiali/blob/v1.73.0/kubernetes/types.go#L255

		Service     IstioService `json:"service,omitempty"`

That Service data provides things like protocol (among other things) that is not in the JSON that comes back from /debug/endpointz but that Kiali code uses (at least, I can see references to this data).

@jmazzitelli
Copy link
Collaborator

To get a good example of what it now looks like, deploy istio 1.20 and the electronic demo and look at istiod's /debug/endpointz results:

Install Istio 1.20 (only available as a dev build right now):

hack/istio/download-istio.sh -div 1.20-dev
hack/istio/install-istio-via-istioctl.sh -ih default -it default

Install demo:

kubectl create namespace electronic-shop
kubectl label namespace electronic-shop istio-injection=enabled
kubectl apply -n electronic-shop -f <(curl -L https://raw.githubusercontent.com/kiali/demos/master/electronic-shop/electronic-shop.yaml)

Get istiod data:

kubectl exec -it -n istio-system deploy/istiod -- curl http://localhost:15014/debug/endpointz | jq 

jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Sep 19, 2023
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Sep 19, 2023
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Sep 20, 2023
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Sep 21, 2023
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Sep 22, 2023
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Sep 25, 2023
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Oct 4, 2023
jmazzitelli added a commit that referenced this issue Oct 4, 2023
* refactor for the /debug/endpointz changes in Istio 1.20
fixes: #6510

* changes to code that account for the data model changes

* stub out endpointz data

* remove everything endpointz related.
SetRegistryEndpoints is still there to show what data
was needed but it is never called.

* remove remaining remnants of /debug/endpointz
flavono123 added a commit to flavono123/terraform-aws-eks-blueprints that referenced this issue Nov 28, 2023
in istio 1.18.1 and kiali 1.67.0, following error occurs:

```
json: cannot unmarshal object into Go value of type []*kubernetes.RegistryEndpoint
```

this is fixed in 1.75.0:
- https://kiali.io/news/release-notes/#1750
- kiali/kiali#6510

bump for each 1.20.0/1.76.0, addons are by:
```sh
for ADDON in kiali jaeger prometheus grafana
do
    ADDON_URL="https://raw.githubusercontent.com/istio/istio/release-1.20/samples/addons/$ADDON.yaml"
    kubectl apply -f $ADDON_URL
done

```
hhovsepy pushed a commit to hhovsepy/kiali that referenced this issue Feb 6, 2024
* refactor for the /debug/endpointz changes in Istio 1.20
fixes: kiali#6510

* changes to code that account for the data model changes

* stub out endpointz data

* remove everything endpointz related.
SetRegistryEndpoints is still there to show what data
was needed but it is never called.

* remove remaining remnants of /debug/endpointz
hhovsepy added a commit that referenced this issue Feb 6, 2024
* refactor for the /debug/endpointz changes in Istio 1.20
fixes: #6510

* changes to code that account for the data model changes

* stub out endpointz data

* remove everything endpointz related.
SetRegistryEndpoints is still there to show what data
was needed but it is never called.

* remove remaining remnants of /debug/endpointz

Co-authored-by: John Mazzitelli <mazz@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Triaged Issue added to backlog bug Something isn't working
Projects
5 participants