unikorn-cloud / kubernetes

Cluster API driven PaaS Orchestrator
Apache License 2.0
2 stars 4 forks source link

GetKubeConfig returns void #72

Open AdamFlanagan-Nscale opened 3 months ago

AdamFlanagan-Nscale commented 3 months ago

The Swagger docs don't seem to cover how this works, they seem to suggest an octet stream is returned. However undefined is returned.

API route /api/v1/organizations/{organization}/projects/{project}/clusters/{cluster}/kubeconfig

Generated client code

DefaultApi.apiV1OrganizationsOrganizationProjectsProjectClustersClusterKubeconfigGet(requestParameters: ApiV1OrganizationsOrganizationProjectsProjectClustersClusterKubeconfigGetRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<void>
spjmurray commented 3 months ago

So, logically, I would have thought the MIME type application/octet-stream would have returned a blob, likewise text/plain to return text, but alas no.

However I do note that VoidApiResponse does have raw in the ctor, so you should be able to await response.raw.blob(). I have tried to grok the API generator code, but it reads like R2D2 to me, so fuck it. Let me trial this workaround on UI and see what happens...

spjmurray commented 3 months ago

Far too much of my life has been squandered on this! @AdamFlanagan-Nscale see if this fills you needs:

https://github.com/unikorn-cloud/ui/blob/main/src/routes/(shell)/infrastructure/clusters/%2Bpage.svelte#L89

AdamFlanagan-Nscale commented 3 months ago

Thank you! Will give it a try when I'm back onto that page :)