Home > Backend Development > Golang > Any equivalent/alternative for 'kubectl get Provisioner' in golang

Any equivalent/alternative for 'kubectl get Provisioner' in golang

PHPz
Release: 2024-02-12 13:57:06
forward
789 people have browsed it

golang 中“kubectl get Provisioner”的任何等效/替代项

Question content

We can use client-go to list the namespaces on the cluster, as follows:

clientset.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{})
Copy after login

Is there a similar option for the kubectl get provisioner command? I know client-go doesn't have this feature, but are there any other custom features I can use?

Solution

You can retrieve the required resources by using sigs.k8s.io/controller-runtime/pkg/client using unstructured objects.

refer to: https://pkg.go. dev/sigs.k8s.io/controller-runtime/pkg/client#example-Client-Get

The above is the detailed content of Any equivalent/alternative for 'kubectl get Provisioner' in golang. For more information, please follow other related articles on the PHP Chinese website!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template