ManageIQ / kubeclient

A Ruby client for Kubernetes REST API
MIT License
419 stars 167 forks source link

Is it possible to fetch ingress information? #620

Closed bezelga closed 1 year ago

bezelga commented 1 year ago

Hello, I would like to know if it is possible to fetch ingress information using this gem. I am interested in host information in order to fetch url for the services.

Could not find any references to it on the docs or code, I guess because the code treats the resources generically

Thanks in Advance

agrare commented 1 year ago

Hello @bezelga !

Kubeclient dynamically defines methods based on the APIResourceList for the API Group you requested. In the case of Ingresses if we look at the [k8s API reference] we see ingresses are in the networking.k8s.io group.

kubeclient = Kubeclient::Client.new('https://your_kubernetes_hostname:6443/apis/networking.k8s.io', 'v1', options)
kubeclient.discover
kubeclient.get_ingresses
[#<Kubeclient::Resource metadata={:name=>"httpd", :namespace=>"manageiq", :uid=>"988479dd-8114-4652-a758-3c3458e95a96", etc...

Hope that helps!

bezelga commented 1 year ago

Hi @agrare , that's perfect, thank you!!