fabric8io / kubernetes-client

Java client for Kubernetes & OpenShift
http://fabric8.io
Apache License 2.0
3.35k stars 1.45k forks source link

Add support for `v1.APIVersions` in KubernetesClient #6066

Closed rohanKanojia closed 1 week ago

rohanKanojia commented 1 month ago

Is your task related to a problem? Please describe

I bumped into this issue while writing tests for https://github.com/eclipse-jkube/jkube/issues/2663 where I use KubernetesMockServer via Helm CLI.

Kubernetes APIServer provides an endpoint to allow clients to discover the API at /api which is the root path of the legacy v1 API.

I'm not able to see any support in KubernetesClient for achieving this. APIVersions object is also absent from Kubernetes Model

Describe the solution you'd like

Describe alternatives you've considered

I'm using raw JSON string at the moment as a workaround that's a bit ugly.

Additional context

No response

manusa commented 1 month ago

We do have logic in place for /apis (APIGroupList, APIGroup).

And also for /api/v1 -or any other version- (APIResourceList, APIResource).

See getApiGroups and getApiResources.

Can you please elaborate on the use-case of this or on why it's specifically needed.

rohanKanojia commented 1 month ago

/api/v1 returns a APIResourceList just like /apis/{group}/{version}

/api endpoint is different as it allows clients to discover the API server. It's used by kubectl and helm CLI before making any request.

If we want to provide support for /api endpoint in Kubernetes Mock Server https://github.com/fabric8io/kubernetes-client/issues/6062 . We need to at least provide model support for this resource.