https://rancher.com/ logo
Title
g

gentle-dream-1571

09/09/2022, 2:41 PM
We are building our product using Rancher and creating our own Rancher Dashboard plugin to customize the Dashboard. In our product, we have the concept of a Multi-Cluster Application where the Custom Resource object gets created on the admin cluster but the actual deployments/pods/etc. are spun up in one or more clusters, based on the settings in the Multi-Cluster Application. We would like to customize the “Details” page to get information about the Pods from all clusters where the application is running. Is there an easy way to query the different clusters to gather this data? We are looking at the
loadCluster
action defined in the store to switch the
currentCluster
but it seems to require a lot of information that we do not have readily available. Is this the right path or is there a better way?
f

full-painter-23916

09/09/2022, 3:06 PM
There is no mechanism for simultaneously talking to multiple downstream clusters. You can't just keep opening more connections, browsers have limits, etc. Fleet and MCA are designed to talk to a CRD in the one management/local cluster (and have limitations in what they do) because of this.
You could do it on the server side and present it as one response, but as you add clusters the chances of one of them responding slowly and the client having to sit a long time waiting approaches 100%
g

gentle-dream-1571

09/09/2022, 3:16 PM
@full-painter-23916 I understand the implications that you point out. My question is: Is there an easier way to switch the
currentCluster
than using the
loadCluster
action?
f

full-painter-23916

09/09/2022, 3:23 PM
I would just make one-off requests to /k8s/clusters/x/v1/pods (or something like that, on my phone and I don't work at suse anymore…) instead of trying to change the state of the store and causing it to switch the websocket and such
👍 1
And do them in parallel with a limit of like 4 at a time and a timeout for each
g

gentle-dream-1571

09/09/2022, 3:30 PM
Makes sense. I was already looking at that option. Thanks for confirming. Is there an easy way to get the token that the vuex store is using to make these requests?
f

full-painter-23916

09/09/2022, 3:43 PM
You can't get it at all, it's a httponly cookie. But you also don't need to, it will just be sent with the request
g

gentle-dream-1571

09/09/2022, 3:44 PM
Is there some special way that I need to send the request to make that happen?
f

full-painter-23916

09/09/2022, 3:46 PM
No
g

gentle-dream-1571

09/09/2022, 3:47 PM
thanks so much for your help!
👍 1